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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_location;
28extern crate google_cloud_longrunning;
29extern crate google_cloud_lro;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request message for
42/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
43///
44/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct CreateKeyHandleRequest {
48    /// Required. Name of the resource project and location to create the
49    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
50    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
51    ///
52    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
53    pub parent: std::string::String,
54
55    /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
56    /// unique to the resource project and location. If not provided by the caller,
57    /// a new UUID is used.
58    ///
59    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
60    pub key_handle_id: std::string::String,
61
62    /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
63    ///
64    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
65    pub key_handle: std::option::Option<crate::model::KeyHandle>,
66
67    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
68}
69
70impl CreateKeyHandleRequest {
71    /// Creates a new default instance.
72    pub fn new() -> Self {
73        std::default::Default::default()
74    }
75
76    /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
77    ///
78    /// # Example
79    /// ```ignore,no_run
80    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
81    /// let x = CreateKeyHandleRequest::new().set_parent("example");
82    /// ```
83    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84        self.parent = v.into();
85        self
86    }
87
88    /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
89    ///
90    /// # Example
91    /// ```ignore,no_run
92    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
93    /// let x = CreateKeyHandleRequest::new().set_key_handle_id("example");
94    /// ```
95    pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
96        self.key_handle_id = v.into();
97        self
98    }
99
100    /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
101    ///
102    /// # Example
103    /// ```ignore,no_run
104    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
105    /// use google_cloud_kms_v1::model::KeyHandle;
106    /// let x = CreateKeyHandleRequest::new().set_key_handle(KeyHandle::default()/* use setters */);
107    /// ```
108    pub fn set_key_handle<T>(mut self, v: T) -> Self
109    where
110        T: std::convert::Into<crate::model::KeyHandle>,
111    {
112        self.key_handle = std::option::Option::Some(v.into());
113        self
114    }
115
116    /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
117    ///
118    /// # Example
119    /// ```ignore,no_run
120    /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
121    /// use google_cloud_kms_v1::model::KeyHandle;
122    /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(Some(KeyHandle::default()/* use setters */));
123    /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(None::<KeyHandle>);
124    /// ```
125    pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
126    where
127        T: std::convert::Into<crate::model::KeyHandle>,
128    {
129        self.key_handle = v.map(|x| x.into());
130        self
131    }
132}
133
134impl wkt::message::Message for CreateKeyHandleRequest {
135    fn typename() -> &'static str {
136        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
137    }
138}
139
140/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
141///
142/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
143#[derive(Clone, Default, PartialEq)]
144#[non_exhaustive]
145pub struct GetKeyHandleRequest {
146    /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
147    /// e.g.
148    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
149    ///
150    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
151    pub name: std::string::String,
152
153    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
154}
155
156impl GetKeyHandleRequest {
157    /// Creates a new default instance.
158    pub fn new() -> Self {
159        std::default::Default::default()
160    }
161
162    /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
163    ///
164    /// # Example
165    /// ```ignore,no_run
166    /// # use google_cloud_kms_v1::model::GetKeyHandleRequest;
167    /// # let project_id = "project_id";
168    /// # let location_id = "location_id";
169    /// # let key_handle_id = "key_handle_id";
170    /// let x = GetKeyHandleRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyHandles/{key_handle_id}"));
171    /// ```
172    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
173        self.name = v.into();
174        self
175    }
176}
177
178impl wkt::message::Message for GetKeyHandleRequest {
179    fn typename() -> &'static str {
180        "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
181    }
182}
183
184/// Resource-oriented representation of a request to Cloud KMS Autokey and the
185/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
186///
187/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
188#[derive(Clone, Default, PartialEq)]
189#[non_exhaustive]
190pub struct KeyHandle {
191    /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
192    /// resource, e.g.
193    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
194    ///
195    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
196    pub name: std::string::String,
197
198    /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
199    /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
200    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
201    /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
202    /// project will reflect the value configured in the
203    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
204    /// project's ancestor folder at the time of the
205    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
206    /// ancestor folder has a configured
207    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
208    /// configurations is used.
209    ///
210    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
211    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
212    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
213    pub kms_key: std::string::String,
214
215    /// Required. Indicates the resource type that the resulting
216    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
217    /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
218    /// types.
219    ///
220    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
221    pub resource_type_selector: std::string::String,
222
223    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
224}
225
226impl KeyHandle {
227    /// Creates a new default instance.
228    pub fn new() -> Self {
229        std::default::Default::default()
230    }
231
232    /// Sets the value of [name][crate::model::KeyHandle::name].
233    ///
234    /// # Example
235    /// ```ignore,no_run
236    /// # use google_cloud_kms_v1::model::KeyHandle;
237    /// # let project_id = "project_id";
238    /// # let location_id = "location_id";
239    /// # let key_handle_id = "key_handle_id";
240    /// let x = KeyHandle::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyHandles/{key_handle_id}"));
241    /// ```
242    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
243        self.name = v.into();
244        self
245    }
246
247    /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
248    ///
249    /// # Example
250    /// ```ignore,no_run
251    /// # use google_cloud_kms_v1::model::KeyHandle;
252    /// # let project_id = "project_id";
253    /// # let location_id = "location_id";
254    /// # let key_ring_id = "key_ring_id";
255    /// # let crypto_key_id = "crypto_key_id";
256    /// let x = KeyHandle::new().set_kms_key(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
257    /// ```
258    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
259        self.kms_key = v.into();
260        self
261    }
262
263    /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
264    ///
265    /// # Example
266    /// ```ignore,no_run
267    /// # use google_cloud_kms_v1::model::KeyHandle;
268    /// let x = KeyHandle::new().set_resource_type_selector("example");
269    /// ```
270    pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
271        mut self,
272        v: T,
273    ) -> Self {
274        self.resource_type_selector = v.into();
275        self
276    }
277}
278
279impl wkt::message::Message for KeyHandle {
280    fn typename() -> &'static str {
281        "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
282    }
283}
284
285/// Metadata message for
286/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
287/// operation response.
288///
289/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
290#[derive(Clone, Default, PartialEq)]
291#[non_exhaustive]
292pub struct CreateKeyHandleMetadata {
293    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
294}
295
296impl CreateKeyHandleMetadata {
297    /// Creates a new default instance.
298    pub fn new() -> Self {
299        std::default::Default::default()
300    }
301}
302
303impl wkt::message::Message for CreateKeyHandleMetadata {
304    fn typename() -> &'static str {
305        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
306    }
307}
308
309/// Request message for
310/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
311///
312/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
313#[derive(Clone, Default, PartialEq)]
314#[non_exhaustive]
315pub struct ListKeyHandlesRequest {
316    /// Required. Name of the resource project and location from which to list
317    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
318    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
319    ///
320    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
321    pub parent: std::string::String,
322
323    /// Optional. Optional limit on the number of
324    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
325    /// service may return fewer than this value. Further
326    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
327    /// including the
328    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
329    /// in a subsequent request.  If unspecified, at most 100
330    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
331    ///
332    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
333    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
334    pub page_size: i32,
335
336    /// Optional. Optional pagination token, returned earlier via
337    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
338    ///
339    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
340    pub page_token: std::string::String,
341
342    /// Optional. Filter to apply when listing
343    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
344    /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
345    ///
346    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
347    pub filter: std::string::String,
348
349    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
350}
351
352impl ListKeyHandlesRequest {
353    /// Creates a new default instance.
354    pub fn new() -> Self {
355        std::default::Default::default()
356    }
357
358    /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
359    ///
360    /// # Example
361    /// ```ignore,no_run
362    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
363    /// let x = ListKeyHandlesRequest::new().set_parent("example");
364    /// ```
365    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
366        self.parent = v.into();
367        self
368    }
369
370    /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
371    ///
372    /// # Example
373    /// ```ignore,no_run
374    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
375    /// let x = ListKeyHandlesRequest::new().set_page_size(42);
376    /// ```
377    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
378        self.page_size = v.into();
379        self
380    }
381
382    /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
383    ///
384    /// # Example
385    /// ```ignore,no_run
386    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
387    /// let x = ListKeyHandlesRequest::new().set_page_token("example");
388    /// ```
389    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
390        self.page_token = v.into();
391        self
392    }
393
394    /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
395    ///
396    /// # Example
397    /// ```ignore,no_run
398    /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
399    /// let x = ListKeyHandlesRequest::new().set_filter("example");
400    /// ```
401    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
402        self.filter = v.into();
403        self
404    }
405}
406
407impl wkt::message::Message for ListKeyHandlesRequest {
408    fn typename() -> &'static str {
409        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
410    }
411}
412
413/// Response message for
414/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
415///
416/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
417#[derive(Clone, Default, PartialEq)]
418#[non_exhaustive]
419pub struct ListKeyHandlesResponse {
420    /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
421    ///
422    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
423    pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
424
425    /// A token to retrieve next page of results. Pass this value in
426    /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
427    /// to retrieve the next page of results.
428    ///
429    /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
430    pub next_page_token: std::string::String,
431
432    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
433}
434
435impl ListKeyHandlesResponse {
436    /// Creates a new default instance.
437    pub fn new() -> Self {
438        std::default::Default::default()
439    }
440
441    /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
442    ///
443    /// # Example
444    /// ```ignore,no_run
445    /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
446    /// use google_cloud_kms_v1::model::KeyHandle;
447    /// let x = ListKeyHandlesResponse::new()
448    ///     .set_key_handles([
449    ///         KeyHandle::default()/* use setters */,
450    ///         KeyHandle::default()/* use (different) setters */,
451    ///     ]);
452    /// ```
453    pub fn set_key_handles<T, V>(mut self, v: T) -> Self
454    where
455        T: std::iter::IntoIterator<Item = V>,
456        V: std::convert::Into<crate::model::KeyHandle>,
457    {
458        use std::iter::Iterator;
459        self.key_handles = v.into_iter().map(|i| i.into()).collect();
460        self
461    }
462
463    /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
464    ///
465    /// # Example
466    /// ```ignore,no_run
467    /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
468    /// let x = ListKeyHandlesResponse::new().set_next_page_token("example");
469    /// ```
470    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
471        self.next_page_token = v.into();
472        self
473    }
474}
475
476impl wkt::message::Message for ListKeyHandlesResponse {
477    fn typename() -> &'static str {
478        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
479    }
480}
481
482#[doc(hidden)]
483impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
484    type PageItem = crate::model::KeyHandle;
485
486    fn items(self) -> std::vec::Vec<Self::PageItem> {
487        self.key_handles
488    }
489
490    fn next_page_token(&self) -> std::string::String {
491        use std::clone::Clone;
492        self.next_page_token.clone()
493    }
494}
495
496/// Request message for
497/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
498///
499/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
500#[derive(Clone, Default, PartialEq)]
501#[non_exhaustive]
502pub struct UpdateAutokeyConfigRequest {
503    /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
504    /// update.
505    ///
506    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
507    pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
508
509    /// Required. Masks which fields of the
510    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
511    /// `keyProject`.
512    ///
513    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
514    pub update_mask: std::option::Option<wkt::FieldMask>,
515
516    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
517}
518
519impl UpdateAutokeyConfigRequest {
520    /// Creates a new default instance.
521    pub fn new() -> Self {
522        std::default::Default::default()
523    }
524
525    /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
526    ///
527    /// # Example
528    /// ```ignore,no_run
529    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
530    /// use google_cloud_kms_v1::model::AutokeyConfig;
531    /// let x = UpdateAutokeyConfigRequest::new().set_autokey_config(AutokeyConfig::default()/* use setters */);
532    /// ```
533    pub fn set_autokey_config<T>(mut self, v: T) -> Self
534    where
535        T: std::convert::Into<crate::model::AutokeyConfig>,
536    {
537        self.autokey_config = std::option::Option::Some(v.into());
538        self
539    }
540
541    /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
542    ///
543    /// # Example
544    /// ```ignore,no_run
545    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
546    /// use google_cloud_kms_v1::model::AutokeyConfig;
547    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(Some(AutokeyConfig::default()/* use setters */));
548    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(None::<AutokeyConfig>);
549    /// ```
550    pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
551    where
552        T: std::convert::Into<crate::model::AutokeyConfig>,
553    {
554        self.autokey_config = v.map(|x| x.into());
555        self
556    }
557
558    /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
559    ///
560    /// # Example
561    /// ```ignore,no_run
562    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
563    /// use wkt::FieldMask;
564    /// let x = UpdateAutokeyConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
565    /// ```
566    pub fn set_update_mask<T>(mut self, v: T) -> Self
567    where
568        T: std::convert::Into<wkt::FieldMask>,
569    {
570        self.update_mask = std::option::Option::Some(v.into());
571        self
572    }
573
574    /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
575    ///
576    /// # Example
577    /// ```ignore,no_run
578    /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
579    /// use wkt::FieldMask;
580    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
581    /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
582    /// ```
583    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
584    where
585        T: std::convert::Into<wkt::FieldMask>,
586    {
587        self.update_mask = v.map(|x| x.into());
588        self
589    }
590}
591
592impl wkt::message::Message for UpdateAutokeyConfigRequest {
593    fn typename() -> &'static str {
594        "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
595    }
596}
597
598/// Request message for
599/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
600///
601/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
602#[derive(Clone, Default, PartialEq)]
603#[non_exhaustive]
604pub struct GetAutokeyConfigRequest {
605    /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
606    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
607    /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
608    ///
609    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
610    pub name: std::string::String,
611
612    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
613}
614
615impl GetAutokeyConfigRequest {
616    /// Creates a new default instance.
617    pub fn new() -> Self {
618        std::default::Default::default()
619    }
620
621    /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
622    ///
623    /// # Example
624    /// ```ignore,no_run
625    /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
626    /// # let folder_id = "folder_id";
627    /// let x = GetAutokeyConfigRequest::new().set_name(format!("folders/{folder_id}/autokeyConfig"));
628    /// ```
629    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
630        self.name = v.into();
631        self
632    }
633}
634
635impl wkt::message::Message for GetAutokeyConfigRequest {
636    fn typename() -> &'static str {
637        "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
638    }
639}
640
641/// Cloud KMS Autokey configuration for a folder.
642#[derive(Clone, Default, PartialEq)]
643#[non_exhaustive]
644pub struct AutokeyConfig {
645    /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
646    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
647    /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
648    ///
649    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
650    pub name: std::string::String,
651
652    /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
653    /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
654    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
655    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
656    /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
657    /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
658    /// this key project. Once configured, for Cloud KMS Autokey to function
659    /// properly, this key project must have the Cloud KMS API activated and the
660    /// Cloud KMS Service Agent for this key project must be granted the
661    /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
662    /// key project field will clear the configuration.
663    ///
664    /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
665    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
666    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
667    pub key_project: std::string::String,
668
669    /// Output only. The state for the AutokeyConfig.
670    pub state: crate::model::autokey_config::State,
671
672    /// Optional. A checksum computed by the server based on the value of other
673    /// fields. This may be sent on update requests to ensure that the client has
674    /// an up-to-date value before proceeding. The request will be rejected with an
675    /// ABORTED error on a mismatched etag.
676    pub etag: std::string::String,
677
678    /// Optional. KeyProjectResolutionMode for the AutokeyConfig.
679    /// Valid values are `DEDICATED_KEY_PROJECT`, `RESOURCE_PROJECT`, or
680    /// `DISABLED`.
681    pub key_project_resolution_mode: crate::model::autokey_config::KeyProjectResolutionMode,
682
683    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
684}
685
686impl AutokeyConfig {
687    /// Creates a new default instance.
688    pub fn new() -> Self {
689        std::default::Default::default()
690    }
691
692    /// Sets the value of [name][crate::model::AutokeyConfig::name].
693    ///
694    /// # Example
695    /// ```ignore,no_run
696    /// # use google_cloud_kms_v1::model::AutokeyConfig;
697    /// # let folder_id = "folder_id";
698    /// let x = AutokeyConfig::new().set_name(format!("folders/{folder_id}/autokeyConfig"));
699    /// ```
700    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
701        self.name = v.into();
702        self
703    }
704
705    /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
706    ///
707    /// # Example
708    /// ```ignore,no_run
709    /// # use google_cloud_kms_v1::model::AutokeyConfig;
710    /// let x = AutokeyConfig::new().set_key_project("example");
711    /// ```
712    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
713        self.key_project = v.into();
714        self
715    }
716
717    /// Sets the value of [state][crate::model::AutokeyConfig::state].
718    ///
719    /// # Example
720    /// ```ignore,no_run
721    /// # use google_cloud_kms_v1::model::AutokeyConfig;
722    /// use google_cloud_kms_v1::model::autokey_config::State;
723    /// let x0 = AutokeyConfig::new().set_state(State::Active);
724    /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
725    /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
726    /// ```
727    pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
728        mut self,
729        v: T,
730    ) -> Self {
731        self.state = v.into();
732        self
733    }
734
735    /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
736    ///
737    /// # Example
738    /// ```ignore,no_run
739    /// # use google_cloud_kms_v1::model::AutokeyConfig;
740    /// let x = AutokeyConfig::new().set_etag("example");
741    /// ```
742    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
743        self.etag = v.into();
744        self
745    }
746
747    /// Sets the value of [key_project_resolution_mode][crate::model::AutokeyConfig::key_project_resolution_mode].
748    ///
749    /// # Example
750    /// ```ignore,no_run
751    /// # use google_cloud_kms_v1::model::AutokeyConfig;
752    /// use google_cloud_kms_v1::model::autokey_config::KeyProjectResolutionMode;
753    /// let x0 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::DedicatedKeyProject);
754    /// let x1 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::ResourceProject);
755    /// let x2 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::Disabled);
756    /// ```
757    pub fn set_key_project_resolution_mode<
758        T: std::convert::Into<crate::model::autokey_config::KeyProjectResolutionMode>,
759    >(
760        mut self,
761        v: T,
762    ) -> Self {
763        self.key_project_resolution_mode = v.into();
764        self
765    }
766}
767
768impl wkt::message::Message for AutokeyConfig {
769    fn typename() -> &'static str {
770        "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
771    }
772}
773
774/// Defines additional types related to [AutokeyConfig].
775pub mod autokey_config {
776    #[allow(unused_imports)]
777    use super::*;
778
779    /// The states AutokeyConfig can be in.
780    ///
781    /// # Working with unknown values
782    ///
783    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
784    /// additional enum variants at any time. Adding new variants is not considered
785    /// a breaking change. Applications should write their code in anticipation of:
786    ///
787    /// - New values appearing in future releases of the client library, **and**
788    /// - New values received dynamically, without application changes.
789    ///
790    /// Please consult the [Working with enums] section in the user guide for some
791    /// guidelines.
792    ///
793    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
794    #[derive(Clone, Debug, PartialEq)]
795    #[non_exhaustive]
796    pub enum State {
797        /// The state of the AutokeyConfig is unspecified.
798        Unspecified,
799        /// The AutokeyConfig is currently active.
800        Active,
801        /// A previously configured key project has been deleted and the current
802        /// AutokeyConfig is unusable.
803        KeyProjectDeleted,
804        /// The AutokeyConfig is not yet initialized or has been reset to its default
805        /// uninitialized state.
806        Uninitialized,
807        /// The service account lacks the necessary permissions in the key project to
808        /// configure Autokey.
809        KeyProjectPermissionDenied,
810        /// If set, the enum was initialized with an unknown value.
811        ///
812        /// Applications can examine the value using [State::value] or
813        /// [State::name].
814        UnknownValue(state::UnknownValue),
815    }
816
817    #[doc(hidden)]
818    pub mod state {
819        #[allow(unused_imports)]
820        use super::*;
821        #[derive(Clone, Debug, PartialEq)]
822        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
823    }
824
825    impl State {
826        /// Gets the enum value.
827        ///
828        /// Returns `None` if the enum contains an unknown value deserialized from
829        /// the string representation of enums.
830        pub fn value(&self) -> std::option::Option<i32> {
831            match self {
832                Self::Unspecified => std::option::Option::Some(0),
833                Self::Active => std::option::Option::Some(1),
834                Self::KeyProjectDeleted => std::option::Option::Some(2),
835                Self::Uninitialized => std::option::Option::Some(3),
836                Self::KeyProjectPermissionDenied => std::option::Option::Some(4),
837                Self::UnknownValue(u) => u.0.value(),
838            }
839        }
840
841        /// Gets the enum value as a string.
842        ///
843        /// Returns `None` if the enum contains an unknown value deserialized from
844        /// the integer representation of enums.
845        pub fn name(&self) -> std::option::Option<&str> {
846            match self {
847                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
848                Self::Active => std::option::Option::Some("ACTIVE"),
849                Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
850                Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
851                Self::KeyProjectPermissionDenied => {
852                    std::option::Option::Some("KEY_PROJECT_PERMISSION_DENIED")
853                }
854                Self::UnknownValue(u) => u.0.name(),
855            }
856        }
857    }
858
859    impl std::default::Default for State {
860        fn default() -> Self {
861            use std::convert::From;
862            Self::from(0)
863        }
864    }
865
866    impl std::fmt::Display for State {
867        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
868            wkt::internal::display_enum(f, self.name(), self.value())
869        }
870    }
871
872    impl std::convert::From<i32> for State {
873        fn from(value: i32) -> Self {
874            match value {
875                0 => Self::Unspecified,
876                1 => Self::Active,
877                2 => Self::KeyProjectDeleted,
878                3 => Self::Uninitialized,
879                4 => Self::KeyProjectPermissionDenied,
880                _ => Self::UnknownValue(state::UnknownValue(
881                    wkt::internal::UnknownEnumValue::Integer(value),
882                )),
883            }
884        }
885    }
886
887    impl std::convert::From<&str> for State {
888        fn from(value: &str) -> Self {
889            use std::string::ToString;
890            match value {
891                "STATE_UNSPECIFIED" => Self::Unspecified,
892                "ACTIVE" => Self::Active,
893                "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
894                "UNINITIALIZED" => Self::Uninitialized,
895                "KEY_PROJECT_PERMISSION_DENIED" => Self::KeyProjectPermissionDenied,
896                _ => Self::UnknownValue(state::UnknownValue(
897                    wkt::internal::UnknownEnumValue::String(value.to_string()),
898                )),
899            }
900        }
901    }
902
903    impl serde::ser::Serialize for State {
904        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
905        where
906            S: serde::Serializer,
907        {
908            match self {
909                Self::Unspecified => serializer.serialize_i32(0),
910                Self::Active => serializer.serialize_i32(1),
911                Self::KeyProjectDeleted => serializer.serialize_i32(2),
912                Self::Uninitialized => serializer.serialize_i32(3),
913                Self::KeyProjectPermissionDenied => serializer.serialize_i32(4),
914                Self::UnknownValue(u) => u.0.serialize(serializer),
915            }
916        }
917    }
918
919    impl<'de> serde::de::Deserialize<'de> for State {
920        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
921        where
922            D: serde::Deserializer<'de>,
923        {
924            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
925                ".google.cloud.kms.v1.AutokeyConfig.State",
926            ))
927        }
928    }
929
930    /// Defines the resolution mode enum for the key project.
931    /// The
932    /// [KeyProjectResolutionMode][google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]
933    /// determines the mechanism by which
934    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] identifies a
935    /// [key_project][google.cloud.kms.v1.AutokeyConfig.key_project] at its
936    /// specific configuration node. This parameter also determines if Autokey can
937    /// be used within this project or folder.
938    ///
939    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
940    /// [google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]: crate::model::autokey_config::KeyProjectResolutionMode
941    /// [google.cloud.kms.v1.AutokeyConfig.key_project]: crate::model::AutokeyConfig::key_project
942    ///
943    /// # Working with unknown values
944    ///
945    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
946    /// additional enum variants at any time. Adding new variants is not considered
947    /// a breaking change. Applications should write their code in anticipation of:
948    ///
949    /// - New values appearing in future releases of the client library, **and**
950    /// - New values received dynamically, without application changes.
951    ///
952    /// Please consult the [Working with enums] section in the user guide for some
953    /// guidelines.
954    ///
955    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
956    #[derive(Clone, Debug, PartialEq)]
957    #[non_exhaustive]
958    pub enum KeyProjectResolutionMode {
959        /// Default value. KeyProjectResolutionMode when not specified will act as
960        /// `DEDICATED_KEY_PROJECT`.
961        Unspecified,
962        /// Keys are created in a dedicated project specified by `key_project`.
963        DedicatedKeyProject,
964        /// Keys are created in the same project as the resource requesting the key.
965        /// The `key_project` must not be set when this mode is used.
966        ResourceProject,
967        /// Disables the AutokeyConfig. When this mode is set, any AutokeyConfig
968        /// from higher levels in the resource hierarchy are ignored for this
969        /// resource and its descendants. This setting can be overridden
970        /// by a more specific configuration at a lower level. For example,
971        /// if Autokey is disabled on a folder, it can be re-enabled on a sub-folder
972        /// or project within that folder by setting a different mode (e.g.,
973        /// DEDICATED_KEY_PROJECT or RESOURCE_PROJECT).
974        Disabled,
975        /// If set, the enum was initialized with an unknown value.
976        ///
977        /// Applications can examine the value using [KeyProjectResolutionMode::value] or
978        /// [KeyProjectResolutionMode::name].
979        UnknownValue(key_project_resolution_mode::UnknownValue),
980    }
981
982    #[doc(hidden)]
983    pub mod key_project_resolution_mode {
984        #[allow(unused_imports)]
985        use super::*;
986        #[derive(Clone, Debug, PartialEq)]
987        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
988    }
989
990    impl KeyProjectResolutionMode {
991        /// Gets the enum value.
992        ///
993        /// Returns `None` if the enum contains an unknown value deserialized from
994        /// the string representation of enums.
995        pub fn value(&self) -> std::option::Option<i32> {
996            match self {
997                Self::Unspecified => std::option::Option::Some(0),
998                Self::DedicatedKeyProject => std::option::Option::Some(1),
999                Self::ResourceProject => std::option::Option::Some(2),
1000                Self::Disabled => std::option::Option::Some(3),
1001                Self::UnknownValue(u) => u.0.value(),
1002            }
1003        }
1004
1005        /// Gets the enum value as a string.
1006        ///
1007        /// Returns `None` if the enum contains an unknown value deserialized from
1008        /// the integer representation of enums.
1009        pub fn name(&self) -> std::option::Option<&str> {
1010            match self {
1011                Self::Unspecified => {
1012                    std::option::Option::Some("KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED")
1013                }
1014                Self::DedicatedKeyProject => std::option::Option::Some("DEDICATED_KEY_PROJECT"),
1015                Self::ResourceProject => std::option::Option::Some("RESOURCE_PROJECT"),
1016                Self::Disabled => std::option::Option::Some("DISABLED"),
1017                Self::UnknownValue(u) => u.0.name(),
1018            }
1019        }
1020    }
1021
1022    impl std::default::Default for KeyProjectResolutionMode {
1023        fn default() -> Self {
1024            use std::convert::From;
1025            Self::from(0)
1026        }
1027    }
1028
1029    impl std::fmt::Display for KeyProjectResolutionMode {
1030        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1031            wkt::internal::display_enum(f, self.name(), self.value())
1032        }
1033    }
1034
1035    impl std::convert::From<i32> for KeyProjectResolutionMode {
1036        fn from(value: i32) -> Self {
1037            match value {
1038                0 => Self::Unspecified,
1039                1 => Self::DedicatedKeyProject,
1040                2 => Self::ResourceProject,
1041                3 => Self::Disabled,
1042                _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1043                    wkt::internal::UnknownEnumValue::Integer(value),
1044                )),
1045            }
1046        }
1047    }
1048
1049    impl std::convert::From<&str> for KeyProjectResolutionMode {
1050        fn from(value: &str) -> Self {
1051            use std::string::ToString;
1052            match value {
1053                "KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED" => Self::Unspecified,
1054                "DEDICATED_KEY_PROJECT" => Self::DedicatedKeyProject,
1055                "RESOURCE_PROJECT" => Self::ResourceProject,
1056                "DISABLED" => Self::Disabled,
1057                _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1058                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1059                )),
1060            }
1061        }
1062    }
1063
1064    impl serde::ser::Serialize for KeyProjectResolutionMode {
1065        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1066        where
1067            S: serde::Serializer,
1068        {
1069            match self {
1070                Self::Unspecified => serializer.serialize_i32(0),
1071                Self::DedicatedKeyProject => serializer.serialize_i32(1),
1072                Self::ResourceProject => serializer.serialize_i32(2),
1073                Self::Disabled => serializer.serialize_i32(3),
1074                Self::UnknownValue(u) => u.0.serialize(serializer),
1075            }
1076        }
1077    }
1078
1079    impl<'de> serde::de::Deserialize<'de> for KeyProjectResolutionMode {
1080        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1081        where
1082            D: serde::Deserializer<'de>,
1083        {
1084            deserializer.deserialize_any(
1085                wkt::internal::EnumVisitor::<KeyProjectResolutionMode>::new(
1086                    ".google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode",
1087                ),
1088            )
1089        }
1090    }
1091}
1092
1093/// Request message for
1094/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1095///
1096/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1097#[derive(Clone, Default, PartialEq)]
1098#[non_exhaustive]
1099pub struct ShowEffectiveAutokeyConfigRequest {
1100    /// Required. Name of the resource project to the show effective Cloud KMS
1101    /// Autokey configuration for. This may be helpful for interrogating the effect
1102    /// of nested folder configurations on a given resource project.
1103    pub parent: std::string::String,
1104
1105    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1106}
1107
1108impl ShowEffectiveAutokeyConfigRequest {
1109    /// Creates a new default instance.
1110    pub fn new() -> Self {
1111        std::default::Default::default()
1112    }
1113
1114    /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
1115    ///
1116    /// # Example
1117    /// ```ignore,no_run
1118    /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
1119    /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
1120    /// ```
1121    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1122        self.parent = v.into();
1123        self
1124    }
1125}
1126
1127impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
1128    fn typename() -> &'static str {
1129        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
1130    }
1131}
1132
1133/// Response message for
1134/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1135///
1136/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1137#[derive(Clone, Default, PartialEq)]
1138#[non_exhaustive]
1139pub struct ShowEffectiveAutokeyConfigResponse {
1140    /// Name of the key project configured in the resource project's folder
1141    /// ancestry.
1142    pub key_project: std::string::String,
1143
1144    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1145}
1146
1147impl ShowEffectiveAutokeyConfigResponse {
1148    /// Creates a new default instance.
1149    pub fn new() -> Self {
1150        std::default::Default::default()
1151    }
1152
1153    /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
1154    ///
1155    /// # Example
1156    /// ```ignore,no_run
1157    /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
1158    /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
1159    /// ```
1160    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1161        self.key_project = v.into();
1162        self
1163    }
1164}
1165
1166impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
1167    fn typename() -> &'static str {
1168        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
1169    }
1170}
1171
1172/// Request message for
1173/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1174///
1175/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1176#[derive(Clone, Default, PartialEq)]
1177#[non_exhaustive]
1178pub struct ListEkmConnectionsRequest {
1179    /// Required. The resource name of the location associated with the
1180    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
1181    /// `projects/*/locations/*`.
1182    ///
1183    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1184    pub parent: std::string::String,
1185
1186    /// Optional. Optional limit on the number of
1187    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
1188    /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
1189    /// subsequently be obtained by including the
1190    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
1191    /// in a subsequent request. If unspecified, the server will pick an
1192    /// appropriate default.
1193    ///
1194    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1195    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1196    pub page_size: i32,
1197
1198    /// Optional. Optional pagination token, returned earlier via
1199    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
1200    ///
1201    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1202    pub page_token: std::string::String,
1203
1204    /// Optional. Only include resources that match the filter in the response. For
1205    /// more information, see
1206    /// [Sorting and filtering list
1207    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1208    pub filter: std::string::String,
1209
1210    /// Optional. Specify how the results should be sorted. If not specified, the
1211    /// results will be sorted in the default order.  For more information, see
1212    /// [Sorting and filtering list
1213    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1214    pub order_by: std::string::String,
1215
1216    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1217}
1218
1219impl ListEkmConnectionsRequest {
1220    /// Creates a new default instance.
1221    pub fn new() -> Self {
1222        std::default::Default::default()
1223    }
1224
1225    /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1226    ///
1227    /// # Example
1228    /// ```ignore,no_run
1229    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1230    /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1231    /// ```
1232    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1233        self.parent = v.into();
1234        self
1235    }
1236
1237    /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1238    ///
1239    /// # Example
1240    /// ```ignore,no_run
1241    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1242    /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1243    /// ```
1244    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1245        self.page_size = v.into();
1246        self
1247    }
1248
1249    /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1250    ///
1251    /// # Example
1252    /// ```ignore,no_run
1253    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1254    /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1255    /// ```
1256    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1257        self.page_token = v.into();
1258        self
1259    }
1260
1261    /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1262    ///
1263    /// # Example
1264    /// ```ignore,no_run
1265    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1266    /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1267    /// ```
1268    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1269        self.filter = v.into();
1270        self
1271    }
1272
1273    /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1274    ///
1275    /// # Example
1276    /// ```ignore,no_run
1277    /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1278    /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1279    /// ```
1280    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1281        self.order_by = v.into();
1282        self
1283    }
1284}
1285
1286impl wkt::message::Message for ListEkmConnectionsRequest {
1287    fn typename() -> &'static str {
1288        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1289    }
1290}
1291
1292/// Response message for
1293/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1294///
1295/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1296#[derive(Clone, Default, PartialEq)]
1297#[non_exhaustive]
1298pub struct ListEkmConnectionsResponse {
1299    /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1300    ///
1301    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1302    pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1303
1304    /// A token to retrieve next page of results. Pass this value in
1305    /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1306    /// to retrieve the next page of results.
1307    ///
1308    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1309    pub next_page_token: std::string::String,
1310
1311    /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1312    /// that matched the query.
1313    ///
1314    /// This field is not populated if
1315    /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1316    /// is applied.
1317    ///
1318    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1319    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1320    pub total_size: i32,
1321
1322    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1323}
1324
1325impl ListEkmConnectionsResponse {
1326    /// Creates a new default instance.
1327    pub fn new() -> Self {
1328        std::default::Default::default()
1329    }
1330
1331    /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1332    ///
1333    /// # Example
1334    /// ```ignore,no_run
1335    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1336    /// use google_cloud_kms_v1::model::EkmConnection;
1337    /// let x = ListEkmConnectionsResponse::new()
1338    ///     .set_ekm_connections([
1339    ///         EkmConnection::default()/* use setters */,
1340    ///         EkmConnection::default()/* use (different) setters */,
1341    ///     ]);
1342    /// ```
1343    pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1344    where
1345        T: std::iter::IntoIterator<Item = V>,
1346        V: std::convert::Into<crate::model::EkmConnection>,
1347    {
1348        use std::iter::Iterator;
1349        self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1350        self
1351    }
1352
1353    /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1354    ///
1355    /// # Example
1356    /// ```ignore,no_run
1357    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1358    /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1359    /// ```
1360    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1361        self.next_page_token = v.into();
1362        self
1363    }
1364
1365    /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1366    ///
1367    /// # Example
1368    /// ```ignore,no_run
1369    /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1370    /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1371    /// ```
1372    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1373        self.total_size = v.into();
1374        self
1375    }
1376}
1377
1378impl wkt::message::Message for ListEkmConnectionsResponse {
1379    fn typename() -> &'static str {
1380        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1381    }
1382}
1383
1384#[doc(hidden)]
1385impl google_cloud_gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1386    type PageItem = crate::model::EkmConnection;
1387
1388    fn items(self) -> std::vec::Vec<Self::PageItem> {
1389        self.ekm_connections
1390    }
1391
1392    fn next_page_token(&self) -> std::string::String {
1393        use std::clone::Clone;
1394        self.next_page_token.clone()
1395    }
1396}
1397
1398/// Request message for
1399/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1400///
1401/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1402#[derive(Clone, Default, PartialEq)]
1403#[non_exhaustive]
1404pub struct GetEkmConnectionRequest {
1405    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1406    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1407    ///
1408    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1409    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1410    pub name: std::string::String,
1411
1412    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1413}
1414
1415impl GetEkmConnectionRequest {
1416    /// Creates a new default instance.
1417    pub fn new() -> Self {
1418        std::default::Default::default()
1419    }
1420
1421    /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1422    ///
1423    /// # Example
1424    /// ```ignore,no_run
1425    /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1426    /// # let project_id = "project_id";
1427    /// # let location_id = "location_id";
1428    /// # let ekm_connection_id = "ekm_connection_id";
1429    /// let x = GetEkmConnectionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
1430    /// ```
1431    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1432        self.name = v.into();
1433        self
1434    }
1435}
1436
1437impl wkt::message::Message for GetEkmConnectionRequest {
1438    fn typename() -> &'static str {
1439        "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1440    }
1441}
1442
1443/// Request message for
1444/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1445///
1446/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1447#[derive(Clone, Default, PartialEq)]
1448#[non_exhaustive]
1449pub struct CreateEkmConnectionRequest {
1450    /// Required. The resource name of the location associated with the
1451    /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1452    /// `projects/*/locations/*`.
1453    ///
1454    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1455    pub parent: std::string::String,
1456
1457    /// Required. It must be unique within a location and match the regular
1458    /// expression `[a-zA-Z0-9_-]{1,63}`.
1459    pub ekm_connection_id: std::string::String,
1460
1461    /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1462    /// initial field values.
1463    ///
1464    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1465    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1466
1467    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1468}
1469
1470impl CreateEkmConnectionRequest {
1471    /// Creates a new default instance.
1472    pub fn new() -> Self {
1473        std::default::Default::default()
1474    }
1475
1476    /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1477    ///
1478    /// # Example
1479    /// ```ignore,no_run
1480    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1481    /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1482    /// ```
1483    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1484        self.parent = v.into();
1485        self
1486    }
1487
1488    /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1489    ///
1490    /// # Example
1491    /// ```ignore,no_run
1492    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1493    /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1494    /// ```
1495    pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1496        mut self,
1497        v: T,
1498    ) -> Self {
1499        self.ekm_connection_id = v.into();
1500        self
1501    }
1502
1503    /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1504    ///
1505    /// # Example
1506    /// ```ignore,no_run
1507    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1508    /// use google_cloud_kms_v1::model::EkmConnection;
1509    /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1510    /// ```
1511    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1512    where
1513        T: std::convert::Into<crate::model::EkmConnection>,
1514    {
1515        self.ekm_connection = std::option::Option::Some(v.into());
1516        self
1517    }
1518
1519    /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1520    ///
1521    /// # Example
1522    /// ```ignore,no_run
1523    /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1524    /// use google_cloud_kms_v1::model::EkmConnection;
1525    /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1526    /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1527    /// ```
1528    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1529    where
1530        T: std::convert::Into<crate::model::EkmConnection>,
1531    {
1532        self.ekm_connection = v.map(|x| x.into());
1533        self
1534    }
1535}
1536
1537impl wkt::message::Message for CreateEkmConnectionRequest {
1538    fn typename() -> &'static str {
1539        "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1540    }
1541}
1542
1543/// Request message for
1544/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1545///
1546/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1547#[derive(Clone, Default, PartialEq)]
1548#[non_exhaustive]
1549pub struct UpdateEkmConnectionRequest {
1550    /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1551    /// values.
1552    ///
1553    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1554    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1555
1556    /// Required. List of fields to be updated in this request.
1557    pub update_mask: std::option::Option<wkt::FieldMask>,
1558
1559    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1560}
1561
1562impl UpdateEkmConnectionRequest {
1563    /// Creates a new default instance.
1564    pub fn new() -> Self {
1565        std::default::Default::default()
1566    }
1567
1568    /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1569    ///
1570    /// # Example
1571    /// ```ignore,no_run
1572    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1573    /// use google_cloud_kms_v1::model::EkmConnection;
1574    /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1575    /// ```
1576    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1577    where
1578        T: std::convert::Into<crate::model::EkmConnection>,
1579    {
1580        self.ekm_connection = std::option::Option::Some(v.into());
1581        self
1582    }
1583
1584    /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1585    ///
1586    /// # Example
1587    /// ```ignore,no_run
1588    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1589    /// use google_cloud_kms_v1::model::EkmConnection;
1590    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1591    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1592    /// ```
1593    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1594    where
1595        T: std::convert::Into<crate::model::EkmConnection>,
1596    {
1597        self.ekm_connection = v.map(|x| x.into());
1598        self
1599    }
1600
1601    /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1602    ///
1603    /// # Example
1604    /// ```ignore,no_run
1605    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1606    /// use wkt::FieldMask;
1607    /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1608    /// ```
1609    pub fn set_update_mask<T>(mut self, v: T) -> Self
1610    where
1611        T: std::convert::Into<wkt::FieldMask>,
1612    {
1613        self.update_mask = std::option::Option::Some(v.into());
1614        self
1615    }
1616
1617    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1618    ///
1619    /// # Example
1620    /// ```ignore,no_run
1621    /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1622    /// use wkt::FieldMask;
1623    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1624    /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1625    /// ```
1626    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1627    where
1628        T: std::convert::Into<wkt::FieldMask>,
1629    {
1630        self.update_mask = v.map(|x| x.into());
1631        self
1632    }
1633}
1634
1635impl wkt::message::Message for UpdateEkmConnectionRequest {
1636    fn typename() -> &'static str {
1637        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1638    }
1639}
1640
1641/// Request message for
1642/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1643///
1644/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1645#[derive(Clone, Default, PartialEq)]
1646#[non_exhaustive]
1647pub struct GetEkmConfigRequest {
1648    /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1649    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1650    ///
1651    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1652    /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1653    pub name: std::string::String,
1654
1655    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1656}
1657
1658impl GetEkmConfigRequest {
1659    /// Creates a new default instance.
1660    pub fn new() -> Self {
1661        std::default::Default::default()
1662    }
1663
1664    /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1665    ///
1666    /// # Example
1667    /// ```ignore,no_run
1668    /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1669    /// # let project_id = "project_id";
1670    /// # let location_id = "location_id";
1671    /// let x = GetEkmConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConfig"));
1672    /// ```
1673    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1674        self.name = v.into();
1675        self
1676    }
1677}
1678
1679impl wkt::message::Message for GetEkmConfigRequest {
1680    fn typename() -> &'static str {
1681        "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1682    }
1683}
1684
1685/// Request message for
1686/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1687///
1688/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1689#[derive(Clone, Default, PartialEq)]
1690#[non_exhaustive]
1691pub struct UpdateEkmConfigRequest {
1692    /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1693    ///
1694    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1695    pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1696
1697    /// Required. List of fields to be updated in this request.
1698    pub update_mask: std::option::Option<wkt::FieldMask>,
1699
1700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1701}
1702
1703impl UpdateEkmConfigRequest {
1704    /// Creates a new default instance.
1705    pub fn new() -> Self {
1706        std::default::Default::default()
1707    }
1708
1709    /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1710    ///
1711    /// # Example
1712    /// ```ignore,no_run
1713    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1714    /// use google_cloud_kms_v1::model::EkmConfig;
1715    /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1716    /// ```
1717    pub fn set_ekm_config<T>(mut self, v: T) -> Self
1718    where
1719        T: std::convert::Into<crate::model::EkmConfig>,
1720    {
1721        self.ekm_config = std::option::Option::Some(v.into());
1722        self
1723    }
1724
1725    /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1726    ///
1727    /// # Example
1728    /// ```ignore,no_run
1729    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1730    /// use google_cloud_kms_v1::model::EkmConfig;
1731    /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1732    /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1733    /// ```
1734    pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1735    where
1736        T: std::convert::Into<crate::model::EkmConfig>,
1737    {
1738        self.ekm_config = v.map(|x| x.into());
1739        self
1740    }
1741
1742    /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1743    ///
1744    /// # Example
1745    /// ```ignore,no_run
1746    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1747    /// use wkt::FieldMask;
1748    /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1749    /// ```
1750    pub fn set_update_mask<T>(mut self, v: T) -> Self
1751    where
1752        T: std::convert::Into<wkt::FieldMask>,
1753    {
1754        self.update_mask = std::option::Option::Some(v.into());
1755        self
1756    }
1757
1758    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1759    ///
1760    /// # Example
1761    /// ```ignore,no_run
1762    /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1763    /// use wkt::FieldMask;
1764    /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1765    /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1766    /// ```
1767    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1768    where
1769        T: std::convert::Into<wkt::FieldMask>,
1770    {
1771        self.update_mask = v.map(|x| x.into());
1772        self
1773    }
1774}
1775
1776impl wkt::message::Message for UpdateEkmConfigRequest {
1777    fn typename() -> &'static str {
1778        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1779    }
1780}
1781
1782/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1783/// certificate used to authenticate HTTPS connections to EKM replicas.
1784///
1785/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1786#[derive(Clone, Default, PartialEq)]
1787#[non_exhaustive]
1788pub struct Certificate {
1789    /// Required. The raw certificate bytes in DER format.
1790    pub raw_der: ::bytes::Bytes,
1791
1792    /// Output only. True if the certificate was parsed successfully.
1793    pub parsed: bool,
1794
1795    /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1796    /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1797    ///
1798    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1799    pub issuer: std::string::String,
1800
1801    /// Output only. The subject distinguished name in RFC 2253 format. Only
1802    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1803    ///
1804    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1805    pub subject: std::string::String,
1806
1807    /// Output only. The subject Alternative DNS names. Only present if
1808    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1809    ///
1810    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1811    pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1812
1813    /// Output only. The certificate is not valid before this time. Only present if
1814    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1815    ///
1816    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1817    pub not_before_time: std::option::Option<wkt::Timestamp>,
1818
1819    /// Output only. The certificate is not valid after this time. Only present if
1820    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1821    ///
1822    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1823    pub not_after_time: std::option::Option<wkt::Timestamp>,
1824
1825    /// Output only. The certificate serial number as a hex string. Only present if
1826    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1827    ///
1828    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1829    pub serial_number: std::string::String,
1830
1831    /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1832    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1833    ///
1834    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1835    pub sha256_fingerprint: std::string::String,
1836
1837    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1838}
1839
1840impl Certificate {
1841    /// Creates a new default instance.
1842    pub fn new() -> Self {
1843        std::default::Default::default()
1844    }
1845
1846    /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1847    ///
1848    /// # Example
1849    /// ```ignore,no_run
1850    /// # use google_cloud_kms_v1::model::Certificate;
1851    /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1852    /// ```
1853    pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1854        self.raw_der = v.into();
1855        self
1856    }
1857
1858    /// Sets the value of [parsed][crate::model::Certificate::parsed].
1859    ///
1860    /// # Example
1861    /// ```ignore,no_run
1862    /// # use google_cloud_kms_v1::model::Certificate;
1863    /// let x = Certificate::new().set_parsed(true);
1864    /// ```
1865    pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1866        self.parsed = v.into();
1867        self
1868    }
1869
1870    /// Sets the value of [issuer][crate::model::Certificate::issuer].
1871    ///
1872    /// # Example
1873    /// ```ignore,no_run
1874    /// # use google_cloud_kms_v1::model::Certificate;
1875    /// let x = Certificate::new().set_issuer("example");
1876    /// ```
1877    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1878        self.issuer = v.into();
1879        self
1880    }
1881
1882    /// Sets the value of [subject][crate::model::Certificate::subject].
1883    ///
1884    /// # Example
1885    /// ```ignore,no_run
1886    /// # use google_cloud_kms_v1::model::Certificate;
1887    /// let x = Certificate::new().set_subject("example");
1888    /// ```
1889    pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1890        self.subject = v.into();
1891        self
1892    }
1893
1894    /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1895    ///
1896    /// # Example
1897    /// ```ignore,no_run
1898    /// # use google_cloud_kms_v1::model::Certificate;
1899    /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1900    /// ```
1901    pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1902    where
1903        T: std::iter::IntoIterator<Item = V>,
1904        V: std::convert::Into<std::string::String>,
1905    {
1906        use std::iter::Iterator;
1907        self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1908        self
1909    }
1910
1911    /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1912    ///
1913    /// # Example
1914    /// ```ignore,no_run
1915    /// # use google_cloud_kms_v1::model::Certificate;
1916    /// use wkt::Timestamp;
1917    /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1918    /// ```
1919    pub fn set_not_before_time<T>(mut self, v: T) -> Self
1920    where
1921        T: std::convert::Into<wkt::Timestamp>,
1922    {
1923        self.not_before_time = std::option::Option::Some(v.into());
1924        self
1925    }
1926
1927    /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1928    ///
1929    /// # Example
1930    /// ```ignore,no_run
1931    /// # use google_cloud_kms_v1::model::Certificate;
1932    /// use wkt::Timestamp;
1933    /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1934    /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1935    /// ```
1936    pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1937    where
1938        T: std::convert::Into<wkt::Timestamp>,
1939    {
1940        self.not_before_time = v.map(|x| x.into());
1941        self
1942    }
1943
1944    /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1945    ///
1946    /// # Example
1947    /// ```ignore,no_run
1948    /// # use google_cloud_kms_v1::model::Certificate;
1949    /// use wkt::Timestamp;
1950    /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1951    /// ```
1952    pub fn set_not_after_time<T>(mut self, v: T) -> Self
1953    where
1954        T: std::convert::Into<wkt::Timestamp>,
1955    {
1956        self.not_after_time = std::option::Option::Some(v.into());
1957        self
1958    }
1959
1960    /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1961    ///
1962    /// # Example
1963    /// ```ignore,no_run
1964    /// # use google_cloud_kms_v1::model::Certificate;
1965    /// use wkt::Timestamp;
1966    /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1967    /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1968    /// ```
1969    pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1970    where
1971        T: std::convert::Into<wkt::Timestamp>,
1972    {
1973        self.not_after_time = v.map(|x| x.into());
1974        self
1975    }
1976
1977    /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1978    ///
1979    /// # Example
1980    /// ```ignore,no_run
1981    /// # use google_cloud_kms_v1::model::Certificate;
1982    /// let x = Certificate::new().set_serial_number("example");
1983    /// ```
1984    pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1985        self.serial_number = v.into();
1986        self
1987    }
1988
1989    /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1990    ///
1991    /// # Example
1992    /// ```ignore,no_run
1993    /// # use google_cloud_kms_v1::model::Certificate;
1994    /// let x = Certificate::new().set_sha256_fingerprint("example");
1995    /// ```
1996    pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1997        mut self,
1998        v: T,
1999    ) -> Self {
2000        self.sha256_fingerprint = v.into();
2001        self
2002    }
2003}
2004
2005impl wkt::message::Message for Certificate {
2006    fn typename() -> &'static str {
2007        "type.googleapis.com/google.cloud.kms.v1.Certificate"
2008    }
2009}
2010
2011/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
2012/// individual EKM connection. It can be used for creating
2013/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2014/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2015/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2016/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
2017/// performing cryptographic operations using keys created within the
2018/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2019///
2020/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2021/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2022/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2023/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2024/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2025#[derive(Clone, Default, PartialEq)]
2026#[non_exhaustive]
2027pub struct EkmConnection {
2028    /// Output only. The resource name for the
2029    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
2030    /// `projects/*/locations/*/ekmConnections/*`.
2031    ///
2032    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2033    pub name: std::string::String,
2034
2035    /// Output only. The time at which the
2036    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
2037    ///
2038    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2039    pub create_time: std::option::Option<wkt::Timestamp>,
2040
2041    /// Optional. A list of
2042    /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
2043    /// the EKM can be reached. There should be one ServiceResolver per EKM
2044    /// replica. Currently, only a single
2045    /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
2046    /// supported.
2047    ///
2048    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2049    pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
2050
2051    /// Optional. Etag of the currently stored
2052    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2053    ///
2054    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2055    pub etag: std::string::String,
2056
2057    /// Optional. Describes who can perform control plane operations on the EKM. If
2058    /// unset, this defaults to
2059    /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
2060    ///
2061    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
2062    pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
2063
2064    /// Optional. Identifies the EKM Crypto Space that this
2065    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
2066    /// field is required if
2067    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
2068    /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
2069    ///
2070    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2071    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2072    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
2073    pub crypto_space_path: std::string::String,
2074
2075    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2076}
2077
2078impl EkmConnection {
2079    /// Creates a new default instance.
2080    pub fn new() -> Self {
2081        std::default::Default::default()
2082    }
2083
2084    /// Sets the value of [name][crate::model::EkmConnection::name].
2085    ///
2086    /// # Example
2087    /// ```ignore,no_run
2088    /// # use google_cloud_kms_v1::model::EkmConnection;
2089    /// # let project_id = "project_id";
2090    /// # let location_id = "location_id";
2091    /// # let ekm_connection_id = "ekm_connection_id";
2092    /// let x = EkmConnection::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2093    /// ```
2094    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2095        self.name = v.into();
2096        self
2097    }
2098
2099    /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
2100    ///
2101    /// # Example
2102    /// ```ignore,no_run
2103    /// # use google_cloud_kms_v1::model::EkmConnection;
2104    /// use wkt::Timestamp;
2105    /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
2106    /// ```
2107    pub fn set_create_time<T>(mut self, v: T) -> Self
2108    where
2109        T: std::convert::Into<wkt::Timestamp>,
2110    {
2111        self.create_time = std::option::Option::Some(v.into());
2112        self
2113    }
2114
2115    /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
2116    ///
2117    /// # Example
2118    /// ```ignore,no_run
2119    /// # use google_cloud_kms_v1::model::EkmConnection;
2120    /// use wkt::Timestamp;
2121    /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2122    /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
2123    /// ```
2124    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2125    where
2126        T: std::convert::Into<wkt::Timestamp>,
2127    {
2128        self.create_time = v.map(|x| x.into());
2129        self
2130    }
2131
2132    /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
2133    ///
2134    /// # Example
2135    /// ```ignore,no_run
2136    /// # use google_cloud_kms_v1::model::EkmConnection;
2137    /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2138    /// let x = EkmConnection::new()
2139    ///     .set_service_resolvers([
2140    ///         ServiceResolver::default()/* use setters */,
2141    ///         ServiceResolver::default()/* use (different) setters */,
2142    ///     ]);
2143    /// ```
2144    pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
2145    where
2146        T: std::iter::IntoIterator<Item = V>,
2147        V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
2148    {
2149        use std::iter::Iterator;
2150        self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
2151        self
2152    }
2153
2154    /// Sets the value of [etag][crate::model::EkmConnection::etag].
2155    ///
2156    /// # Example
2157    /// ```ignore,no_run
2158    /// # use google_cloud_kms_v1::model::EkmConnection;
2159    /// let x = EkmConnection::new().set_etag("example");
2160    /// ```
2161    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2162        self.etag = v.into();
2163        self
2164    }
2165
2166    /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
2167    ///
2168    /// # Example
2169    /// ```ignore,no_run
2170    /// # use google_cloud_kms_v1::model::EkmConnection;
2171    /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
2172    /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
2173    /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
2174    /// ```
2175    pub fn set_key_management_mode<
2176        T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
2177    >(
2178        mut self,
2179        v: T,
2180    ) -> Self {
2181        self.key_management_mode = v.into();
2182        self
2183    }
2184
2185    /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
2186    ///
2187    /// # Example
2188    /// ```ignore,no_run
2189    /// # use google_cloud_kms_v1::model::EkmConnection;
2190    /// let x = EkmConnection::new().set_crypto_space_path("example");
2191    /// ```
2192    pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
2193        mut self,
2194        v: T,
2195    ) -> Self {
2196        self.crypto_space_path = v.into();
2197        self
2198    }
2199}
2200
2201impl wkt::message::Message for EkmConnection {
2202    fn typename() -> &'static str {
2203        "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
2204    }
2205}
2206
2207/// Defines additional types related to [EkmConnection].
2208pub mod ekm_connection {
2209    #[allow(unused_imports)]
2210    use super::*;
2211
2212    /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
2213    /// represents an EKM replica that can be reached within an
2214    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2215    ///
2216    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2217    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2218    #[derive(Clone, Default, PartialEq)]
2219    #[non_exhaustive]
2220    pub struct ServiceResolver {
2221        /// Required. The resource name of the Service Directory service pointing to
2222        /// an EKM replica, in the format
2223        /// `projects/*/locations/*/namespaces/*/services/*`.
2224        pub service_directory_service: std::string::String,
2225
2226        /// Optional. The filter applied to the endpoints of the resolved service. If
2227        /// no filter is specified, all endpoints will be considered. An endpoint
2228        /// will be chosen arbitrarily from the filtered list for each request.
2229        ///
2230        /// For endpoint filter syntax and examples, see
2231        /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
2232        pub endpoint_filter: std::string::String,
2233
2234        /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
2235        pub hostname: std::string::String,
2236
2237        /// Required. A list of leaf server certificates used to authenticate HTTPS
2238        /// connections to the EKM replica. Currently, a maximum of 10
2239        /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2240        ///
2241        /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2242        pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2243
2244        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2245    }
2246
2247    impl ServiceResolver {
2248        /// Creates a new default instance.
2249        pub fn new() -> Self {
2250            std::default::Default::default()
2251        }
2252
2253        /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2254        ///
2255        /// # Example
2256        /// ```ignore,no_run
2257        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2258        /// let x = ServiceResolver::new().set_service_directory_service("example");
2259        /// ```
2260        pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2261            mut self,
2262            v: T,
2263        ) -> Self {
2264            self.service_directory_service = v.into();
2265            self
2266        }
2267
2268        /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2269        ///
2270        /// # Example
2271        /// ```ignore,no_run
2272        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2273        /// let x = ServiceResolver::new().set_endpoint_filter("example");
2274        /// ```
2275        pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2276            mut self,
2277            v: T,
2278        ) -> Self {
2279            self.endpoint_filter = v.into();
2280            self
2281        }
2282
2283        /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2284        ///
2285        /// # Example
2286        /// ```ignore,no_run
2287        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2288        /// let x = ServiceResolver::new().set_hostname("example");
2289        /// ```
2290        pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2291            self.hostname = v.into();
2292            self
2293        }
2294
2295        /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2296        ///
2297        /// # Example
2298        /// ```ignore,no_run
2299        /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2300        /// use google_cloud_kms_v1::model::Certificate;
2301        /// let x = ServiceResolver::new()
2302        ///     .set_server_certificates([
2303        ///         Certificate::default()/* use setters */,
2304        ///         Certificate::default()/* use (different) setters */,
2305        ///     ]);
2306        /// ```
2307        pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2308        where
2309            T: std::iter::IntoIterator<Item = V>,
2310            V: std::convert::Into<crate::model::Certificate>,
2311        {
2312            use std::iter::Iterator;
2313            self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2314            self
2315        }
2316    }
2317
2318    impl wkt::message::Message for ServiceResolver {
2319        fn typename() -> &'static str {
2320            "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2321        }
2322    }
2323
2324    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2325    /// describes who can perform control plane cryptographic operations using this
2326    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2327    ///
2328    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2329    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2330    ///
2331    /// # Working with unknown values
2332    ///
2333    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2334    /// additional enum variants at any time. Adding new variants is not considered
2335    /// a breaking change. Applications should write their code in anticipation of:
2336    ///
2337    /// - New values appearing in future releases of the client library, **and**
2338    /// - New values received dynamically, without application changes.
2339    ///
2340    /// Please consult the [Working with enums] section in the user guide for some
2341    /// guidelines.
2342    ///
2343    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2344    #[derive(Clone, Debug, PartialEq)]
2345    #[non_exhaustive]
2346    pub enum KeyManagementMode {
2347        /// Not specified.
2348        Unspecified,
2349        /// EKM-side key management operations on
2350        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2351        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2352        /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2353        ///
2354        /// * When creating a
2355        ///   [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2356        ///   this
2357        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2358        ///   supply the key path of pre-existing external key material that will be
2359        ///   linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2360        /// * Destruction of external key material cannot be requested via the
2361        ///   Cloud KMS API and must be performed directly in the EKM.
2362        /// * Automatic rotation of key material is not supported.
2363        ///
2364        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2365        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2366        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2367        Manual,
2368        /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2369        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2370        /// management operations initiated from Cloud KMS. This means that:
2371        ///
2372        /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2373        ///   associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2374        ///   is
2375        ///   created, the EKM automatically generates new key material and a new
2376        ///   key path. The caller cannot supply the key path of pre-existing
2377        ///   external key material.
2378        /// * Destruction of external key material associated with this
2379        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2380        ///   calling
2381        ///   [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2382        /// * Automatic rotation of key material is supported.
2383        ///
2384        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2385        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2386        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2387        /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2388        CloudKms,
2389        /// If set, the enum was initialized with an unknown value.
2390        ///
2391        /// Applications can examine the value using [KeyManagementMode::value] or
2392        /// [KeyManagementMode::name].
2393        UnknownValue(key_management_mode::UnknownValue),
2394    }
2395
2396    #[doc(hidden)]
2397    pub mod key_management_mode {
2398        #[allow(unused_imports)]
2399        use super::*;
2400        #[derive(Clone, Debug, PartialEq)]
2401        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2402    }
2403
2404    impl KeyManagementMode {
2405        /// Gets the enum value.
2406        ///
2407        /// Returns `None` if the enum contains an unknown value deserialized from
2408        /// the string representation of enums.
2409        pub fn value(&self) -> std::option::Option<i32> {
2410            match self {
2411                Self::Unspecified => std::option::Option::Some(0),
2412                Self::Manual => std::option::Option::Some(1),
2413                Self::CloudKms => std::option::Option::Some(2),
2414                Self::UnknownValue(u) => u.0.value(),
2415            }
2416        }
2417
2418        /// Gets the enum value as a string.
2419        ///
2420        /// Returns `None` if the enum contains an unknown value deserialized from
2421        /// the integer representation of enums.
2422        pub fn name(&self) -> std::option::Option<&str> {
2423            match self {
2424                Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2425                Self::Manual => std::option::Option::Some("MANUAL"),
2426                Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2427                Self::UnknownValue(u) => u.0.name(),
2428            }
2429        }
2430    }
2431
2432    impl std::default::Default for KeyManagementMode {
2433        fn default() -> Self {
2434            use std::convert::From;
2435            Self::from(0)
2436        }
2437    }
2438
2439    impl std::fmt::Display for KeyManagementMode {
2440        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2441            wkt::internal::display_enum(f, self.name(), self.value())
2442        }
2443    }
2444
2445    impl std::convert::From<i32> for KeyManagementMode {
2446        fn from(value: i32) -> Self {
2447            match value {
2448                0 => Self::Unspecified,
2449                1 => Self::Manual,
2450                2 => Self::CloudKms,
2451                _ => Self::UnknownValue(key_management_mode::UnknownValue(
2452                    wkt::internal::UnknownEnumValue::Integer(value),
2453                )),
2454            }
2455        }
2456    }
2457
2458    impl std::convert::From<&str> for KeyManagementMode {
2459        fn from(value: &str) -> Self {
2460            use std::string::ToString;
2461            match value {
2462                "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2463                "MANUAL" => Self::Manual,
2464                "CLOUD_KMS" => Self::CloudKms,
2465                _ => Self::UnknownValue(key_management_mode::UnknownValue(
2466                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2467                )),
2468            }
2469        }
2470    }
2471
2472    impl serde::ser::Serialize for KeyManagementMode {
2473        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2474        where
2475            S: serde::Serializer,
2476        {
2477            match self {
2478                Self::Unspecified => serializer.serialize_i32(0),
2479                Self::Manual => serializer.serialize_i32(1),
2480                Self::CloudKms => serializer.serialize_i32(2),
2481                Self::UnknownValue(u) => u.0.serialize(serializer),
2482            }
2483        }
2484    }
2485
2486    impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2487        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2488        where
2489            D: serde::Deserializer<'de>,
2490        {
2491            deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2492                ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2493            ))
2494        }
2495    }
2496}
2497
2498/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2499/// represents configuration parameters that apply to all
2500/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2501/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2502/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2503/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2504/// project and location.
2505///
2506/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2507/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2508/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2509/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2510/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2511#[derive(Clone, Default, PartialEq)]
2512#[non_exhaustive]
2513pub struct EkmConfig {
2514    /// Output only. The resource name for the
2515    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2516    /// `projects/*/locations/*/ekmConfig`.
2517    ///
2518    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2519    pub name: std::string::String,
2520
2521    /// Optional. Resource name of the default
2522    /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2523    /// the empty string removes the default.
2524    ///
2525    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2526    pub default_ekm_connection: std::string::String,
2527
2528    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2529}
2530
2531impl EkmConfig {
2532    /// Creates a new default instance.
2533    pub fn new() -> Self {
2534        std::default::Default::default()
2535    }
2536
2537    /// Sets the value of [name][crate::model::EkmConfig::name].
2538    ///
2539    /// # Example
2540    /// ```ignore,no_run
2541    /// # use google_cloud_kms_v1::model::EkmConfig;
2542    /// # let project_id = "project_id";
2543    /// # let location_id = "location_id";
2544    /// let x = EkmConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConfig"));
2545    /// ```
2546    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2547        self.name = v.into();
2548        self
2549    }
2550
2551    /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2552    ///
2553    /// # Example
2554    /// ```ignore,no_run
2555    /// # use google_cloud_kms_v1::model::EkmConfig;
2556    /// # let project_id = "project_id";
2557    /// # let location_id = "location_id";
2558    /// # let ekm_connection_id = "ekm_connection_id";
2559    /// let x = EkmConfig::new().set_default_ekm_connection(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2560    /// ```
2561    pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2562        mut self,
2563        v: T,
2564    ) -> Self {
2565        self.default_ekm_connection = v.into();
2566        self
2567    }
2568}
2569
2570impl wkt::message::Message for EkmConfig {
2571    fn typename() -> &'static str {
2572        "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2573    }
2574}
2575
2576/// Request message for
2577/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2578///
2579/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2580#[derive(Clone, Default, PartialEq)]
2581#[non_exhaustive]
2582pub struct VerifyConnectivityRequest {
2583    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2584    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2585    ///
2586    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2587    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2588    pub name: std::string::String,
2589
2590    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2591}
2592
2593impl VerifyConnectivityRequest {
2594    /// Creates a new default instance.
2595    pub fn new() -> Self {
2596        std::default::Default::default()
2597    }
2598
2599    /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2600    ///
2601    /// # Example
2602    /// ```ignore,no_run
2603    /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2604    /// # let project_id = "project_id";
2605    /// # let location_id = "location_id";
2606    /// # let ekm_connection_id = "ekm_connection_id";
2607    /// let x = VerifyConnectivityRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2608    /// ```
2609    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2610        self.name = v.into();
2611        self
2612    }
2613}
2614
2615impl wkt::message::Message for VerifyConnectivityRequest {
2616    fn typename() -> &'static str {
2617        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2618    }
2619}
2620
2621/// Response message for
2622/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2623///
2624/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2625#[derive(Clone, Default, PartialEq)]
2626#[non_exhaustive]
2627pub struct VerifyConnectivityResponse {
2628    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2629}
2630
2631impl VerifyConnectivityResponse {
2632    /// Creates a new default instance.
2633    pub fn new() -> Self {
2634        std::default::Default::default()
2635    }
2636}
2637
2638impl wkt::message::Message for VerifyConnectivityResponse {
2639    fn typename() -> &'static str {
2640        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2641    }
2642}
2643
2644/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2645/// represents a single-tenant HSM instance. It can be used for creating
2646/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2647/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2648/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2649/// well as performing cryptographic operations using keys created within the
2650/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2651///
2652/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2653/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2654/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2655#[derive(Clone, Default, PartialEq)]
2656#[non_exhaustive]
2657pub struct SingleTenantHsmInstance {
2658    /// Identifier. The resource name for this
2659    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2660    /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2661    ///
2662    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2663    pub name: std::string::String,
2664
2665    /// Output only. The time at which the
2666    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2667    /// created.
2668    ///
2669    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2670    pub create_time: std::option::Option<wkt::Timestamp>,
2671
2672    /// Output only. The state of the
2673    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2674    ///
2675    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2676    pub state: crate::model::single_tenant_hsm_instance::State,
2677
2678    /// Required. The quorum auth configuration for the
2679    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2680    ///
2681    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2682    pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2683
2684    /// Output only. The time at which the
2685    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2686    /// deleted.
2687    ///
2688    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2689    pub delete_time: std::option::Option<wkt::Timestamp>,
2690
2691    /// Output only. The system-defined duration that an instance can remain
2692    /// unrefreshed until it is automatically disabled. This will have a value of
2693    /// 730 days.
2694    pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2695
2696    /// Output only. The time at which the instance will be automatically disabled
2697    /// if not refreshed. This field is updated upon creation and after each
2698    /// successful refresh operation and enable. A
2699    /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2700    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2701    /// before this time otherwise the
2702    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2703    /// become disabled.
2704    ///
2705    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2706    pub disable_time: std::option::Option<wkt::Timestamp>,
2707
2708    /// Optional. Immutable. Indicates whether key portability is enabled for the
2709    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2710    /// This can only be set at creation time. Key portability features are
2711    /// disabled by default and not yet available in GA.
2712    ///
2713    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2714    pub key_portability_enabled: bool,
2715
2716    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2717}
2718
2719impl SingleTenantHsmInstance {
2720    /// Creates a new default instance.
2721    pub fn new() -> Self {
2722        std::default::Default::default()
2723    }
2724
2725    /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2726    ///
2727    /// # Example
2728    /// ```ignore,no_run
2729    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2730    /// # let project_id = "project_id";
2731    /// # let location_id = "location_id";
2732    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
2733    /// let x = SingleTenantHsmInstance::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
2734    /// ```
2735    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2736        self.name = v.into();
2737        self
2738    }
2739
2740    /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2741    ///
2742    /// # Example
2743    /// ```ignore,no_run
2744    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2745    /// use wkt::Timestamp;
2746    /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2747    /// ```
2748    pub fn set_create_time<T>(mut self, v: T) -> Self
2749    where
2750        T: std::convert::Into<wkt::Timestamp>,
2751    {
2752        self.create_time = std::option::Option::Some(v.into());
2753        self
2754    }
2755
2756    /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2757    ///
2758    /// # Example
2759    /// ```ignore,no_run
2760    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2761    /// use wkt::Timestamp;
2762    /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2763    /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2764    /// ```
2765    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2766    where
2767        T: std::convert::Into<wkt::Timestamp>,
2768    {
2769        self.create_time = v.map(|x| x.into());
2770        self
2771    }
2772
2773    /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2774    ///
2775    /// # Example
2776    /// ```ignore,no_run
2777    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2778    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2779    /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2780    /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2781    /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2782    /// ```
2783    pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2784        mut self,
2785        v: T,
2786    ) -> Self {
2787        self.state = v.into();
2788        self
2789    }
2790
2791    /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2792    ///
2793    /// # Example
2794    /// ```ignore,no_run
2795    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2796    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2797    /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2798    /// ```
2799    pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2800    where
2801        T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2802    {
2803        self.quorum_auth = std::option::Option::Some(v.into());
2804        self
2805    }
2806
2807    /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2808    ///
2809    /// # Example
2810    /// ```ignore,no_run
2811    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2812    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2813    /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2814    /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2815    /// ```
2816    pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2817    where
2818        T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2819    {
2820        self.quorum_auth = v.map(|x| x.into());
2821        self
2822    }
2823
2824    /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2825    ///
2826    /// # Example
2827    /// ```ignore,no_run
2828    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2829    /// use wkt::Timestamp;
2830    /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2831    /// ```
2832    pub fn set_delete_time<T>(mut self, v: T) -> Self
2833    where
2834        T: std::convert::Into<wkt::Timestamp>,
2835    {
2836        self.delete_time = std::option::Option::Some(v.into());
2837        self
2838    }
2839
2840    /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2841    ///
2842    /// # Example
2843    /// ```ignore,no_run
2844    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2845    /// use wkt::Timestamp;
2846    /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2847    /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2848    /// ```
2849    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2850    where
2851        T: std::convert::Into<wkt::Timestamp>,
2852    {
2853        self.delete_time = v.map(|x| x.into());
2854        self
2855    }
2856
2857    /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2858    ///
2859    /// # Example
2860    /// ```ignore,no_run
2861    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2862    /// use wkt::Duration;
2863    /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2864    /// ```
2865    pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2866    where
2867        T: std::convert::Into<wkt::Duration>,
2868    {
2869        self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2870        self
2871    }
2872
2873    /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2874    ///
2875    /// # Example
2876    /// ```ignore,no_run
2877    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2878    /// use wkt::Duration;
2879    /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2880    /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2881    /// ```
2882    pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2883        mut self,
2884        v: std::option::Option<T>,
2885    ) -> Self
2886    where
2887        T: std::convert::Into<wkt::Duration>,
2888    {
2889        self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2890        self
2891    }
2892
2893    /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2894    ///
2895    /// # Example
2896    /// ```ignore,no_run
2897    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2898    /// use wkt::Timestamp;
2899    /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2900    /// ```
2901    pub fn set_disable_time<T>(mut self, v: T) -> Self
2902    where
2903        T: std::convert::Into<wkt::Timestamp>,
2904    {
2905        self.disable_time = std::option::Option::Some(v.into());
2906        self
2907    }
2908
2909    /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2910    ///
2911    /// # Example
2912    /// ```ignore,no_run
2913    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2914    /// use wkt::Timestamp;
2915    /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2916    /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2917    /// ```
2918    pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2919    where
2920        T: std::convert::Into<wkt::Timestamp>,
2921    {
2922        self.disable_time = v.map(|x| x.into());
2923        self
2924    }
2925
2926    /// Sets the value of [key_portability_enabled][crate::model::SingleTenantHsmInstance::key_portability_enabled].
2927    ///
2928    /// # Example
2929    /// ```ignore,no_run
2930    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2931    /// let x = SingleTenantHsmInstance::new().set_key_portability_enabled(true);
2932    /// ```
2933    pub fn set_key_portability_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2934        self.key_portability_enabled = v.into();
2935        self
2936    }
2937}
2938
2939impl wkt::message::Message for SingleTenantHsmInstance {
2940    fn typename() -> &'static str {
2941        "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2942    }
2943}
2944
2945/// Defines additional types related to [SingleTenantHsmInstance].
2946pub mod single_tenant_hsm_instance {
2947    #[allow(unused_imports)]
2948    use super::*;
2949
2950    /// Configuration for M of N quorum auth.
2951    #[derive(Clone, Default, PartialEq)]
2952    #[non_exhaustive]
2953    pub struct QuorumAuth {
2954        /// Required. The total number of approvers. This is the N value used
2955        /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2956        /// or equal to 16.
2957        pub total_approver_count: i32,
2958
2959        /// Output only. The required numbers of approvers. The M value used for M of
2960        /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2961        /// to
2962        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2963        ///
2964        ///
2965        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2966        pub required_approver_count: i32,
2967
2968        /// Output only. The public keys associated with the 2FA keys for M of N
2969        /// quorum auth.
2970        pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2971
2972        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2973    }
2974
2975    impl QuorumAuth {
2976        /// Creates a new default instance.
2977        pub fn new() -> Self {
2978            std::default::Default::default()
2979        }
2980
2981        /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2982        ///
2983        /// # Example
2984        /// ```ignore,no_run
2985        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2986        /// let x = QuorumAuth::new().set_total_approver_count(42);
2987        /// ```
2988        pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2989            self.total_approver_count = v.into();
2990            self
2991        }
2992
2993        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2994        ///
2995        /// # Example
2996        /// ```ignore,no_run
2997        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2998        /// let x = QuorumAuth::new().set_required_approver_count(42);
2999        /// ```
3000        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3001            self.required_approver_count = v.into();
3002            self
3003        }
3004
3005        /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
3006        ///
3007        /// # Example
3008        /// ```ignore,no_run
3009        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
3010        /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
3011        /// ```
3012        pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
3013        where
3014            T: std::iter::IntoIterator<Item = V>,
3015            V: std::convert::Into<std::string::String>,
3016        {
3017            use std::iter::Iterator;
3018            self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
3019            self
3020        }
3021    }
3022
3023    impl wkt::message::Message for QuorumAuth {
3024        fn typename() -> &'static str {
3025            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
3026        }
3027    }
3028
3029    /// The set of states of a
3030    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3031    ///
3032    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3033    ///
3034    /// # Working with unknown values
3035    ///
3036    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3037    /// additional enum variants at any time. Adding new variants is not considered
3038    /// a breaking change. Applications should write their code in anticipation of:
3039    ///
3040    /// - New values appearing in future releases of the client library, **and**
3041    /// - New values received dynamically, without application changes.
3042    ///
3043    /// Please consult the [Working with enums] section in the user guide for some
3044    /// guidelines.
3045    ///
3046    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3047    #[derive(Clone, Debug, PartialEq)]
3048    #[non_exhaustive]
3049    pub enum State {
3050        /// Not specified.
3051        Unspecified,
3052        /// The
3053        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3054        /// being created.
3055        ///
3056        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3057        Creating,
3058        /// The
3059        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3060        /// waiting for 2FA keys to be registered. This can be done by calling
3061        /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
3062        /// with the [RegisterTwoFactorAuthKeys][] operation.
3063        ///
3064        /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
3065        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3066        PendingTwoFactorAuthRegistration,
3067        /// The
3068        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3069        /// ready to use. A
3070        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3071        /// must be in the
3072        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
3073        /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
3074        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
3075        /// be usable.
3076        ///
3077        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3078        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3079        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
3080        Active,
3081        /// The
3082        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3083        /// being disabled.
3084        ///
3085        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3086        Disabling,
3087        /// The
3088        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3089        /// disabled.
3090        ///
3091        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3092        Disabled,
3093        /// The
3094        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3095        /// being deleted. Requests to the instance will be rejected in this state.
3096        ///
3097        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3098        Deleting,
3099        /// The
3100        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3101        /// has been deleted.
3102        ///
3103        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3104        Deleted,
3105        /// The
3106        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3107        /// has failed and can not be recovered or used.
3108        ///
3109        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3110        Failed,
3111        /// If set, the enum was initialized with an unknown value.
3112        ///
3113        /// Applications can examine the value using [State::value] or
3114        /// [State::name].
3115        UnknownValue(state::UnknownValue),
3116    }
3117
3118    #[doc(hidden)]
3119    pub mod state {
3120        #[allow(unused_imports)]
3121        use super::*;
3122        #[derive(Clone, Debug, PartialEq)]
3123        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3124    }
3125
3126    impl State {
3127        /// Gets the enum value.
3128        ///
3129        /// Returns `None` if the enum contains an unknown value deserialized from
3130        /// the string representation of enums.
3131        pub fn value(&self) -> std::option::Option<i32> {
3132            match self {
3133                Self::Unspecified => std::option::Option::Some(0),
3134                Self::Creating => std::option::Option::Some(1),
3135                Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
3136                Self::Active => std::option::Option::Some(3),
3137                Self::Disabling => std::option::Option::Some(4),
3138                Self::Disabled => std::option::Option::Some(5),
3139                Self::Deleting => std::option::Option::Some(6),
3140                Self::Deleted => std::option::Option::Some(7),
3141                Self::Failed => std::option::Option::Some(8),
3142                Self::UnknownValue(u) => u.0.value(),
3143            }
3144        }
3145
3146        /// Gets the enum value as a string.
3147        ///
3148        /// Returns `None` if the enum contains an unknown value deserialized from
3149        /// the integer representation of enums.
3150        pub fn name(&self) -> std::option::Option<&str> {
3151            match self {
3152                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3153                Self::Creating => std::option::Option::Some("CREATING"),
3154                Self::PendingTwoFactorAuthRegistration => {
3155                    std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
3156                }
3157                Self::Active => std::option::Option::Some("ACTIVE"),
3158                Self::Disabling => std::option::Option::Some("DISABLING"),
3159                Self::Disabled => std::option::Option::Some("DISABLED"),
3160                Self::Deleting => std::option::Option::Some("DELETING"),
3161                Self::Deleted => std::option::Option::Some("DELETED"),
3162                Self::Failed => std::option::Option::Some("FAILED"),
3163                Self::UnknownValue(u) => u.0.name(),
3164            }
3165        }
3166    }
3167
3168    impl std::default::Default for State {
3169        fn default() -> Self {
3170            use std::convert::From;
3171            Self::from(0)
3172        }
3173    }
3174
3175    impl std::fmt::Display for State {
3176        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3177            wkt::internal::display_enum(f, self.name(), self.value())
3178        }
3179    }
3180
3181    impl std::convert::From<i32> for State {
3182        fn from(value: i32) -> Self {
3183            match value {
3184                0 => Self::Unspecified,
3185                1 => Self::Creating,
3186                2 => Self::PendingTwoFactorAuthRegistration,
3187                3 => Self::Active,
3188                4 => Self::Disabling,
3189                5 => Self::Disabled,
3190                6 => Self::Deleting,
3191                7 => Self::Deleted,
3192                8 => Self::Failed,
3193                _ => Self::UnknownValue(state::UnknownValue(
3194                    wkt::internal::UnknownEnumValue::Integer(value),
3195                )),
3196            }
3197        }
3198    }
3199
3200    impl std::convert::From<&str> for State {
3201        fn from(value: &str) -> Self {
3202            use std::string::ToString;
3203            match value {
3204                "STATE_UNSPECIFIED" => Self::Unspecified,
3205                "CREATING" => Self::Creating,
3206                "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
3207                "ACTIVE" => Self::Active,
3208                "DISABLING" => Self::Disabling,
3209                "DISABLED" => Self::Disabled,
3210                "DELETING" => Self::Deleting,
3211                "DELETED" => Self::Deleted,
3212                "FAILED" => Self::Failed,
3213                _ => Self::UnknownValue(state::UnknownValue(
3214                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3215                )),
3216            }
3217        }
3218    }
3219
3220    impl serde::ser::Serialize for State {
3221        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3222        where
3223            S: serde::Serializer,
3224        {
3225            match self {
3226                Self::Unspecified => serializer.serialize_i32(0),
3227                Self::Creating => serializer.serialize_i32(1),
3228                Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
3229                Self::Active => serializer.serialize_i32(3),
3230                Self::Disabling => serializer.serialize_i32(4),
3231                Self::Disabled => serializer.serialize_i32(5),
3232                Self::Deleting => serializer.serialize_i32(6),
3233                Self::Deleted => serializer.serialize_i32(7),
3234                Self::Failed => serializer.serialize_i32(8),
3235                Self::UnknownValue(u) => u.0.serialize(serializer),
3236            }
3237        }
3238    }
3239
3240    impl<'de> serde::de::Deserialize<'de> for State {
3241        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3242        where
3243            D: serde::Deserializer<'de>,
3244        {
3245            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3246                ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
3247            ))
3248        }
3249    }
3250}
3251
3252/// A
3253/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3254/// represents a proposal to perform an operation on a
3255/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3256///
3257/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3258/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3259#[derive(Clone, Default, PartialEq)]
3260#[non_exhaustive]
3261pub struct SingleTenantHsmInstanceProposal {
3262    /// Identifier. The resource name for this
3263    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
3264    /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
3265    ///
3266    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3267    pub name: std::string::String,
3268
3269    /// Output only. The time at which the
3270    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3271    /// was created.
3272    ///
3273    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3274    pub create_time: std::option::Option<wkt::Timestamp>,
3275
3276    /// Output only. The state of the
3277    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3278    ///
3279    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3280    pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3281
3282    /// Output only. The root cause of the most recent failure. Only present if
3283    /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3284    /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3285    ///
3286    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3287    pub failure_reason: std::string::String,
3288
3289    /// Output only. The time at which the
3290    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3291    /// was deleted.
3292    ///
3293    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3294    pub delete_time: std::option::Option<wkt::Timestamp>,
3295
3296    /// Output only. The time at which the soft-deleted
3297    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3298    /// will be permanently purged. This field is only populated
3299    /// when the state is DELETED and will be set a time after expiration of the
3300    /// proposal, i.e. >= expire_time or (create_time + ttl).
3301    ///
3302    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3303    pub purge_time: std::option::Option<wkt::Timestamp>,
3304
3305    /// The approval parameters for the
3306    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3307    /// The type of parameters is determined by the operation being proposed.
3308    ///
3309    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3310    pub approval_parameters:
3311        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3312
3313    /// The expiration of the
3314    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3315    /// If not set, the
3316    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3317    /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3318    /// time is 5 minutes.
3319    ///
3320    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3321    pub expiration:
3322        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3323
3324    /// The operation to perform on the
3325    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3326    ///
3327    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3328    pub operation:
3329        std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3330
3331    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3332}
3333
3334impl SingleTenantHsmInstanceProposal {
3335    /// Creates a new default instance.
3336    pub fn new() -> Self {
3337        std::default::Default::default()
3338    }
3339
3340    /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3341    ///
3342    /// # Example
3343    /// ```ignore,no_run
3344    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3345    /// # let project_id = "project_id";
3346    /// # let location_id = "location_id";
3347    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
3348    /// # let proposal_id = "proposal_id";
3349    /// let x = SingleTenantHsmInstanceProposal::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
3350    /// ```
3351    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3352        self.name = v.into();
3353        self
3354    }
3355
3356    /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3357    ///
3358    /// # Example
3359    /// ```ignore,no_run
3360    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3361    /// use wkt::Timestamp;
3362    /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3363    /// ```
3364    pub fn set_create_time<T>(mut self, v: T) -> Self
3365    where
3366        T: std::convert::Into<wkt::Timestamp>,
3367    {
3368        self.create_time = std::option::Option::Some(v.into());
3369        self
3370    }
3371
3372    /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3373    ///
3374    /// # Example
3375    /// ```ignore,no_run
3376    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3377    /// use wkt::Timestamp;
3378    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3379    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3380    /// ```
3381    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3382    where
3383        T: std::convert::Into<wkt::Timestamp>,
3384    {
3385        self.create_time = v.map(|x| x.into());
3386        self
3387    }
3388
3389    /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3390    ///
3391    /// # Example
3392    /// ```ignore,no_run
3393    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3394    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3395    /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3396    /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3397    /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3398    /// ```
3399    pub fn set_state<
3400        T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3401    >(
3402        mut self,
3403        v: T,
3404    ) -> Self {
3405        self.state = v.into();
3406        self
3407    }
3408
3409    /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3410    ///
3411    /// # Example
3412    /// ```ignore,no_run
3413    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3414    /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3415    /// ```
3416    pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3417        self.failure_reason = v.into();
3418        self
3419    }
3420
3421    /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3422    ///
3423    /// # Example
3424    /// ```ignore,no_run
3425    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3426    /// use wkt::Timestamp;
3427    /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3428    /// ```
3429    pub fn set_delete_time<T>(mut self, v: T) -> Self
3430    where
3431        T: std::convert::Into<wkt::Timestamp>,
3432    {
3433        self.delete_time = std::option::Option::Some(v.into());
3434        self
3435    }
3436
3437    /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3438    ///
3439    /// # Example
3440    /// ```ignore,no_run
3441    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3442    /// use wkt::Timestamp;
3443    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3444    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3445    /// ```
3446    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3447    where
3448        T: std::convert::Into<wkt::Timestamp>,
3449    {
3450        self.delete_time = v.map(|x| x.into());
3451        self
3452    }
3453
3454    /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3455    ///
3456    /// # Example
3457    /// ```ignore,no_run
3458    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3459    /// use wkt::Timestamp;
3460    /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3461    /// ```
3462    pub fn set_purge_time<T>(mut self, v: T) -> Self
3463    where
3464        T: std::convert::Into<wkt::Timestamp>,
3465    {
3466        self.purge_time = std::option::Option::Some(v.into());
3467        self
3468    }
3469
3470    /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3471    ///
3472    /// # Example
3473    /// ```ignore,no_run
3474    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3475    /// use wkt::Timestamp;
3476    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3477    /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3478    /// ```
3479    pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3480    where
3481        T: std::convert::Into<wkt::Timestamp>,
3482    {
3483        self.purge_time = v.map(|x| x.into());
3484        self
3485    }
3486
3487    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3488    ///
3489    /// Note that all the setters affecting `approval_parameters` are mutually
3490    /// exclusive.
3491    ///
3492    /// # Example
3493    /// ```ignore,no_run
3494    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3495    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3496    /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3497    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3498    /// ```
3499    pub fn set_approval_parameters<
3500        T: std::convert::Into<
3501                std::option::Option<
3502                    crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3503                >,
3504            >,
3505    >(
3506        mut self,
3507        v: T,
3508    ) -> Self {
3509        self.approval_parameters = v.into();
3510        self
3511    }
3512
3513    /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3514    /// if it holds a `QuorumParameters`, `None` if the field is not set or
3515    /// holds a different branch.
3516    pub fn quorum_parameters(
3517        &self,
3518    ) -> std::option::Option<
3519        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3520    > {
3521        #[allow(unreachable_patterns)]
3522        self.approval_parameters.as_ref().and_then(|v| match v {
3523            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3524            _ => std::option::Option::None,
3525        })
3526    }
3527
3528    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3529    /// to hold a `QuorumParameters`.
3530    ///
3531    /// Note that all the setters affecting `approval_parameters` are
3532    /// mutually exclusive.
3533    ///
3534    /// # Example
3535    /// ```ignore,no_run
3536    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3537    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3538    /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3539    /// assert!(x.quorum_parameters().is_some());
3540    /// assert!(x.required_action_quorum_parameters().is_none());
3541    /// ```
3542    pub fn set_quorum_parameters<
3543        T: std::convert::Into<
3544                std::boxed::Box<
3545                    crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3546                >,
3547            >,
3548    >(
3549        mut self,
3550        v: T,
3551    ) -> Self {
3552        self.approval_parameters = std::option::Option::Some(
3553            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3554                v.into(),
3555            ),
3556        );
3557        self
3558    }
3559
3560    /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3561    /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3562    /// holds a different branch.
3563    pub fn required_action_quorum_parameters(
3564        &self,
3565    ) -> std::option::Option<
3566        &std::boxed::Box<
3567            crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3568        >,
3569    > {
3570        #[allow(unreachable_patterns)]
3571        self.approval_parameters.as_ref().and_then(|v| match v {
3572            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3573            _ => std::option::Option::None,
3574        })
3575    }
3576
3577    /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3578    /// to hold a `RequiredActionQuorumParameters`.
3579    ///
3580    /// Note that all the setters affecting `approval_parameters` are
3581    /// mutually exclusive.
3582    ///
3583    /// # Example
3584    /// ```ignore,no_run
3585    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3586    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3587    /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3588    /// assert!(x.required_action_quorum_parameters().is_some());
3589    /// assert!(x.quorum_parameters().is_none());
3590    /// ```
3591    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{
3592        self.approval_parameters = std::option::Option::Some(
3593            crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3594                v.into()
3595            )
3596        );
3597        self
3598    }
3599
3600    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3601    ///
3602    /// Note that all the setters affecting `expiration` are mutually
3603    /// exclusive.
3604    ///
3605    /// # Example
3606    /// ```ignore,no_run
3607    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3608    /// use wkt::Timestamp;
3609    /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3610    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3611    /// ```
3612    pub fn set_expiration<
3613        T: std::convert::Into<
3614                std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3615            >,
3616    >(
3617        mut self,
3618        v: T,
3619    ) -> Self {
3620        self.expiration = v.into();
3621        self
3622    }
3623
3624    /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3625    /// if it holds a `ExpireTime`, `None` if the field is not set or
3626    /// holds a different branch.
3627    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3628        #[allow(unreachable_patterns)]
3629        self.expiration.as_ref().and_then(|v| match v {
3630            crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3631                std::option::Option::Some(v)
3632            }
3633            _ => std::option::Option::None,
3634        })
3635    }
3636
3637    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3638    /// to hold a `ExpireTime`.
3639    ///
3640    /// Note that all the setters affecting `expiration` are
3641    /// mutually exclusive.
3642    ///
3643    /// # Example
3644    /// ```ignore,no_run
3645    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3646    /// use wkt::Timestamp;
3647    /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3648    /// assert!(x.expire_time().is_some());
3649    /// assert!(x.ttl().is_none());
3650    /// ```
3651    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3652        mut self,
3653        v: T,
3654    ) -> Self {
3655        self.expiration = std::option::Option::Some(
3656            crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3657        );
3658        self
3659    }
3660
3661    /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3662    /// if it holds a `Ttl`, `None` if the field is not set or
3663    /// holds a different branch.
3664    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3665        #[allow(unreachable_patterns)]
3666        self.expiration.as_ref().and_then(|v| match v {
3667            crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3668                std::option::Option::Some(v)
3669            }
3670            _ => std::option::Option::None,
3671        })
3672    }
3673
3674    /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3675    /// to hold a `Ttl`.
3676    ///
3677    /// Note that all the setters affecting `expiration` are
3678    /// mutually exclusive.
3679    ///
3680    /// # Example
3681    /// ```ignore,no_run
3682    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3683    /// use wkt::Duration;
3684    /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3685    /// assert!(x.ttl().is_some());
3686    /// assert!(x.expire_time().is_none());
3687    /// ```
3688    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3689        self.expiration = std::option::Option::Some(
3690            crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3691        );
3692        self
3693    }
3694
3695    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3696    ///
3697    /// Note that all the setters affecting `operation` are mutually
3698    /// exclusive.
3699    ///
3700    /// # Example
3701    /// ```ignore,no_run
3702    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3703    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3704    /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3705    ///     google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3706    /// ```
3707    pub fn set_operation<
3708        T: std::convert::Into<
3709                std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3710            >,
3711    >(
3712        mut self,
3713        v: T,
3714    ) -> Self {
3715        self.operation = v.into();
3716        self
3717    }
3718
3719    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3720    /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3721    /// holds a different branch.
3722    pub fn register_two_factor_auth_keys(
3723        &self,
3724    ) -> std::option::Option<
3725        &std::boxed::Box<
3726            crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3727        >,
3728    > {
3729        #[allow(unreachable_patterns)]
3730        self.operation.as_ref().and_then(|v| match v {
3731            crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3732            _ => std::option::Option::None,
3733        })
3734    }
3735
3736    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3737    /// to hold a `RegisterTwoFactorAuthKeys`.
3738    ///
3739    /// Note that all the setters affecting `operation` are
3740    /// mutually exclusive.
3741    ///
3742    /// # Example
3743    /// ```ignore,no_run
3744    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3745    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3746    /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3747    /// assert!(x.register_two_factor_auth_keys().is_some());
3748    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3749    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3750    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3751    /// assert!(x.add_quorum_member().is_none());
3752    /// assert!(x.remove_quorum_member().is_none());
3753    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3754    /// ```
3755    pub fn set_register_two_factor_auth_keys<
3756        T: std::convert::Into<
3757                std::boxed::Box<
3758                    crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3759                >,
3760            >,
3761    >(
3762        mut self,
3763        v: T,
3764    ) -> Self {
3765        self.operation = std::option::Option::Some(
3766            crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3767                v.into(),
3768            ),
3769        );
3770        self
3771    }
3772
3773    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3774    /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3775    /// holds a different branch.
3776    pub fn disable_single_tenant_hsm_instance(
3777        &self,
3778    ) -> std::option::Option<
3779        &std::boxed::Box<
3780            crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3781        >,
3782    > {
3783        #[allow(unreachable_patterns)]
3784        self.operation.as_ref().and_then(|v| match v {
3785            crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3786            _ => std::option::Option::None,
3787        })
3788    }
3789
3790    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3791    /// to hold a `DisableSingleTenantHsmInstance`.
3792    ///
3793    /// Note that all the setters affecting `operation` are
3794    /// mutually exclusive.
3795    ///
3796    /// # Example
3797    /// ```ignore,no_run
3798    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3799    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3800    /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3801    /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3802    /// assert!(x.register_two_factor_auth_keys().is_none());
3803    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3804    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3805    /// assert!(x.add_quorum_member().is_none());
3806    /// assert!(x.remove_quorum_member().is_none());
3807    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3808    /// ```
3809    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{
3810        self.operation = std::option::Option::Some(
3811            crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3812                v.into()
3813            )
3814        );
3815        self
3816    }
3817
3818    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3819    /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3820    /// holds a different branch.
3821    pub fn enable_single_tenant_hsm_instance(
3822        &self,
3823    ) -> std::option::Option<
3824        &std::boxed::Box<
3825            crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3826        >,
3827    > {
3828        #[allow(unreachable_patterns)]
3829        self.operation.as_ref().and_then(|v| match v {
3830            crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3831            _ => std::option::Option::None,
3832        })
3833    }
3834
3835    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3836    /// to hold a `EnableSingleTenantHsmInstance`.
3837    ///
3838    /// Note that all the setters affecting `operation` are
3839    /// mutually exclusive.
3840    ///
3841    /// # Example
3842    /// ```ignore,no_run
3843    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3844    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3845    /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3846    /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3847    /// assert!(x.register_two_factor_auth_keys().is_none());
3848    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3849    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3850    /// assert!(x.add_quorum_member().is_none());
3851    /// assert!(x.remove_quorum_member().is_none());
3852    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3853    /// ```
3854    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{
3855        self.operation = std::option::Option::Some(
3856            crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3857                v.into()
3858            )
3859        );
3860        self
3861    }
3862
3863    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3864    /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3865    /// holds a different branch.
3866    pub fn delete_single_tenant_hsm_instance(
3867        &self,
3868    ) -> std::option::Option<
3869        &std::boxed::Box<
3870            crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3871        >,
3872    > {
3873        #[allow(unreachable_patterns)]
3874        self.operation.as_ref().and_then(|v| match v {
3875            crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3876            _ => std::option::Option::None,
3877        })
3878    }
3879
3880    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3881    /// to hold a `DeleteSingleTenantHsmInstance`.
3882    ///
3883    /// Note that all the setters affecting `operation` are
3884    /// mutually exclusive.
3885    ///
3886    /// # Example
3887    /// ```ignore,no_run
3888    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3889    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3890    /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3891    /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3892    /// assert!(x.register_two_factor_auth_keys().is_none());
3893    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3894    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3895    /// assert!(x.add_quorum_member().is_none());
3896    /// assert!(x.remove_quorum_member().is_none());
3897    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3898    /// ```
3899    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{
3900        self.operation = std::option::Option::Some(
3901            crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3902                v.into()
3903            )
3904        );
3905        self
3906    }
3907
3908    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3909    /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3910    /// holds a different branch.
3911    pub fn add_quorum_member(
3912        &self,
3913    ) -> std::option::Option<
3914        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3915    > {
3916        #[allow(unreachable_patterns)]
3917        self.operation.as_ref().and_then(|v| match v {
3918            crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3919                std::option::Option::Some(v)
3920            }
3921            _ => std::option::Option::None,
3922        })
3923    }
3924
3925    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3926    /// to hold a `AddQuorumMember`.
3927    ///
3928    /// Note that all the setters affecting `operation` are
3929    /// mutually exclusive.
3930    ///
3931    /// # Example
3932    /// ```ignore,no_run
3933    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3934    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3935    /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3936    /// assert!(x.add_quorum_member().is_some());
3937    /// assert!(x.register_two_factor_auth_keys().is_none());
3938    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3939    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3940    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3941    /// assert!(x.remove_quorum_member().is_none());
3942    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3943    /// ```
3944    pub fn set_add_quorum_member<
3945        T: std::convert::Into<
3946                std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3947            >,
3948    >(
3949        mut self,
3950        v: T,
3951    ) -> Self {
3952        self.operation = std::option::Option::Some(
3953            crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3954        );
3955        self
3956    }
3957
3958    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3959    /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3960    /// holds a different branch.
3961    pub fn remove_quorum_member(
3962        &self,
3963    ) -> std::option::Option<
3964        &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3965    > {
3966        #[allow(unreachable_patterns)]
3967        self.operation.as_ref().and_then(|v| match v {
3968            crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3969                std::option::Option::Some(v)
3970            }
3971            _ => std::option::Option::None,
3972        })
3973    }
3974
3975    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3976    /// to hold a `RemoveQuorumMember`.
3977    ///
3978    /// Note that all the setters affecting `operation` are
3979    /// mutually exclusive.
3980    ///
3981    /// # Example
3982    /// ```ignore,no_run
3983    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3984    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
3985    /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3986    /// assert!(x.remove_quorum_member().is_some());
3987    /// assert!(x.register_two_factor_auth_keys().is_none());
3988    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3989    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3990    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3991    /// assert!(x.add_quorum_member().is_none());
3992    /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3993    /// ```
3994    pub fn set_remove_quorum_member<
3995        T: std::convert::Into<
3996                std::boxed::Box<
3997                    crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
3998                >,
3999            >,
4000    >(
4001        mut self,
4002        v: T,
4003    ) -> Self {
4004        self.operation = std::option::Option::Some(
4005            crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
4006                v.into(),
4007            ),
4008        );
4009        self
4010    }
4011
4012    /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4013    /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
4014    /// holds a different branch.
4015    pub fn refresh_single_tenant_hsm_instance(
4016        &self,
4017    ) -> std::option::Option<
4018        &std::boxed::Box<
4019            crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4020        >,
4021    > {
4022        #[allow(unreachable_patterns)]
4023        self.operation.as_ref().and_then(|v| match v {
4024            crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
4025            _ => std::option::Option::None,
4026        })
4027    }
4028
4029    /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4030    /// to hold a `RefreshSingleTenantHsmInstance`.
4031    ///
4032    /// Note that all the setters affecting `operation` are
4033    /// mutually exclusive.
4034    ///
4035    /// # Example
4036    /// ```ignore,no_run
4037    /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
4038    /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
4039    /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
4040    /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
4041    /// assert!(x.register_two_factor_auth_keys().is_none());
4042    /// assert!(x.disable_single_tenant_hsm_instance().is_none());
4043    /// assert!(x.enable_single_tenant_hsm_instance().is_none());
4044    /// assert!(x.delete_single_tenant_hsm_instance().is_none());
4045    /// assert!(x.add_quorum_member().is_none());
4046    /// assert!(x.remove_quorum_member().is_none());
4047    /// ```
4048    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{
4049        self.operation = std::option::Option::Some(
4050            crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
4051                v.into()
4052            )
4053        );
4054        self
4055    }
4056}
4057
4058impl wkt::message::Message for SingleTenantHsmInstanceProposal {
4059    fn typename() -> &'static str {
4060        "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
4061    }
4062}
4063
4064/// Defines additional types related to [SingleTenantHsmInstanceProposal].
4065pub mod single_tenant_hsm_instance_proposal {
4066    #[allow(unused_imports)]
4067    use super::*;
4068
4069    /// Parameters of quorum approval for the
4070    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4071    ///
4072    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4073    #[derive(Clone, Default, PartialEq)]
4074    #[non_exhaustive]
4075    pub struct QuorumParameters {
4076        /// Output only. The required numbers of approvers. This is the M value used
4077        /// for M of N quorum auth. It is less than the number of public keys.
4078        pub required_approver_count: i32,
4079
4080        /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4081        /// of N of these challenges are required to be signed to approve the
4082        /// operation.
4083        pub challenges: std::vec::Vec<crate::model::Challenge>,
4084
4085        /// Output only. The public keys associated with the 2FA keys that have
4086        /// already approved the
4087        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4088        /// by signing the challenge.
4089        ///
4090        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4091        pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4092
4093        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4094    }
4095
4096    impl QuorumParameters {
4097        /// Creates a new default instance.
4098        pub fn new() -> Self {
4099            std::default::Default::default()
4100        }
4101
4102        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
4103        ///
4104        /// # Example
4105        /// ```ignore,no_run
4106        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4107        /// let x = QuorumParameters::new().set_required_approver_count(42);
4108        /// ```
4109        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4110            self.required_approver_count = v.into();
4111            self
4112        }
4113
4114        /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
4115        ///
4116        /// # Example
4117        /// ```ignore,no_run
4118        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4119        /// use google_cloud_kms_v1::model::Challenge;
4120        /// let x = QuorumParameters::new()
4121        ///     .set_challenges([
4122        ///         Challenge::default()/* use setters */,
4123        ///         Challenge::default()/* use (different) setters */,
4124        ///     ]);
4125        /// ```
4126        pub fn set_challenges<T, V>(mut self, v: T) -> Self
4127        where
4128            T: std::iter::IntoIterator<Item = V>,
4129            V: std::convert::Into<crate::model::Challenge>,
4130        {
4131            use std::iter::Iterator;
4132            self.challenges = v.into_iter().map(|i| i.into()).collect();
4133            self
4134        }
4135
4136        /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
4137        ///
4138        /// # Example
4139        /// ```ignore,no_run
4140        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4141        /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4142        /// ```
4143        pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4144        where
4145            T: std::iter::IntoIterator<Item = V>,
4146            V: std::convert::Into<std::string::String>,
4147        {
4148            use std::iter::Iterator;
4149            self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4150            self
4151        }
4152    }
4153
4154    impl wkt::message::Message for QuorumParameters {
4155        fn typename() -> &'static str {
4156            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
4157        }
4158    }
4159
4160    /// Parameters for an approval that has both required challenges and a
4161    /// quorum.
4162    #[derive(Clone, Default, PartialEq)]
4163    #[non_exhaustive]
4164    pub struct RequiredActionQuorumParameters {
4165        /// Output only. A list of specific challenges that must be signed.
4166        /// For some operations, this will contain a single challenge.
4167        pub required_challenges: std::vec::Vec<crate::model::Challenge>,
4168
4169        /// Output only. The required number of quorum approvers. This is the M value
4170        /// used for M of N quorum auth. It is less than the number of public keys.
4171        pub required_approver_count: i32,
4172
4173        /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4174        /// of N of these challenges are required to be signed to approve the
4175        /// operation.
4176        pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
4177
4178        /// Output only. The public keys associated with the 2FA keys that have
4179        /// already approved the
4180        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4181        /// by signing the challenge.
4182        ///
4183        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4184        pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4185
4186        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4187    }
4188
4189    impl RequiredActionQuorumParameters {
4190        /// Creates a new default instance.
4191        pub fn new() -> Self {
4192            std::default::Default::default()
4193        }
4194
4195        /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
4196        ///
4197        /// # Example
4198        /// ```ignore,no_run
4199        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4200        /// use google_cloud_kms_v1::model::Challenge;
4201        /// let x = RequiredActionQuorumParameters::new()
4202        ///     .set_required_challenges([
4203        ///         Challenge::default()/* use setters */,
4204        ///         Challenge::default()/* use (different) setters */,
4205        ///     ]);
4206        /// ```
4207        pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
4208        where
4209            T: std::iter::IntoIterator<Item = V>,
4210            V: std::convert::Into<crate::model::Challenge>,
4211        {
4212            use std::iter::Iterator;
4213            self.required_challenges = v.into_iter().map(|i| i.into()).collect();
4214            self
4215        }
4216
4217        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
4218        ///
4219        /// # Example
4220        /// ```ignore,no_run
4221        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4222        /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
4223        /// ```
4224        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4225            self.required_approver_count = v.into();
4226            self
4227        }
4228
4229        /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
4230        ///
4231        /// # Example
4232        /// ```ignore,no_run
4233        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4234        /// use google_cloud_kms_v1::model::Challenge;
4235        /// let x = RequiredActionQuorumParameters::new()
4236        ///     .set_quorum_challenges([
4237        ///         Challenge::default()/* use setters */,
4238        ///         Challenge::default()/* use (different) setters */,
4239        ///     ]);
4240        /// ```
4241        pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
4242        where
4243            T: std::iter::IntoIterator<Item = V>,
4244            V: std::convert::Into<crate::model::Challenge>,
4245        {
4246            use std::iter::Iterator;
4247            self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
4248            self
4249        }
4250
4251        /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
4252        ///
4253        /// # Example
4254        /// ```ignore,no_run
4255        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4256        /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4257        /// ```
4258        pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4259        where
4260            T: std::iter::IntoIterator<Item = V>,
4261            V: std::convert::Into<std::string::String>,
4262        {
4263            use std::iter::Iterator;
4264            self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4265            self
4266        }
4267    }
4268
4269    impl wkt::message::Message for RequiredActionQuorumParameters {
4270        fn typename() -> &'static str {
4271            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
4272        }
4273    }
4274
4275    /// Register 2FA keys for the
4276    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4277    /// This operation requires all Challenges to be signed by 2FA keys. The
4278    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4279    /// be in the
4280    /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4281    /// state to perform this operation.
4282    ///
4283    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4284    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4285    #[derive(Clone, Default, PartialEq)]
4286    #[non_exhaustive]
4287    pub struct RegisterTwoFactorAuthKeys {
4288        /// Required. The required numbers of approvers to set for the
4289        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4290        /// This is the M value used for M of N quorum auth. Must be greater than or
4291        /// equal to 2 and less than or equal to
4292        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4293        ///
4294        ///
4295        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4296        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4297        pub required_approver_count: i32,
4298
4299        /// Required. The public keys associated with the 2FA keys for M of N quorum
4300        /// auth. Public keys must be associated with RSA 2048 keys.
4301        pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4302
4303        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4304    }
4305
4306    impl RegisterTwoFactorAuthKeys {
4307        /// Creates a new default instance.
4308        pub fn new() -> Self {
4309            std::default::Default::default()
4310        }
4311
4312        /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4313        ///
4314        /// # Example
4315        /// ```ignore,no_run
4316        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4317        /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4318        /// ```
4319        pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4320            self.required_approver_count = v.into();
4321            self
4322        }
4323
4324        /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4325        ///
4326        /// # Example
4327        /// ```ignore,no_run
4328        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4329        /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4330        /// ```
4331        pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4332        where
4333            T: std::iter::IntoIterator<Item = V>,
4334            V: std::convert::Into<std::string::String>,
4335        {
4336            use std::iter::Iterator;
4337            self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4338            self
4339        }
4340    }
4341
4342    impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4343        fn typename() -> &'static str {
4344            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4345        }
4346    }
4347
4348    /// Disable the
4349    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4350    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4351    /// be in the
4352    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4353    /// perform this operation.
4354    ///
4355    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4356    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4357    #[derive(Clone, Default, PartialEq)]
4358    #[non_exhaustive]
4359    pub struct DisableSingleTenantHsmInstance {
4360        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4361    }
4362
4363    impl DisableSingleTenantHsmInstance {
4364        /// Creates a new default instance.
4365        pub fn new() -> Self {
4366            std::default::Default::default()
4367        }
4368    }
4369
4370    impl wkt::message::Message for DisableSingleTenantHsmInstance {
4371        fn typename() -> &'static str {
4372            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4373        }
4374    }
4375
4376    /// Enable the
4377    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4378    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4379    /// be in the
4380    /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4381    /// state to perform this operation.
4382    ///
4383    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4384    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4385    #[derive(Clone, Default, PartialEq)]
4386    #[non_exhaustive]
4387    pub struct EnableSingleTenantHsmInstance {
4388        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4389    }
4390
4391    impl EnableSingleTenantHsmInstance {
4392        /// Creates a new default instance.
4393        pub fn new() -> Self {
4394            std::default::Default::default()
4395        }
4396    }
4397
4398    impl wkt::message::Message for EnableSingleTenantHsmInstance {
4399        fn typename() -> &'static str {
4400            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4401        }
4402    }
4403
4404    /// Delete the
4405    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4406    /// Deleting a
4407    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4408    /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4409    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4410    /// unusable. The
4411    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4412    /// not be in the
4413    /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4414    /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4415    /// to perform this operation.
4416    ///
4417    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4418    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4419    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4420    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4421    #[derive(Clone, Default, PartialEq)]
4422    #[non_exhaustive]
4423    pub struct DeleteSingleTenantHsmInstance {
4424        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4425    }
4426
4427    impl DeleteSingleTenantHsmInstance {
4428        /// Creates a new default instance.
4429        pub fn new() -> Self {
4430            std::default::Default::default()
4431        }
4432    }
4433
4434    impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4435        fn typename() -> &'static str {
4436            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4437        }
4438    }
4439
4440    /// Add a quorum member to the
4441    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4442    /// This will increase the
4443    /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4444    /// by 1. The
4445    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4446    /// be in the
4447    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4448    /// perform this operation.
4449    ///
4450    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4451    /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4452    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4453    #[derive(Clone, Default, PartialEq)]
4454    #[non_exhaustive]
4455    pub struct AddQuorumMember {
4456        /// Required. The public key associated with the 2FA key for the new quorum
4457        /// member to add. Public keys must be associated with RSA 2048 keys.
4458        pub two_factor_public_key_pem: std::string::String,
4459
4460        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4461    }
4462
4463    impl AddQuorumMember {
4464        /// Creates a new default instance.
4465        pub fn new() -> Self {
4466            std::default::Default::default()
4467        }
4468
4469        /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4470        ///
4471        /// # Example
4472        /// ```ignore,no_run
4473        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4474        /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4475        /// ```
4476        pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4477            mut self,
4478            v: T,
4479        ) -> Self {
4480            self.two_factor_public_key_pem = v.into();
4481            self
4482        }
4483    }
4484
4485    impl wkt::message::Message for AddQuorumMember {
4486        fn typename() -> &'static str {
4487            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4488        }
4489    }
4490
4491    /// Remove a quorum member from the
4492    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4493    /// This will reduce
4494    /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4495    /// by 1. The
4496    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4497    /// be in the
4498    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4499    /// perform this operation.
4500    ///
4501    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4502    /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4503    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4504    #[derive(Clone, Default, PartialEq)]
4505    #[non_exhaustive]
4506    pub struct RemoveQuorumMember {
4507        /// Required. The public key associated with the 2FA key for the quorum
4508        /// member to remove. Public keys must be associated with RSA 2048 keys.
4509        pub two_factor_public_key_pem: std::string::String,
4510
4511        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4512    }
4513
4514    impl RemoveQuorumMember {
4515        /// Creates a new default instance.
4516        pub fn new() -> Self {
4517            std::default::Default::default()
4518        }
4519
4520        /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4521        ///
4522        /// # Example
4523        /// ```ignore,no_run
4524        /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4525        /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4526        /// ```
4527        pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4528            mut self,
4529            v: T,
4530        ) -> Self {
4531            self.two_factor_public_key_pem = v.into();
4532            self
4533        }
4534    }
4535
4536    impl wkt::message::Message for RemoveQuorumMember {
4537        fn typename() -> &'static str {
4538            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4539        }
4540    }
4541
4542    /// Refreshes the
4543    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4544    /// This operation must be performed periodically to keep the
4545    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4546    /// active. This operation must be performed before
4547    /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4548    /// has passed. The
4549    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4550    /// be in the
4551    /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4552    /// perform this operation.
4553    ///
4554    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4555    /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4556    /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4557    #[derive(Clone, Default, PartialEq)]
4558    #[non_exhaustive]
4559    pub struct RefreshSingleTenantHsmInstance {
4560        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4561    }
4562
4563    impl RefreshSingleTenantHsmInstance {
4564        /// Creates a new default instance.
4565        pub fn new() -> Self {
4566            std::default::Default::default()
4567        }
4568    }
4569
4570    impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4571        fn typename() -> &'static str {
4572            "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4573        }
4574    }
4575
4576    /// The set of states of a
4577    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4578    ///
4579    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4580    ///
4581    /// # Working with unknown values
4582    ///
4583    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4584    /// additional enum variants at any time. Adding new variants is not considered
4585    /// a breaking change. Applications should write their code in anticipation of:
4586    ///
4587    /// - New values appearing in future releases of the client library, **and**
4588    /// - New values received dynamically, without application changes.
4589    ///
4590    /// Please consult the [Working with enums] section in the user guide for some
4591    /// guidelines.
4592    ///
4593    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4594    #[derive(Clone, Debug, PartialEq)]
4595    #[non_exhaustive]
4596    pub enum State {
4597        /// Not specified.
4598        Unspecified,
4599        /// The
4600        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4601        /// is being created.
4602        ///
4603        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4604        Creating,
4605        /// The
4606        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4607        /// is pending approval.
4608        ///
4609        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4610        Pending,
4611        /// The
4612        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4613        /// has been approved.
4614        ///
4615        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4616        Approved,
4617        /// The
4618        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4619        /// is being executed.
4620        ///
4621        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4622        Running,
4623        /// The
4624        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4625        /// has been executed successfully.
4626        ///
4627        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4628        Succeeded,
4629        /// The
4630        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4631        /// has failed.
4632        ///
4633        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4634        Failed,
4635        /// The
4636        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4637        /// has been deleted and will be purged after the purge_time.
4638        ///
4639        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4640        Deleted,
4641        /// If set, the enum was initialized with an unknown value.
4642        ///
4643        /// Applications can examine the value using [State::value] or
4644        /// [State::name].
4645        UnknownValue(state::UnknownValue),
4646    }
4647
4648    #[doc(hidden)]
4649    pub mod state {
4650        #[allow(unused_imports)]
4651        use super::*;
4652        #[derive(Clone, Debug, PartialEq)]
4653        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4654    }
4655
4656    impl State {
4657        /// Gets the enum value.
4658        ///
4659        /// Returns `None` if the enum contains an unknown value deserialized from
4660        /// the string representation of enums.
4661        pub fn value(&self) -> std::option::Option<i32> {
4662            match self {
4663                Self::Unspecified => std::option::Option::Some(0),
4664                Self::Creating => std::option::Option::Some(1),
4665                Self::Pending => std::option::Option::Some(2),
4666                Self::Approved => std::option::Option::Some(3),
4667                Self::Running => std::option::Option::Some(4),
4668                Self::Succeeded => std::option::Option::Some(5),
4669                Self::Failed => std::option::Option::Some(6),
4670                Self::Deleted => std::option::Option::Some(7),
4671                Self::UnknownValue(u) => u.0.value(),
4672            }
4673        }
4674
4675        /// Gets the enum value as a string.
4676        ///
4677        /// Returns `None` if the enum contains an unknown value deserialized from
4678        /// the integer representation of enums.
4679        pub fn name(&self) -> std::option::Option<&str> {
4680            match self {
4681                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4682                Self::Creating => std::option::Option::Some("CREATING"),
4683                Self::Pending => std::option::Option::Some("PENDING"),
4684                Self::Approved => std::option::Option::Some("APPROVED"),
4685                Self::Running => std::option::Option::Some("RUNNING"),
4686                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4687                Self::Failed => std::option::Option::Some("FAILED"),
4688                Self::Deleted => std::option::Option::Some("DELETED"),
4689                Self::UnknownValue(u) => u.0.name(),
4690            }
4691        }
4692    }
4693
4694    impl std::default::Default for State {
4695        fn default() -> Self {
4696            use std::convert::From;
4697            Self::from(0)
4698        }
4699    }
4700
4701    impl std::fmt::Display for State {
4702        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4703            wkt::internal::display_enum(f, self.name(), self.value())
4704        }
4705    }
4706
4707    impl std::convert::From<i32> for State {
4708        fn from(value: i32) -> Self {
4709            match value {
4710                0 => Self::Unspecified,
4711                1 => Self::Creating,
4712                2 => Self::Pending,
4713                3 => Self::Approved,
4714                4 => Self::Running,
4715                5 => Self::Succeeded,
4716                6 => Self::Failed,
4717                7 => Self::Deleted,
4718                _ => Self::UnknownValue(state::UnknownValue(
4719                    wkt::internal::UnknownEnumValue::Integer(value),
4720                )),
4721            }
4722        }
4723    }
4724
4725    impl std::convert::From<&str> for State {
4726        fn from(value: &str) -> Self {
4727            use std::string::ToString;
4728            match value {
4729                "STATE_UNSPECIFIED" => Self::Unspecified,
4730                "CREATING" => Self::Creating,
4731                "PENDING" => Self::Pending,
4732                "APPROVED" => Self::Approved,
4733                "RUNNING" => Self::Running,
4734                "SUCCEEDED" => Self::Succeeded,
4735                "FAILED" => Self::Failed,
4736                "DELETED" => Self::Deleted,
4737                _ => Self::UnknownValue(state::UnknownValue(
4738                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4739                )),
4740            }
4741        }
4742    }
4743
4744    impl serde::ser::Serialize for State {
4745        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4746        where
4747            S: serde::Serializer,
4748        {
4749            match self {
4750                Self::Unspecified => serializer.serialize_i32(0),
4751                Self::Creating => serializer.serialize_i32(1),
4752                Self::Pending => serializer.serialize_i32(2),
4753                Self::Approved => serializer.serialize_i32(3),
4754                Self::Running => serializer.serialize_i32(4),
4755                Self::Succeeded => serializer.serialize_i32(5),
4756                Self::Failed => serializer.serialize_i32(6),
4757                Self::Deleted => serializer.serialize_i32(7),
4758                Self::UnknownValue(u) => u.0.serialize(serializer),
4759            }
4760        }
4761    }
4762
4763    impl<'de> serde::de::Deserialize<'de> for State {
4764        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4765        where
4766            D: serde::Deserializer<'de>,
4767        {
4768            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4769                ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4770            ))
4771        }
4772    }
4773
4774    /// The approval parameters for the
4775    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4776    /// The type of parameters is determined by the operation being proposed.
4777    ///
4778    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4779    #[derive(Clone, Debug, PartialEq)]
4780    #[non_exhaustive]
4781    pub enum ApprovalParameters {
4782        /// Output only. The quorum approval parameters for the
4783        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4784        ///
4785        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4786        QuorumParameters(
4787            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4788        ),
4789        /// Output only. Parameters for an approval of a
4790        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4791        /// that has both required challenges and a quorum.
4792        ///
4793        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4794        RequiredActionQuorumParameters(
4795            std::boxed::Box<
4796                crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4797            >,
4798        ),
4799    }
4800
4801    /// The expiration of the
4802    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4803    /// If not set, the
4804    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4805    /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4806    /// time is 5 minutes.
4807    ///
4808    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4809    #[derive(Clone, Debug, PartialEq)]
4810    #[non_exhaustive]
4811    pub enum Expiration {
4812        /// The time at which the
4813        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4814        /// will expire if not approved and executed.
4815        ///
4816        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4817        ExpireTime(std::boxed::Box<wkt::Timestamp>),
4818        /// Input only. The TTL for the
4819        /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4820        /// Proposals will expire after this duration.
4821        ///
4822        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4823        Ttl(std::boxed::Box<wkt::Duration>),
4824    }
4825
4826    /// The operation to perform on the
4827    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4828    ///
4829    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4830    #[derive(Clone, Debug, PartialEq)]
4831    #[non_exhaustive]
4832    pub enum Operation {
4833        /// Register 2FA keys for the
4834        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4835        /// This operation requires all N Challenges to be signed by 2FA keys. The
4836        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4837        /// must be in the
4838        /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4839        /// state to perform this operation.
4840        ///
4841        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4842        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4843        RegisterTwoFactorAuthKeys(
4844            std::boxed::Box<
4845                crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4846            >,
4847        ),
4848        /// Disable the
4849        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4850        /// The
4851        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4852        /// must be in the
4853        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4854        /// to perform this operation.
4855        ///
4856        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4857        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4858        DisableSingleTenantHsmInstance(
4859            std::boxed::Box<
4860                crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4861            >,
4862        ),
4863        /// Enable the
4864        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4865        /// The
4866        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4867        /// must be in the
4868        /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4869        /// state to perform this operation.
4870        ///
4871        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4872        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4873        EnableSingleTenantHsmInstance(
4874            std::boxed::Box<
4875                crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4876            >,
4877        ),
4878        /// Delete the
4879        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4880        /// Deleting a
4881        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4882        /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4883        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4884        /// unusable. The
4885        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4886        /// must be in the
4887        /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
4888        /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4889        /// state to perform this operation.
4890        ///
4891        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4892        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4893        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4894        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4895        DeleteSingleTenantHsmInstance(
4896            std::boxed::Box<
4897                crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
4898            >,
4899        ),
4900        /// Add a quorum member to the
4901        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4902        /// This will increase the
4903        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4904        /// by 1. The
4905        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4906        /// must be in the
4907        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4908        /// to perform this operation.
4909        ///
4910        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4911        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4912        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4913        AddQuorumMember(
4914            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
4915        ),
4916        /// Remove a quorum member from the
4917        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4918        /// This will reduce
4919        /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4920        /// by 1. The
4921        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4922        /// must be in the
4923        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4924        /// to perform this operation.
4925        ///
4926        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4927        /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4928        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4929        RemoveQuorumMember(
4930            std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
4931        ),
4932        /// Refreshes the
4933        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4934        /// This operation must be performed periodically to keep the
4935        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4936        /// active. This operation must be performed before
4937        /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4938        /// has passed. The
4939        /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4940        /// must be in the
4941        /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4942        /// to perform this operation.
4943        ///
4944        /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4945        /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4946        /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4947        RefreshSingleTenantHsmInstance(
4948            std::boxed::Box<
4949                crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4950            >,
4951        ),
4952    }
4953}
4954
4955/// A challenge to be signed by a 2FA key.
4956#[derive(Clone, Default, PartialEq)]
4957#[non_exhaustive]
4958pub struct Challenge {
4959    /// Output only. The challenge to be signed by the 2FA key indicated by the
4960    /// public key.
4961    pub challenge: ::bytes::Bytes,
4962
4963    /// Output only. The public key associated with the 2FA key that should sign
4964    /// the challenge.
4965    pub public_key_pem: std::string::String,
4966
4967    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4968}
4969
4970impl Challenge {
4971    /// Creates a new default instance.
4972    pub fn new() -> Self {
4973        std::default::Default::default()
4974    }
4975
4976    /// Sets the value of [challenge][crate::model::Challenge::challenge].
4977    ///
4978    /// # Example
4979    /// ```ignore,no_run
4980    /// # use google_cloud_kms_v1::model::Challenge;
4981    /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
4982    /// ```
4983    pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4984        self.challenge = v.into();
4985        self
4986    }
4987
4988    /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
4989    ///
4990    /// # Example
4991    /// ```ignore,no_run
4992    /// # use google_cloud_kms_v1::model::Challenge;
4993    /// let x = Challenge::new().set_public_key_pem("example");
4994    /// ```
4995    pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4996        self.public_key_pem = v.into();
4997        self
4998    }
4999}
5000
5001impl wkt::message::Message for Challenge {
5002    fn typename() -> &'static str {
5003        "type.googleapis.com/google.cloud.kms.v1.Challenge"
5004    }
5005}
5006
5007/// A reply to a challenge signed by a 2FA key.
5008#[derive(Clone, Default, PartialEq)]
5009#[non_exhaustive]
5010pub struct ChallengeReply {
5011    /// Required. The signed challenge associated with the 2FA key.
5012    /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
5013    pub signed_challenge: ::bytes::Bytes,
5014
5015    /// Required. The public key associated with the 2FA key.
5016    pub public_key_pem: std::string::String,
5017
5018    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5019}
5020
5021impl ChallengeReply {
5022    /// Creates a new default instance.
5023    pub fn new() -> Self {
5024        std::default::Default::default()
5025    }
5026
5027    /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
5028    ///
5029    /// # Example
5030    /// ```ignore,no_run
5031    /// # use google_cloud_kms_v1::model::ChallengeReply;
5032    /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
5033    /// ```
5034    pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5035        self.signed_challenge = v.into();
5036        self
5037    }
5038
5039    /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
5040    ///
5041    /// # Example
5042    /// ```ignore,no_run
5043    /// # use google_cloud_kms_v1::model::ChallengeReply;
5044    /// let x = ChallengeReply::new().set_public_key_pem("example");
5045    /// ```
5046    pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5047        self.public_key_pem = v.into();
5048        self
5049    }
5050}
5051
5052impl wkt::message::Message for ChallengeReply {
5053    fn typename() -> &'static str {
5054        "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
5055    }
5056}
5057
5058/// Request message for
5059/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5060///
5061/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5062#[derive(Clone, Default, PartialEq)]
5063#[non_exhaustive]
5064pub struct ListSingleTenantHsmInstancesRequest {
5065    /// Required. The resource name of the location associated with the
5066    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5067    /// list, in the format `projects/*/locations/*`.
5068    ///
5069    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5070    pub parent: std::string::String,
5071
5072    /// Optional. Optional limit on the number of
5073    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5074    /// include in the response. Further
5075    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
5076    /// subsequently be
5077    /// obtained by including the
5078    /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
5079    /// in a subsequent request. If unspecified, the server will pick an
5080    /// appropriate default.
5081    ///
5082    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5083    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5084    pub page_size: i32,
5085
5086    /// Optional. Optional pagination token, returned earlier via
5087    /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
5088    ///
5089    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5090    pub page_token: std::string::String,
5091
5092    /// Optional. Only include resources that match the filter in the response. For
5093    /// more information, see
5094    /// [Sorting and filtering list
5095    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5096    pub filter: std::string::String,
5097
5098    /// Optional. Specify how the results should be sorted. If not specified, the
5099    /// results will be sorted in the default order.  For more information, see
5100    /// [Sorting and filtering list
5101    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5102    pub order_by: std::string::String,
5103
5104    /// Optional. If set to true,
5105    /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
5106    /// will also return
5107    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
5108    /// DELETED state.
5109    ///
5110    /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5111    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5112    pub show_deleted: bool,
5113
5114    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5115}
5116
5117impl ListSingleTenantHsmInstancesRequest {
5118    /// Creates a new default instance.
5119    pub fn new() -> Self {
5120        std::default::Default::default()
5121    }
5122
5123    /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
5124    ///
5125    /// # Example
5126    /// ```ignore,no_run
5127    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5128    /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
5129    /// ```
5130    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5131        self.parent = v.into();
5132        self
5133    }
5134
5135    /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
5136    ///
5137    /// # Example
5138    /// ```ignore,no_run
5139    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5140    /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
5141    /// ```
5142    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5143        self.page_size = v.into();
5144        self
5145    }
5146
5147    /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
5148    ///
5149    /// # Example
5150    /// ```ignore,no_run
5151    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5152    /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
5153    /// ```
5154    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5155        self.page_token = v.into();
5156        self
5157    }
5158
5159    /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
5160    ///
5161    /// # Example
5162    /// ```ignore,no_run
5163    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5164    /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
5165    /// ```
5166    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5167        self.filter = v.into();
5168        self
5169    }
5170
5171    /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
5172    ///
5173    /// # Example
5174    /// ```ignore,no_run
5175    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5176    /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
5177    /// ```
5178    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5179        self.order_by = v.into();
5180        self
5181    }
5182
5183    /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
5184    ///
5185    /// # Example
5186    /// ```ignore,no_run
5187    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5188    /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
5189    /// ```
5190    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5191        self.show_deleted = v.into();
5192        self
5193    }
5194}
5195
5196impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
5197    fn typename() -> &'static str {
5198        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
5199    }
5200}
5201
5202/// Response message for
5203/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5204///
5205/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5206#[derive(Clone, Default, PartialEq)]
5207#[non_exhaustive]
5208pub struct ListSingleTenantHsmInstancesResponse {
5209    /// The list of
5210    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
5211    ///
5212    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5213    pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
5214
5215    /// A token to retrieve next page of results. Pass this value in
5216    /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
5217    /// to retrieve the next page of results.
5218    ///
5219    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
5220    pub next_page_token: std::string::String,
5221
5222    /// The total number of
5223    /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
5224    /// that matched the query.
5225    ///
5226    /// This field is not populated if
5227    /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
5228    /// is applied.
5229    ///
5230    /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
5231    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5232    pub total_size: i32,
5233
5234    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5235}
5236
5237impl ListSingleTenantHsmInstancesResponse {
5238    /// Creates a new default instance.
5239    pub fn new() -> Self {
5240        std::default::Default::default()
5241    }
5242
5243    /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
5244    ///
5245    /// # Example
5246    /// ```ignore,no_run
5247    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5248    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5249    /// let x = ListSingleTenantHsmInstancesResponse::new()
5250    ///     .set_single_tenant_hsm_instances([
5251    ///         SingleTenantHsmInstance::default()/* use setters */,
5252    ///         SingleTenantHsmInstance::default()/* use (different) setters */,
5253    ///     ]);
5254    /// ```
5255    pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
5256    where
5257        T: std::iter::IntoIterator<Item = V>,
5258        V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5259    {
5260        use std::iter::Iterator;
5261        self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
5262        self
5263    }
5264
5265    /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
5266    ///
5267    /// # Example
5268    /// ```ignore,no_run
5269    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5270    /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
5271    /// ```
5272    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5273        self.next_page_token = v.into();
5274        self
5275    }
5276
5277    /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
5278    ///
5279    /// # Example
5280    /// ```ignore,no_run
5281    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5282    /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
5283    /// ```
5284    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5285        self.total_size = v.into();
5286        self
5287    }
5288}
5289
5290impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
5291    fn typename() -> &'static str {
5292        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
5293    }
5294}
5295
5296#[doc(hidden)]
5297impl google_cloud_gax::paginator::internal::PageableResponse
5298    for ListSingleTenantHsmInstancesResponse
5299{
5300    type PageItem = crate::model::SingleTenantHsmInstance;
5301
5302    fn items(self) -> std::vec::Vec<Self::PageItem> {
5303        self.single_tenant_hsm_instances
5304    }
5305
5306    fn next_page_token(&self) -> std::string::String {
5307        use std::clone::Clone;
5308        self.next_page_token.clone()
5309    }
5310}
5311
5312/// Request message for
5313/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5314///
5315/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5316#[derive(Clone, Default, PartialEq)]
5317#[non_exhaustive]
5318pub struct GetSingleTenantHsmInstanceRequest {
5319    /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5320    /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5321    /// to get.
5322    ///
5323    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5324    /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5325    pub name: std::string::String,
5326
5327    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5328}
5329
5330impl GetSingleTenantHsmInstanceRequest {
5331    /// Creates a new default instance.
5332    pub fn new() -> Self {
5333        std::default::Default::default()
5334    }
5335
5336    /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5337    ///
5338    /// # Example
5339    /// ```ignore,no_run
5340    /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5341    /// # let project_id = "project_id";
5342    /// # let location_id = "location_id";
5343    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5344    /// let x = GetSingleTenantHsmInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
5345    /// ```
5346    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5347        self.name = v.into();
5348        self
5349    }
5350}
5351
5352impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5353    fn typename() -> &'static str {
5354        "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5355    }
5356}
5357
5358/// Request message for
5359/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5360///
5361/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5362#[derive(Clone, Default, PartialEq)]
5363#[non_exhaustive]
5364pub struct CreateSingleTenantHsmInstanceRequest {
5365    /// Required. The resource name of the location associated with the
5366    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5367    /// the format `projects/*/locations/*`.
5368    ///
5369    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5370    pub parent: std::string::String,
5371
5372    /// Optional. It must be unique within a location and match the regular
5373    /// expression `[a-zA-Z0-9_-]{1,63}`.
5374    pub single_tenant_hsm_instance_id: std::string::String,
5375
5376    /// Required. An
5377    /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5378    /// initial field values.
5379    ///
5380    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5381    pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5382
5383    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5384}
5385
5386impl CreateSingleTenantHsmInstanceRequest {
5387    /// Creates a new default instance.
5388    pub fn new() -> Self {
5389        std::default::Default::default()
5390    }
5391
5392    /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5393    ///
5394    /// # Example
5395    /// ```ignore,no_run
5396    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5397    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5398    /// ```
5399    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5400        self.parent = v.into();
5401        self
5402    }
5403
5404    /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5405    ///
5406    /// # Example
5407    /// ```ignore,no_run
5408    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5409    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5410    /// ```
5411    pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5412        mut self,
5413        v: T,
5414    ) -> Self {
5415        self.single_tenant_hsm_instance_id = v.into();
5416        self
5417    }
5418
5419    /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5420    ///
5421    /// # Example
5422    /// ```ignore,no_run
5423    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5424    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5425    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5426    /// ```
5427    pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5428    where
5429        T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5430    {
5431        self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5432        self
5433    }
5434
5435    /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5436    ///
5437    /// # Example
5438    /// ```ignore,no_run
5439    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5440    /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5441    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5442    /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5443    /// ```
5444    pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5445    where
5446        T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5447    {
5448        self.single_tenant_hsm_instance = v.map(|x| x.into());
5449        self
5450    }
5451}
5452
5453impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5454    fn typename() -> &'static str {
5455        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5456    }
5457}
5458
5459/// Metadata message for
5460/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5461/// long-running operation response.
5462///
5463/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5464#[derive(Clone, Default, PartialEq)]
5465#[non_exhaustive]
5466pub struct CreateSingleTenantHsmInstanceMetadata {
5467    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5468}
5469
5470impl CreateSingleTenantHsmInstanceMetadata {
5471    /// Creates a new default instance.
5472    pub fn new() -> Self {
5473        std::default::Default::default()
5474    }
5475}
5476
5477impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5478    fn typename() -> &'static str {
5479        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5480    }
5481}
5482
5483/// Request message for
5484/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5485///
5486/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5487#[derive(Clone, Default, PartialEq)]
5488#[non_exhaustive]
5489pub struct CreateSingleTenantHsmInstanceProposalRequest {
5490    /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5491    /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5492    /// associated with the
5493    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5494    ///
5495    /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5496    /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5497    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5498    pub parent: std::string::String,
5499
5500    /// Optional. It must be unique within a location and match the regular
5501    /// expression `[a-zA-Z0-9_-]{1,63}`.
5502    pub single_tenant_hsm_instance_proposal_id: std::string::String,
5503
5504    /// Required. The
5505    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5506    /// to create.
5507    ///
5508    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5509    pub single_tenant_hsm_instance_proposal:
5510        std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5511
5512    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5513}
5514
5515impl CreateSingleTenantHsmInstanceProposalRequest {
5516    /// Creates a new default instance.
5517    pub fn new() -> Self {
5518        std::default::Default::default()
5519    }
5520
5521    /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5522    ///
5523    /// # Example
5524    /// ```ignore,no_run
5525    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5526    /// # let project_id = "project_id";
5527    /// # let location_id = "location_id";
5528    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5529    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
5530    /// ```
5531    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5532        self.parent = v.into();
5533        self
5534    }
5535
5536    /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5537    ///
5538    /// # Example
5539    /// ```ignore,no_run
5540    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5541    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5542    /// ```
5543    pub fn set_single_tenant_hsm_instance_proposal_id<
5544        T: std::convert::Into<std::string::String>,
5545    >(
5546        mut self,
5547        v: T,
5548    ) -> Self {
5549        self.single_tenant_hsm_instance_proposal_id = v.into();
5550        self
5551    }
5552
5553    /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5554    ///
5555    /// # Example
5556    /// ```ignore,no_run
5557    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5558    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5559    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5560    /// ```
5561    pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5562    where
5563        T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5564    {
5565        self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5566        self
5567    }
5568
5569    /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5570    ///
5571    /// # Example
5572    /// ```ignore,no_run
5573    /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5574    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5575    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5576    /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5577    /// ```
5578    pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5579        mut self,
5580        v: std::option::Option<T>,
5581    ) -> Self
5582    where
5583        T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5584    {
5585        self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5586        self
5587    }
5588}
5589
5590impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5591    fn typename() -> &'static str {
5592        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5593    }
5594}
5595
5596/// Metadata message for
5597/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5598/// long-running operation response.
5599///
5600/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5601#[derive(Clone, Default, PartialEq)]
5602#[non_exhaustive]
5603pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5604    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5605}
5606
5607impl CreateSingleTenantHsmInstanceProposalMetadata {
5608    /// Creates a new default instance.
5609    pub fn new() -> Self {
5610        std::default::Default::default()
5611    }
5612}
5613
5614impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5615    fn typename() -> &'static str {
5616        "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5617    }
5618}
5619
5620/// Request message for
5621/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5622///
5623/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5624#[derive(Clone, Default, PartialEq)]
5625#[non_exhaustive]
5626pub struct GetSingleTenantHsmInstanceProposalRequest {
5627    /// Required. The
5628    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5629    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5630    /// to get.
5631    ///
5632    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5633    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5634    pub name: std::string::String,
5635
5636    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5637}
5638
5639impl GetSingleTenantHsmInstanceProposalRequest {
5640    /// Creates a new default instance.
5641    pub fn new() -> Self {
5642        std::default::Default::default()
5643    }
5644
5645    /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5646    ///
5647    /// # Example
5648    /// ```ignore,no_run
5649    /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5650    /// # let project_id = "project_id";
5651    /// # let location_id = "location_id";
5652    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5653    /// # let proposal_id = "proposal_id";
5654    /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
5655    /// ```
5656    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5657        self.name = v.into();
5658        self
5659    }
5660}
5661
5662impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5663    fn typename() -> &'static str {
5664        "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5665    }
5666}
5667
5668/// Request message for
5669/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5670///
5671/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5672#[derive(Clone, Default, PartialEq)]
5673#[non_exhaustive]
5674pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5675    /// Required. The
5676    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5677    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5678    /// to approve.
5679    ///
5680    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5681    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5682    pub name: std::string::String,
5683
5684    /// The approval payload. The type of approval payload must correspond to the
5685    /// type of approval_parameters in the proposal.
5686    pub approval_payload: std::option::Option<
5687        crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5688    >,
5689
5690    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5691}
5692
5693impl ApproveSingleTenantHsmInstanceProposalRequest {
5694    /// Creates a new default instance.
5695    pub fn new() -> Self {
5696        std::default::Default::default()
5697    }
5698
5699    /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5700    ///
5701    /// # Example
5702    /// ```ignore,no_run
5703    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5704    /// # let project_id = "project_id";
5705    /// # let location_id = "location_id";
5706    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5707    /// # let proposal_id = "proposal_id";
5708    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
5709    /// ```
5710    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5711        self.name = v.into();
5712        self
5713    }
5714
5715    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5716    ///
5717    /// Note that all the setters affecting `approval_payload` are mutually
5718    /// exclusive.
5719    ///
5720    /// # Example
5721    /// ```ignore,no_run
5722    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5723    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5724    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5725    ///     google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5726    /// ```
5727    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
5728    {
5729        self.approval_payload = v.into();
5730        self
5731    }
5732
5733    /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5734    /// if it holds a `QuorumReply`, `None` if the field is not set or
5735    /// holds a different branch.
5736    pub fn quorum_reply(
5737        &self,
5738    ) -> std::option::Option<
5739        &std::boxed::Box<
5740            crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5741        >,
5742    > {
5743        #[allow(unreachable_patterns)]
5744        self.approval_payload.as_ref().and_then(|v| match v {
5745            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5746            _ => std::option::Option::None,
5747        })
5748    }
5749
5750    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5751    /// to hold a `QuorumReply`.
5752    ///
5753    /// Note that all the setters affecting `approval_payload` are
5754    /// mutually exclusive.
5755    ///
5756    /// # Example
5757    /// ```ignore,no_run
5758    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5759    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5760    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5761    /// assert!(x.quorum_reply().is_some());
5762    /// assert!(x.required_action_quorum_reply().is_none());
5763    /// ```
5764    pub fn set_quorum_reply<
5765        T: std::convert::Into<
5766                std::boxed::Box<
5767                    crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5768                >,
5769            >,
5770    >(
5771        mut self,
5772        v: T,
5773    ) -> Self {
5774        self.approval_payload = std::option::Option::Some(
5775            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5776                v.into()
5777            )
5778        );
5779        self
5780    }
5781
5782    /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5783    /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5784    /// holds a different branch.
5785    pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5786        #[allow(unreachable_patterns)]
5787        self.approval_payload.as_ref().and_then(|v| match v {
5788            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5789            _ => std::option::Option::None,
5790        })
5791    }
5792
5793    /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5794    /// to hold a `RequiredActionQuorumReply`.
5795    ///
5796    /// Note that all the setters affecting `approval_payload` are
5797    /// mutually exclusive.
5798    ///
5799    /// # Example
5800    /// ```ignore,no_run
5801    /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5802    /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5803    /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5804    /// assert!(x.required_action_quorum_reply().is_some());
5805    /// assert!(x.quorum_reply().is_none());
5806    /// ```
5807    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{
5808        self.approval_payload = std::option::Option::Some(
5809            crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5810                v.into()
5811            )
5812        );
5813        self
5814    }
5815}
5816
5817impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5818    fn typename() -> &'static str {
5819        "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5820    }
5821}
5822
5823/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5824pub mod approve_single_tenant_hsm_instance_proposal_request {
5825    #[allow(unused_imports)]
5826    use super::*;
5827
5828    /// The reply to
5829    /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5830    /// for approving the proposal.
5831    ///
5832    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5833    #[derive(Clone, Default, PartialEq)]
5834    #[non_exhaustive]
5835    pub struct QuorumReply {
5836        /// Required. The challenge replies to approve the proposal. Challenge
5837        /// replies can be sent across multiple requests. The proposal will be
5838        /// approved when
5839        /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5840        /// challenge replies are provided.
5841        ///
5842        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5843        pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5844
5845        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5846    }
5847
5848    impl QuorumReply {
5849        /// Creates a new default instance.
5850        pub fn new() -> Self {
5851            std::default::Default::default()
5852        }
5853
5854        /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5855        ///
5856        /// # Example
5857        /// ```ignore,no_run
5858        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5859        /// use google_cloud_kms_v1::model::ChallengeReply;
5860        /// let x = QuorumReply::new()
5861        ///     .set_challenge_replies([
5862        ///         ChallengeReply::default()/* use setters */,
5863        ///         ChallengeReply::default()/* use (different) setters */,
5864        ///     ]);
5865        /// ```
5866        pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5867        where
5868            T: std::iter::IntoIterator<Item = V>,
5869            V: std::convert::Into<crate::model::ChallengeReply>,
5870        {
5871            use std::iter::Iterator;
5872            self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5873            self
5874        }
5875    }
5876
5877    impl wkt::message::Message for QuorumReply {
5878        fn typename() -> &'static str {
5879            "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
5880        }
5881    }
5882
5883    /// The reply to
5884    /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5885    /// for approving the proposal.
5886    ///
5887    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5888    #[derive(Clone, Default, PartialEq)]
5889    #[non_exhaustive]
5890    pub struct RequiredActionQuorumReply {
5891        /// Required. All required challenges must be signed for the proposal to be
5892        /// approved. These can be sent across multiple requests.
5893        pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5894
5895        /// Required. Quorum members' signed challenge replies. These can be provided
5896        /// across multiple requests. The proposal will be approved when
5897        /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
5898        /// quorum_challenge_replies are provided and when all
5899        /// required_challenge_replies are provided.
5900        ///
5901        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
5902        pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5903
5904        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5905    }
5906
5907    impl RequiredActionQuorumReply {
5908        /// Creates a new default instance.
5909        pub fn new() -> Self {
5910            std::default::Default::default()
5911        }
5912
5913        /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
5914        ///
5915        /// # Example
5916        /// ```ignore,no_run
5917        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5918        /// use google_cloud_kms_v1::model::ChallengeReply;
5919        /// let x = RequiredActionQuorumReply::new()
5920        ///     .set_required_challenge_replies([
5921        ///         ChallengeReply::default()/* use setters */,
5922        ///         ChallengeReply::default()/* use (different) setters */,
5923        ///     ]);
5924        /// ```
5925        pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
5926        where
5927            T: std::iter::IntoIterator<Item = V>,
5928            V: std::convert::Into<crate::model::ChallengeReply>,
5929        {
5930            use std::iter::Iterator;
5931            self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5932            self
5933        }
5934
5935        /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
5936        ///
5937        /// # Example
5938        /// ```ignore,no_run
5939        /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5940        /// use google_cloud_kms_v1::model::ChallengeReply;
5941        /// let x = RequiredActionQuorumReply::new()
5942        ///     .set_quorum_challenge_replies([
5943        ///         ChallengeReply::default()/* use setters */,
5944        ///         ChallengeReply::default()/* use (different) setters */,
5945        ///     ]);
5946        /// ```
5947        pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
5948        where
5949            T: std::iter::IntoIterator<Item = V>,
5950            V: std::convert::Into<crate::model::ChallengeReply>,
5951        {
5952            use std::iter::Iterator;
5953            self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5954            self
5955        }
5956    }
5957
5958    impl wkt::message::Message for RequiredActionQuorumReply {
5959        fn typename() -> &'static str {
5960            "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
5961        }
5962    }
5963
5964    /// The approval payload. The type of approval payload must correspond to the
5965    /// type of approval_parameters in the proposal.
5966    #[derive(Clone, Debug, PartialEq)]
5967    #[non_exhaustive]
5968    pub enum ApprovalPayload {
5969        /// Required. The reply to
5970        /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5971        /// for approving the proposal.
5972        ///
5973        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5974        QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
5975        /// Required. The reply to
5976        /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5977        /// for approving the proposal.
5978        ///
5979        /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5980        RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
5981    }
5982}
5983
5984/// Response message for
5985/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5986///
5987/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5988#[derive(Clone, Default, PartialEq)]
5989#[non_exhaustive]
5990pub struct ApproveSingleTenantHsmInstanceProposalResponse {
5991    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5992}
5993
5994impl ApproveSingleTenantHsmInstanceProposalResponse {
5995    /// Creates a new default instance.
5996    pub fn new() -> Self {
5997        std::default::Default::default()
5998    }
5999}
6000
6001impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
6002    fn typename() -> &'static str {
6003        "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
6004    }
6005}
6006
6007/// Request message for
6008/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
6009///
6010/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6011#[derive(Clone, Default, PartialEq)]
6012#[non_exhaustive]
6013pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
6014    /// Required. The
6015    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6016    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6017    /// to execute.
6018    ///
6019    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6020    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6021    pub name: std::string::String,
6022
6023    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6024}
6025
6026impl ExecuteSingleTenantHsmInstanceProposalRequest {
6027    /// Creates a new default instance.
6028    pub fn new() -> Self {
6029        std::default::Default::default()
6030    }
6031
6032    /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
6033    ///
6034    /// # Example
6035    /// ```ignore,no_run
6036    /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
6037    /// # let project_id = "project_id";
6038    /// # let location_id = "location_id";
6039    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6040    /// # let proposal_id = "proposal_id";
6041    /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
6042    /// ```
6043    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6044        self.name = v.into();
6045        self
6046    }
6047}
6048
6049impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
6050    fn typename() -> &'static str {
6051        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
6052    }
6053}
6054
6055/// Response message for
6056/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
6057///
6058/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6059#[derive(Clone, Default, PartialEq)]
6060#[non_exhaustive]
6061pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
6062    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6063}
6064
6065impl ExecuteSingleTenantHsmInstanceProposalResponse {
6066    /// Creates a new default instance.
6067    pub fn new() -> Self {
6068        std::default::Default::default()
6069    }
6070}
6071
6072impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
6073    fn typename() -> &'static str {
6074        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
6075    }
6076}
6077
6078/// Metadata message for
6079/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
6080/// long-running operation response.
6081///
6082/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6083#[derive(Clone, Default, PartialEq)]
6084#[non_exhaustive]
6085pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
6086    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6087}
6088
6089impl ExecuteSingleTenantHsmInstanceProposalMetadata {
6090    /// Creates a new default instance.
6091    pub fn new() -> Self {
6092        std::default::Default::default()
6093    }
6094}
6095
6096impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
6097    fn typename() -> &'static str {
6098        "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
6099    }
6100}
6101
6102/// Request message for
6103/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6104///
6105/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6106#[derive(Clone, Default, PartialEq)]
6107#[non_exhaustive]
6108pub struct ListSingleTenantHsmInstanceProposalsRequest {
6109    /// Required. The resource name of the single tenant HSM instance associated
6110    /// with the
6111    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6112    /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
6113    ///
6114    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6115    pub parent: std::string::String,
6116
6117    /// Optional. Optional limit on the number of
6118    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6119    /// to include in the response. Further
6120    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6121    /// can subsequently be obtained by including the
6122    /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
6123    /// in a subsequent request. If unspecified, the server will pick an
6124    /// appropriate default.
6125    ///
6126    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6127    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6128    pub page_size: i32,
6129
6130    /// Optional. Optional pagination token, returned earlier via
6131    /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
6132    ///
6133    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6134    pub page_token: std::string::String,
6135
6136    /// Optional. Only include resources that match the filter in the response. For
6137    /// more information, see
6138    /// [Sorting and filtering list
6139    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6140    pub filter: std::string::String,
6141
6142    /// Optional. Specify how the results should be sorted. If not specified, the
6143    /// results will be sorted in the default order.  For more information, see
6144    /// [Sorting and filtering list
6145    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6146    pub order_by: std::string::String,
6147
6148    /// Optional. If set to true,
6149    /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
6150    /// will also return
6151    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6152    /// in DELETED state.
6153    ///
6154    /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6155    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6156    pub show_deleted: bool,
6157
6158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6159}
6160
6161impl ListSingleTenantHsmInstanceProposalsRequest {
6162    /// Creates a new default instance.
6163    pub fn new() -> Self {
6164        std::default::Default::default()
6165    }
6166
6167    /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
6168    ///
6169    /// # Example
6170    /// ```ignore,no_run
6171    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6172    /// # let project_id = "project_id";
6173    /// # let location_id = "location_id";
6174    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6175    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
6176    /// ```
6177    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6178        self.parent = v.into();
6179        self
6180    }
6181
6182    /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
6183    ///
6184    /// # Example
6185    /// ```ignore,no_run
6186    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6187    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
6188    /// ```
6189    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6190        self.page_size = v.into();
6191        self
6192    }
6193
6194    /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
6195    ///
6196    /// # Example
6197    /// ```ignore,no_run
6198    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6199    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
6200    /// ```
6201    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6202        self.page_token = v.into();
6203        self
6204    }
6205
6206    /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
6207    ///
6208    /// # Example
6209    /// ```ignore,no_run
6210    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6211    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
6212    /// ```
6213    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6214        self.filter = v.into();
6215        self
6216    }
6217
6218    /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
6219    ///
6220    /// # Example
6221    /// ```ignore,no_run
6222    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6223    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
6224    /// ```
6225    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6226        self.order_by = v.into();
6227        self
6228    }
6229
6230    /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
6231    ///
6232    /// # Example
6233    /// ```ignore,no_run
6234    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6235    /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
6236    /// ```
6237    pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6238        self.show_deleted = v.into();
6239        self
6240    }
6241}
6242
6243impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
6244    fn typename() -> &'static str {
6245        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
6246    }
6247}
6248
6249/// Response message for
6250/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6251///
6252/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6253#[derive(Clone, Default, PartialEq)]
6254#[non_exhaustive]
6255pub struct ListSingleTenantHsmInstanceProposalsResponse {
6256    /// The list of
6257    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
6258    ///
6259    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6260    pub single_tenant_hsm_instance_proposals:
6261        std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
6262
6263    /// A token to retrieve next page of results. Pass this value in
6264    /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
6265    /// to retrieve the next page of results.
6266    ///
6267    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
6268    pub next_page_token: std::string::String,
6269
6270    /// The total number of
6271    /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6272    /// that matched the query.
6273    ///
6274    /// This field is not populated if
6275    /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
6276    /// is applied.
6277    ///
6278    /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
6279    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6280    pub total_size: i32,
6281
6282    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6283}
6284
6285impl ListSingleTenantHsmInstanceProposalsResponse {
6286    /// Creates a new default instance.
6287    pub fn new() -> Self {
6288        std::default::Default::default()
6289    }
6290
6291    /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
6292    ///
6293    /// # Example
6294    /// ```ignore,no_run
6295    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6296    /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
6297    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
6298    ///     .set_single_tenant_hsm_instance_proposals([
6299    ///         SingleTenantHsmInstanceProposal::default()/* use setters */,
6300    ///         SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
6301    ///     ]);
6302    /// ```
6303    pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
6304    where
6305        T: std::iter::IntoIterator<Item = V>,
6306        V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
6307    {
6308        use std::iter::Iterator;
6309        self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
6310        self
6311    }
6312
6313    /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
6314    ///
6315    /// # Example
6316    /// ```ignore,no_run
6317    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6318    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
6319    /// ```
6320    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6321        self.next_page_token = v.into();
6322        self
6323    }
6324
6325    /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
6326    ///
6327    /// # Example
6328    /// ```ignore,no_run
6329    /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6330    /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6331    /// ```
6332    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6333        self.total_size = v.into();
6334        self
6335    }
6336}
6337
6338impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6339    fn typename() -> &'static str {
6340        "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6341    }
6342}
6343
6344#[doc(hidden)]
6345impl google_cloud_gax::paginator::internal::PageableResponse
6346    for ListSingleTenantHsmInstanceProposalsResponse
6347{
6348    type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6349
6350    fn items(self) -> std::vec::Vec<Self::PageItem> {
6351        self.single_tenant_hsm_instance_proposals
6352    }
6353
6354    fn next_page_token(&self) -> std::string::String {
6355        use std::clone::Clone;
6356        self.next_page_token.clone()
6357    }
6358}
6359
6360/// Request message for
6361/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6362///
6363/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6364#[derive(Clone, Default, PartialEq)]
6365#[non_exhaustive]
6366pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6367    /// Required. The
6368    /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6369    /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6370    /// to delete.
6371    ///
6372    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6373    /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6374    pub name: std::string::String,
6375
6376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6377}
6378
6379impl DeleteSingleTenantHsmInstanceProposalRequest {
6380    /// Creates a new default instance.
6381    pub fn new() -> Self {
6382        std::default::Default::default()
6383    }
6384
6385    /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6386    ///
6387    /// # Example
6388    /// ```ignore,no_run
6389    /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6390    /// # let project_id = "project_id";
6391    /// # let location_id = "location_id";
6392    /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6393    /// # let proposal_id = "proposal_id";
6394    /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
6395    /// ```
6396    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6397        self.name = v.into();
6398        self
6399    }
6400}
6401
6402impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6403    fn typename() -> &'static str {
6404        "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6405    }
6406}
6407
6408/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6409/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6410///
6411/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6412/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6413#[derive(Clone, Default, PartialEq)]
6414#[non_exhaustive]
6415pub struct KeyRing {
6416    /// Output only. The resource name for the
6417    /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6418    /// `projects/*/locations/*/keyRings/*`.
6419    ///
6420    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6421    pub name: std::string::String,
6422
6423    /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6424    /// was created.
6425    ///
6426    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6427    pub create_time: std::option::Option<wkt::Timestamp>,
6428
6429    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6430}
6431
6432impl KeyRing {
6433    /// Creates a new default instance.
6434    pub fn new() -> Self {
6435        std::default::Default::default()
6436    }
6437
6438    /// Sets the value of [name][crate::model::KeyRing::name].
6439    ///
6440    /// # Example
6441    /// ```ignore,no_run
6442    /// # use google_cloud_kms_v1::model::KeyRing;
6443    /// # let project_id = "project_id";
6444    /// # let location_id = "location_id";
6445    /// # let key_ring_id = "key_ring_id";
6446    /// let x = KeyRing::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
6447    /// ```
6448    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6449        self.name = v.into();
6450        self
6451    }
6452
6453    /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6454    ///
6455    /// # Example
6456    /// ```ignore,no_run
6457    /// # use google_cloud_kms_v1::model::KeyRing;
6458    /// use wkt::Timestamp;
6459    /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6460    /// ```
6461    pub fn set_create_time<T>(mut self, v: T) -> Self
6462    where
6463        T: std::convert::Into<wkt::Timestamp>,
6464    {
6465        self.create_time = std::option::Option::Some(v.into());
6466        self
6467    }
6468
6469    /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6470    ///
6471    /// # Example
6472    /// ```ignore,no_run
6473    /// # use google_cloud_kms_v1::model::KeyRing;
6474    /// use wkt::Timestamp;
6475    /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6476    /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6477    /// ```
6478    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6479    where
6480        T: std::convert::Into<wkt::Timestamp>,
6481    {
6482        self.create_time = v.map(|x| x.into());
6483        self
6484    }
6485}
6486
6487impl wkt::message::Message for KeyRing {
6488    fn typename() -> &'static str {
6489        "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6490    }
6491}
6492
6493/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6494/// can be used for cryptographic operations.
6495///
6496/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6497/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6498/// key material used in cryptographic operations.
6499///
6500/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6501/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6502#[derive(Clone, Default, PartialEq)]
6503#[non_exhaustive]
6504pub struct CryptoKey {
6505    /// Output only. The resource name for this
6506    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6507    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6508    ///
6509    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6510    pub name: std::string::String,
6511
6512    /// Output only. A copy of the "primary"
6513    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6514    /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6515    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6516    /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6517    ///
6518    /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6519    /// updated via
6520    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6521    ///
6522    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6523    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6524    /// may have a primary. For other keys, this field will be omitted.
6525    ///
6526    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6527    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6528    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6529    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6530    /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6531    /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6532    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6533    pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6534
6535    /// Immutable. The immutable purpose of this
6536    /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6537    ///
6538    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6539    pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6540
6541    /// Output only. The time at which this
6542    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6543    ///
6544    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6545    pub create_time: std::option::Option<wkt::Timestamp>,
6546
6547    /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6548    /// the Key Management Service will automatically:
6549    ///
6550    /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6551    /// 1. Mark the new version as primary.
6552    ///
6553    /// Key rotations performed manually via
6554    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6555    /// and
6556    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6557    /// do not affect
6558    /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6559    ///
6560    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6561    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6562    /// support automatic rotation. For other keys, this field must be omitted.
6563    ///
6564    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6565    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6566    /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6567    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6568    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6569    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6570    pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6571
6572    /// A template describing settings for new
6573    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6574    /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6575    /// instances created by either
6576    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6577    /// or auto-rotation are controlled by this template.
6578    ///
6579    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6580    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6581    pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6582
6583    /// Labels with user-defined metadata. For more information, see
6584    /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6585    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6586
6587    /// Immutable. Whether this key may contain imported versions only.
6588    pub import_only: bool,
6589
6590    /// Immutable. The period of time that versions of this key spend in the
6591    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6592    /// state before transitioning to
6593    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6594    /// If not specified at creation time, the default duration is 30 days.
6595    ///
6596    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6597    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6598    pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6599
6600    /// Immutable. The resource name of the backend environment where the key
6601    /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6602    /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6603    /// where all related cryptographic operations are performed. Only applicable
6604    /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6605    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6606    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6607    /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6608    /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6609    /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6610    /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6611    /// with the resource name in the format
6612    /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6613    /// Note, this list is non-exhaustive and may apply to additional
6614    /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6615    ///
6616    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6617    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6618    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6619    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6620    /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6621    pub crypto_key_backend: std::string::String,
6622
6623    /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6624    /// If this field is present and this key is enrolled in Key Access
6625    /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6626    /// decrypt, and sign operations, and the operation will fail if rejected by
6627    /// the policy. The policy is defined by specifying zero or more allowed
6628    /// justification codes.
6629    /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6630    /// By default, this field is absent, and all justification codes are allowed.
6631    /// If the
6632    /// `key_access_justifications_policy.allowed_access_reasons`
6633    /// is empty (zero allowed justification code), all encrypt, decrypt, and sign
6634    /// operations will fail.
6635    pub key_access_justifications_policy:
6636        std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6637
6638    /// Controls the rate of automatic rotation.
6639    pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6640
6641    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6642}
6643
6644impl CryptoKey {
6645    /// Creates a new default instance.
6646    pub fn new() -> Self {
6647        std::default::Default::default()
6648    }
6649
6650    /// Sets the value of [name][crate::model::CryptoKey::name].
6651    ///
6652    /// # Example
6653    /// ```ignore,no_run
6654    /// # use google_cloud_kms_v1::model::CryptoKey;
6655    /// # let project_id = "project_id";
6656    /// # let location_id = "location_id";
6657    /// # let key_ring_id = "key_ring_id";
6658    /// # let crypto_key_id = "crypto_key_id";
6659    /// let x = CryptoKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
6660    /// ```
6661    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6662        self.name = v.into();
6663        self
6664    }
6665
6666    /// Sets the value of [primary][crate::model::CryptoKey::primary].
6667    ///
6668    /// # Example
6669    /// ```ignore,no_run
6670    /// # use google_cloud_kms_v1::model::CryptoKey;
6671    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6672    /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6673    /// ```
6674    pub fn set_primary<T>(mut self, v: T) -> Self
6675    where
6676        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6677    {
6678        self.primary = std::option::Option::Some(v.into());
6679        self
6680    }
6681
6682    /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6683    ///
6684    /// # Example
6685    /// ```ignore,no_run
6686    /// # use google_cloud_kms_v1::model::CryptoKey;
6687    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6688    /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6689    /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6690    /// ```
6691    pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6692    where
6693        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6694    {
6695        self.primary = v.map(|x| x.into());
6696        self
6697    }
6698
6699    /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6700    ///
6701    /// # Example
6702    /// ```ignore,no_run
6703    /// # use google_cloud_kms_v1::model::CryptoKey;
6704    /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6705    /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6706    /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6707    /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6708    /// ```
6709    pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6710        mut self,
6711        v: T,
6712    ) -> Self {
6713        self.purpose = v.into();
6714        self
6715    }
6716
6717    /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6718    ///
6719    /// # Example
6720    /// ```ignore,no_run
6721    /// # use google_cloud_kms_v1::model::CryptoKey;
6722    /// use wkt::Timestamp;
6723    /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6724    /// ```
6725    pub fn set_create_time<T>(mut self, v: T) -> Self
6726    where
6727        T: std::convert::Into<wkt::Timestamp>,
6728    {
6729        self.create_time = std::option::Option::Some(v.into());
6730        self
6731    }
6732
6733    /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6734    ///
6735    /// # Example
6736    /// ```ignore,no_run
6737    /// # use google_cloud_kms_v1::model::CryptoKey;
6738    /// use wkt::Timestamp;
6739    /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6740    /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6741    /// ```
6742    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6743    where
6744        T: std::convert::Into<wkt::Timestamp>,
6745    {
6746        self.create_time = v.map(|x| x.into());
6747        self
6748    }
6749
6750    /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6751    ///
6752    /// # Example
6753    /// ```ignore,no_run
6754    /// # use google_cloud_kms_v1::model::CryptoKey;
6755    /// use wkt::Timestamp;
6756    /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6757    /// ```
6758    pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6759    where
6760        T: std::convert::Into<wkt::Timestamp>,
6761    {
6762        self.next_rotation_time = std::option::Option::Some(v.into());
6763        self
6764    }
6765
6766    /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6767    ///
6768    /// # Example
6769    /// ```ignore,no_run
6770    /// # use google_cloud_kms_v1::model::CryptoKey;
6771    /// use wkt::Timestamp;
6772    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6773    /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6774    /// ```
6775    pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6776    where
6777        T: std::convert::Into<wkt::Timestamp>,
6778    {
6779        self.next_rotation_time = v.map(|x| x.into());
6780        self
6781    }
6782
6783    /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6784    ///
6785    /// # Example
6786    /// ```ignore,no_run
6787    /// # use google_cloud_kms_v1::model::CryptoKey;
6788    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6789    /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6790    /// ```
6791    pub fn set_version_template<T>(mut self, v: T) -> Self
6792    where
6793        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6794    {
6795        self.version_template = std::option::Option::Some(v.into());
6796        self
6797    }
6798
6799    /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6800    ///
6801    /// # Example
6802    /// ```ignore,no_run
6803    /// # use google_cloud_kms_v1::model::CryptoKey;
6804    /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6805    /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6806    /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6807    /// ```
6808    pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6809    where
6810        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6811    {
6812        self.version_template = v.map(|x| x.into());
6813        self
6814    }
6815
6816    /// Sets the value of [labels][crate::model::CryptoKey::labels].
6817    ///
6818    /// # Example
6819    /// ```ignore,no_run
6820    /// # use google_cloud_kms_v1::model::CryptoKey;
6821    /// let x = CryptoKey::new().set_labels([
6822    ///     ("key0", "abc"),
6823    ///     ("key1", "xyz"),
6824    /// ]);
6825    /// ```
6826    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6827    where
6828        T: std::iter::IntoIterator<Item = (K, V)>,
6829        K: std::convert::Into<std::string::String>,
6830        V: std::convert::Into<std::string::String>,
6831    {
6832        use std::iter::Iterator;
6833        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6834        self
6835    }
6836
6837    /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6838    ///
6839    /// # Example
6840    /// ```ignore,no_run
6841    /// # use google_cloud_kms_v1::model::CryptoKey;
6842    /// let x = CryptoKey::new().set_import_only(true);
6843    /// ```
6844    pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6845        self.import_only = v.into();
6846        self
6847    }
6848
6849    /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6850    ///
6851    /// # Example
6852    /// ```ignore,no_run
6853    /// # use google_cloud_kms_v1::model::CryptoKey;
6854    /// use wkt::Duration;
6855    /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6856    /// ```
6857    pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6858    where
6859        T: std::convert::Into<wkt::Duration>,
6860    {
6861        self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6862        self
6863    }
6864
6865    /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6866    ///
6867    /// # Example
6868    /// ```ignore,no_run
6869    /// # use google_cloud_kms_v1::model::CryptoKey;
6870    /// use wkt::Duration;
6871    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6872    /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6873    /// ```
6874    pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
6875    where
6876        T: std::convert::Into<wkt::Duration>,
6877    {
6878        self.destroy_scheduled_duration = v.map(|x| x.into());
6879        self
6880    }
6881
6882    /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
6883    ///
6884    /// # Example
6885    /// ```ignore,no_run
6886    /// # use google_cloud_kms_v1::model::CryptoKey;
6887    /// let x = CryptoKey::new().set_crypto_key_backend("example");
6888    /// ```
6889    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
6890        mut self,
6891        v: T,
6892    ) -> Self {
6893        self.crypto_key_backend = v.into();
6894        self
6895    }
6896
6897    /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6898    ///
6899    /// # Example
6900    /// ```ignore,no_run
6901    /// # use google_cloud_kms_v1::model::CryptoKey;
6902    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6903    /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
6904    /// ```
6905    pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
6906    where
6907        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6908    {
6909        self.key_access_justifications_policy = std::option::Option::Some(v.into());
6910        self
6911    }
6912
6913    /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6914    ///
6915    /// # Example
6916    /// ```ignore,no_run
6917    /// # use google_cloud_kms_v1::model::CryptoKey;
6918    /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6919    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
6920    /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
6921    /// ```
6922    pub fn set_or_clear_key_access_justifications_policy<T>(
6923        mut self,
6924        v: std::option::Option<T>,
6925    ) -> Self
6926    where
6927        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6928    {
6929        self.key_access_justifications_policy = v.map(|x| x.into());
6930        self
6931    }
6932
6933    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
6934    ///
6935    /// Note that all the setters affecting `rotation_schedule` are mutually
6936    /// exclusive.
6937    ///
6938    /// # Example
6939    /// ```ignore,no_run
6940    /// # use google_cloud_kms_v1::model::CryptoKey;
6941    /// use wkt::Duration;
6942    /// let x = CryptoKey::new().set_rotation_schedule(Some(
6943    ///     google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
6944    /// ```
6945    pub fn set_rotation_schedule<
6946        T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
6947    >(
6948        mut self,
6949        v: T,
6950    ) -> Self {
6951        self.rotation_schedule = v.into();
6952        self
6953    }
6954
6955    /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6956    /// if it holds a `RotationPeriod`, `None` if the field is not set or
6957    /// holds a different branch.
6958    pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6959        #[allow(unreachable_patterns)]
6960        self.rotation_schedule.as_ref().and_then(|v| match v {
6961            crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
6962                std::option::Option::Some(v)
6963            }
6964            _ => std::option::Option::None,
6965        })
6966    }
6967
6968    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6969    /// to hold a `RotationPeriod`.
6970    ///
6971    /// Note that all the setters affecting `rotation_schedule` are
6972    /// mutually exclusive.
6973    ///
6974    /// # Example
6975    /// ```ignore,no_run
6976    /// # use google_cloud_kms_v1::model::CryptoKey;
6977    /// use wkt::Duration;
6978    /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
6979    /// assert!(x.rotation_period().is_some());
6980    /// ```
6981    pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
6982        mut self,
6983        v: T,
6984    ) -> Self {
6985        self.rotation_schedule = std::option::Option::Some(
6986            crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
6987        );
6988        self
6989    }
6990}
6991
6992impl wkt::message::Message for CryptoKey {
6993    fn typename() -> &'static str {
6994        "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
6995    }
6996}
6997
6998/// Defines additional types related to [CryptoKey].
6999pub mod crypto_key {
7000    #[allow(unused_imports)]
7001    use super::*;
7002
7003    /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
7004    /// describes the cryptographic capabilities of a
7005    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
7006    /// for the operations allowed by its purpose. For more information, see [Key
7007    /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
7008    ///
7009    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7010    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
7011    ///
7012    /// # Working with unknown values
7013    ///
7014    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7015    /// additional enum variants at any time. Adding new variants is not considered
7016    /// a breaking change. Applications should write their code in anticipation of:
7017    ///
7018    /// - New values appearing in future releases of the client library, **and**
7019    /// - New values received dynamically, without application changes.
7020    ///
7021    /// Please consult the [Working with enums] section in the user guide for some
7022    /// guidelines.
7023    ///
7024    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7025    #[derive(Clone, Debug, PartialEq)]
7026    #[non_exhaustive]
7027    pub enum CryptoKeyPurpose {
7028        /// Not specified.
7029        Unspecified,
7030        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7031        /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
7032        /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
7033        ///
7034        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7035        /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
7036        /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
7037        EncryptDecrypt,
7038        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7039        /// with
7040        /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
7041        /// and
7042        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
7043        ///
7044        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7045        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
7046        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7047        AsymmetricSign,
7048        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7049        /// with
7050        /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
7051        /// and
7052        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
7053        ///
7054        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7055        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
7056        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7057        AsymmetricDecrypt,
7058        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7059        /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
7060        /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
7061        /// This purpose is meant to be used for interoperable symmetric
7062        /// encryption and does not support automatic CryptoKey rotation.
7063        ///
7064        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7065        /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
7066        /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
7067        RawEncryptDecrypt,
7068        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7069        /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
7070        ///
7071        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7072        /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
7073        Mac,
7074        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7075        /// with
7076        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
7077        /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
7078        ///
7079        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7080        /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
7081        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7082        KeyEncapsulation,
7083        /// If set, the enum was initialized with an unknown value.
7084        ///
7085        /// Applications can examine the value using [CryptoKeyPurpose::value] or
7086        /// [CryptoKeyPurpose::name].
7087        UnknownValue(crypto_key_purpose::UnknownValue),
7088    }
7089
7090    #[doc(hidden)]
7091    pub mod crypto_key_purpose {
7092        #[allow(unused_imports)]
7093        use super::*;
7094        #[derive(Clone, Debug, PartialEq)]
7095        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7096    }
7097
7098    impl CryptoKeyPurpose {
7099        /// Gets the enum value.
7100        ///
7101        /// Returns `None` if the enum contains an unknown value deserialized from
7102        /// the string representation of enums.
7103        pub fn value(&self) -> std::option::Option<i32> {
7104            match self {
7105                Self::Unspecified => std::option::Option::Some(0),
7106                Self::EncryptDecrypt => std::option::Option::Some(1),
7107                Self::AsymmetricSign => std::option::Option::Some(5),
7108                Self::AsymmetricDecrypt => std::option::Option::Some(6),
7109                Self::RawEncryptDecrypt => std::option::Option::Some(7),
7110                Self::Mac => std::option::Option::Some(9),
7111                Self::KeyEncapsulation => std::option::Option::Some(10),
7112                Self::UnknownValue(u) => u.0.value(),
7113            }
7114        }
7115
7116        /// Gets the enum value as a string.
7117        ///
7118        /// Returns `None` if the enum contains an unknown value deserialized from
7119        /// the integer representation of enums.
7120        pub fn name(&self) -> std::option::Option<&str> {
7121            match self {
7122                Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
7123                Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
7124                Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
7125                Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
7126                Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
7127                Self::Mac => std::option::Option::Some("MAC"),
7128                Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
7129                Self::UnknownValue(u) => u.0.name(),
7130            }
7131        }
7132    }
7133
7134    impl std::default::Default for CryptoKeyPurpose {
7135        fn default() -> Self {
7136            use std::convert::From;
7137            Self::from(0)
7138        }
7139    }
7140
7141    impl std::fmt::Display for CryptoKeyPurpose {
7142        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7143            wkt::internal::display_enum(f, self.name(), self.value())
7144        }
7145    }
7146
7147    impl std::convert::From<i32> for CryptoKeyPurpose {
7148        fn from(value: i32) -> Self {
7149            match value {
7150                0 => Self::Unspecified,
7151                1 => Self::EncryptDecrypt,
7152                5 => Self::AsymmetricSign,
7153                6 => Self::AsymmetricDecrypt,
7154                7 => Self::RawEncryptDecrypt,
7155                9 => Self::Mac,
7156                10 => Self::KeyEncapsulation,
7157                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7158                    wkt::internal::UnknownEnumValue::Integer(value),
7159                )),
7160            }
7161        }
7162    }
7163
7164    impl std::convert::From<&str> for CryptoKeyPurpose {
7165        fn from(value: &str) -> Self {
7166            use std::string::ToString;
7167            match value {
7168                "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
7169                "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
7170                "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
7171                "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
7172                "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
7173                "MAC" => Self::Mac,
7174                "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
7175                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7176                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7177                )),
7178            }
7179        }
7180    }
7181
7182    impl serde::ser::Serialize for CryptoKeyPurpose {
7183        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7184        where
7185            S: serde::Serializer,
7186        {
7187            match self {
7188                Self::Unspecified => serializer.serialize_i32(0),
7189                Self::EncryptDecrypt => serializer.serialize_i32(1),
7190                Self::AsymmetricSign => serializer.serialize_i32(5),
7191                Self::AsymmetricDecrypt => serializer.serialize_i32(6),
7192                Self::RawEncryptDecrypt => serializer.serialize_i32(7),
7193                Self::Mac => serializer.serialize_i32(9),
7194                Self::KeyEncapsulation => serializer.serialize_i32(10),
7195                Self::UnknownValue(u) => u.0.serialize(serializer),
7196            }
7197        }
7198    }
7199
7200    impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
7201        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7202        where
7203            D: serde::Deserializer<'de>,
7204        {
7205            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
7206                ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
7207            ))
7208        }
7209    }
7210
7211    /// Controls the rate of automatic rotation.
7212    #[derive(Clone, Debug, PartialEq)]
7213    #[non_exhaustive]
7214    pub enum RotationSchedule {
7215        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7216        /// will be advanced by this period when the service automatically rotates a
7217        /// key. Must be at least 24 hours and at most 876,000 hours.
7218        ///
7219        /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
7220        /// set,
7221        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7222        /// must also be set.
7223        ///
7224        /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
7225        /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
7226        /// support automatic rotation. For other keys, this field must be omitted.
7227        ///
7228        /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7229        /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
7230        /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7231        /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
7232        RotationPeriod(std::boxed::Box<wkt::Duration>),
7233    }
7234}
7235
7236/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
7237/// specifies the properties to use when creating a new
7238/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
7239/// with
7240/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
7241/// or automatically as a result of auto-rotation.
7242///
7243/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7244/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
7245/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7246#[derive(Clone, Default, PartialEq)]
7247#[non_exhaustive]
7248pub struct CryptoKeyVersionTemplate {
7249    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
7250    /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7251    /// template. Immutable. Defaults to
7252    /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
7253    ///
7254    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7255    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7256    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7257    pub protection_level: crate::model::ProtectionLevel,
7258
7259    /// Required.
7260    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7261    /// to use when creating a
7262    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7263    /// template.
7264    ///
7265    /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
7266    /// this field is omitted and
7267    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
7268    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7269    ///
7270    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7271    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7272    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7273    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7274    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7275
7276    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7277}
7278
7279impl CryptoKeyVersionTemplate {
7280    /// Creates a new default instance.
7281    pub fn new() -> Self {
7282        std::default::Default::default()
7283    }
7284
7285    /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
7286    ///
7287    /// # Example
7288    /// ```ignore,no_run
7289    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7290    /// use google_cloud_kms_v1::model::ProtectionLevel;
7291    /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
7292    /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
7293    /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
7294    /// ```
7295    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7296        mut self,
7297        v: T,
7298    ) -> Self {
7299        self.protection_level = v.into();
7300        self
7301    }
7302
7303    /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
7304    ///
7305    /// # Example
7306    /// ```ignore,no_run
7307    /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7308    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7309    /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7310    /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7311    /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7312    /// ```
7313    pub fn set_algorithm<
7314        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7315    >(
7316        mut self,
7317        v: T,
7318    ) -> Self {
7319        self.algorithm = v.into();
7320        self
7321    }
7322}
7323
7324impl wkt::message::Message for CryptoKeyVersionTemplate {
7325    fn typename() -> &'static str {
7326        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
7327    }
7328}
7329
7330/// Contains an HSM-generated attestation about a key operation. For more
7331/// information, see [Verifying attestations]
7332/// (<https://cloud.google.com/kms/docs/attest-key>).
7333#[derive(Clone, Default, PartialEq)]
7334#[non_exhaustive]
7335pub struct KeyOperationAttestation {
7336    /// Output only. The format of the attestation data.
7337    pub format: crate::model::key_operation_attestation::AttestationFormat,
7338
7339    /// Output only. The attestation data provided by the HSM when the key
7340    /// operation was performed.
7341    pub content: ::bytes::Bytes,
7342
7343    /// Output only. The certificate chains needed to validate the attestation
7344    pub cert_chains:
7345        std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
7346
7347    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7348}
7349
7350impl KeyOperationAttestation {
7351    /// Creates a new default instance.
7352    pub fn new() -> Self {
7353        std::default::Default::default()
7354    }
7355
7356    /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7357    ///
7358    /// # Example
7359    /// ```ignore,no_run
7360    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7361    /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7362    /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7363    /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7364    /// ```
7365    pub fn set_format<
7366        T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7367    >(
7368        mut self,
7369        v: T,
7370    ) -> Self {
7371        self.format = v.into();
7372        self
7373    }
7374
7375    /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7376    ///
7377    /// # Example
7378    /// ```ignore,no_run
7379    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7380    /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7381    /// ```
7382    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7383        self.content = v.into();
7384        self
7385    }
7386
7387    /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7388    ///
7389    /// # Example
7390    /// ```ignore,no_run
7391    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7392    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7393    /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7394    /// ```
7395    pub fn set_cert_chains<T>(mut self, v: T) -> Self
7396    where
7397        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7398    {
7399        self.cert_chains = std::option::Option::Some(v.into());
7400        self
7401    }
7402
7403    /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7404    ///
7405    /// # Example
7406    /// ```ignore,no_run
7407    /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7408    /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7409    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7410    /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7411    /// ```
7412    pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7413    where
7414        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7415    {
7416        self.cert_chains = v.map(|x| x.into());
7417        self
7418    }
7419}
7420
7421impl wkt::message::Message for KeyOperationAttestation {
7422    fn typename() -> &'static str {
7423        "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7424    }
7425}
7426
7427/// Defines additional types related to [KeyOperationAttestation].
7428pub mod key_operation_attestation {
7429    #[allow(unused_imports)]
7430    use super::*;
7431
7432    /// Certificate chains needed to verify the attestation.
7433    /// Certificates in chains are PEM-encoded and are ordered based on
7434    /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7435    #[derive(Clone, Default, PartialEq)]
7436    #[non_exhaustive]
7437    pub struct CertificateChains {
7438        /// Cavium certificate chain corresponding to the attestation.
7439        pub cavium_certs: std::vec::Vec<std::string::String>,
7440
7441        /// Google card certificate chain corresponding to the attestation.
7442        pub google_card_certs: std::vec::Vec<std::string::String>,
7443
7444        /// Google partition certificate chain corresponding to the attestation.
7445        pub google_partition_certs: std::vec::Vec<std::string::String>,
7446
7447        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7448    }
7449
7450    impl CertificateChains {
7451        /// Creates a new default instance.
7452        pub fn new() -> Self {
7453            std::default::Default::default()
7454        }
7455
7456        /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7457        ///
7458        /// # Example
7459        /// ```ignore,no_run
7460        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7461        /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7462        /// ```
7463        pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7464        where
7465            T: std::iter::IntoIterator<Item = V>,
7466            V: std::convert::Into<std::string::String>,
7467        {
7468            use std::iter::Iterator;
7469            self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7470            self
7471        }
7472
7473        /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7474        ///
7475        /// # Example
7476        /// ```ignore,no_run
7477        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7478        /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7479        /// ```
7480        pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7481        where
7482            T: std::iter::IntoIterator<Item = V>,
7483            V: std::convert::Into<std::string::String>,
7484        {
7485            use std::iter::Iterator;
7486            self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7487            self
7488        }
7489
7490        /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7491        ///
7492        /// # Example
7493        /// ```ignore,no_run
7494        /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7495        /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7496        /// ```
7497        pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7498        where
7499            T: std::iter::IntoIterator<Item = V>,
7500            V: std::convert::Into<std::string::String>,
7501        {
7502            use std::iter::Iterator;
7503            self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7504            self
7505        }
7506    }
7507
7508    impl wkt::message::Message for CertificateChains {
7509        fn typename() -> &'static str {
7510            "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7511        }
7512    }
7513
7514    /// Attestation formats provided by the HSM.
7515    ///
7516    /// # Working with unknown values
7517    ///
7518    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7519    /// additional enum variants at any time. Adding new variants is not considered
7520    /// a breaking change. Applications should write their code in anticipation of:
7521    ///
7522    /// - New values appearing in future releases of the client library, **and**
7523    /// - New values received dynamically, without application changes.
7524    ///
7525    /// Please consult the [Working with enums] section in the user guide for some
7526    /// guidelines.
7527    ///
7528    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7529    #[derive(Clone, Debug, PartialEq)]
7530    #[non_exhaustive]
7531    pub enum AttestationFormat {
7532        /// Not specified.
7533        Unspecified,
7534        /// Cavium HSM attestation compressed with gzip. Note that this format is
7535        /// defined by Cavium and subject to change at any time.
7536        ///
7537        /// See
7538        /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7539        CaviumV1Compressed,
7540        /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7541        /// introduced in Cavium's version 3.2-08.
7542        CaviumV2Compressed,
7543        /// If set, the enum was initialized with an unknown value.
7544        ///
7545        /// Applications can examine the value using [AttestationFormat::value] or
7546        /// [AttestationFormat::name].
7547        UnknownValue(attestation_format::UnknownValue),
7548    }
7549
7550    #[doc(hidden)]
7551    pub mod attestation_format {
7552        #[allow(unused_imports)]
7553        use super::*;
7554        #[derive(Clone, Debug, PartialEq)]
7555        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7556    }
7557
7558    impl AttestationFormat {
7559        /// Gets the enum value.
7560        ///
7561        /// Returns `None` if the enum contains an unknown value deserialized from
7562        /// the string representation of enums.
7563        pub fn value(&self) -> std::option::Option<i32> {
7564            match self {
7565                Self::Unspecified => std::option::Option::Some(0),
7566                Self::CaviumV1Compressed => std::option::Option::Some(3),
7567                Self::CaviumV2Compressed => std::option::Option::Some(4),
7568                Self::UnknownValue(u) => u.0.value(),
7569            }
7570        }
7571
7572        /// Gets the enum value as a string.
7573        ///
7574        /// Returns `None` if the enum contains an unknown value deserialized from
7575        /// the integer representation of enums.
7576        pub fn name(&self) -> std::option::Option<&str> {
7577            match self {
7578                Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7579                Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7580                Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7581                Self::UnknownValue(u) => u.0.name(),
7582            }
7583        }
7584    }
7585
7586    impl std::default::Default for AttestationFormat {
7587        fn default() -> Self {
7588            use std::convert::From;
7589            Self::from(0)
7590        }
7591    }
7592
7593    impl std::fmt::Display for AttestationFormat {
7594        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7595            wkt::internal::display_enum(f, self.name(), self.value())
7596        }
7597    }
7598
7599    impl std::convert::From<i32> for AttestationFormat {
7600        fn from(value: i32) -> Self {
7601            match value {
7602                0 => Self::Unspecified,
7603                3 => Self::CaviumV1Compressed,
7604                4 => Self::CaviumV2Compressed,
7605                _ => Self::UnknownValue(attestation_format::UnknownValue(
7606                    wkt::internal::UnknownEnumValue::Integer(value),
7607                )),
7608            }
7609        }
7610    }
7611
7612    impl std::convert::From<&str> for AttestationFormat {
7613        fn from(value: &str) -> Self {
7614            use std::string::ToString;
7615            match value {
7616                "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7617                "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7618                "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7619                _ => Self::UnknownValue(attestation_format::UnknownValue(
7620                    wkt::internal::UnknownEnumValue::String(value.to_string()),
7621                )),
7622            }
7623        }
7624    }
7625
7626    impl serde::ser::Serialize for AttestationFormat {
7627        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7628        where
7629            S: serde::Serializer,
7630        {
7631            match self {
7632                Self::Unspecified => serializer.serialize_i32(0),
7633                Self::CaviumV1Compressed => serializer.serialize_i32(3),
7634                Self::CaviumV2Compressed => serializer.serialize_i32(4),
7635                Self::UnknownValue(u) => u.0.serialize(serializer),
7636            }
7637        }
7638    }
7639
7640    impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7641        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7642        where
7643            D: serde::Deserializer<'de>,
7644        {
7645            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7646                ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7647            ))
7648        }
7649    }
7650}
7651
7652/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7653/// individual cryptographic key, and the associated key material.
7654///
7655/// An
7656/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7657/// version can be used for cryptographic operations.
7658///
7659/// For security reasons, the raw cryptographic key material represented by a
7660/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7661/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7662/// authorized user or application invokes Cloud KMS.
7663///
7664/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7665/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7666#[derive(Clone, Default, PartialEq)]
7667#[non_exhaustive]
7668pub struct CryptoKeyVersion {
7669    /// Output only. The resource name for this
7670    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7671    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7672    ///
7673    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7674    pub name: std::string::String,
7675
7676    /// The current state of the
7677    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7678    ///
7679    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7680    pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7681
7682    /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7683    /// describing how crypto operations are performed with this
7684    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7685    ///
7686    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7687    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7688    pub protection_level: crate::model::ProtectionLevel,
7689
7690    /// Output only. The
7691    /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7692    /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7693    /// supports.
7694    ///
7695    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7696    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7697    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7698
7699    /// Output only. Statement that was generated and signed by the HSM at key
7700    /// creation time. Use this statement to verify attributes of the key as stored
7701    /// on the HSM, independently of Google. Only provided for key versions with
7702    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7703    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7704    ///
7705    /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7706    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7707    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7708
7709    /// Output only. The time at which this
7710    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7711    ///
7712    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7713    pub create_time: std::option::Option<wkt::Timestamp>,
7714
7715    /// Output only. The time this
7716    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7717    /// generated.
7718    ///
7719    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7720    pub generate_time: std::option::Option<wkt::Timestamp>,
7721
7722    /// Output only. The time this
7723    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7724    /// scheduled for destruction. Only present if
7725    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7726    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7727    ///
7728    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7729    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7730    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7731    pub destroy_time: std::option::Option<wkt::Timestamp>,
7732
7733    /// Output only. The time this CryptoKeyVersion's key material was
7734    /// destroyed. Only present if
7735    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7736    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7737    ///
7738    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7739    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7740    pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7741
7742    /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7743    /// used in the most recent import of this
7744    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7745    /// the underlying key material was imported.
7746    ///
7747    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7748    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7749    pub import_job: std::string::String,
7750
7751    /// Output only. The time at which this
7752    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7753    /// most recently imported.
7754    ///
7755    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7756    pub import_time: std::option::Option<wkt::Timestamp>,
7757
7758    /// Output only. The root cause of the most recent import failure. Only present
7759    /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7760    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7761    ///
7762    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7763    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7764    pub import_failure_reason: std::string::String,
7765
7766    /// Output only. The root cause of the most recent generation failure. Only
7767    /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7768    /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7769    ///
7770    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7771    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7772    pub generation_failure_reason: std::string::String,
7773
7774    /// Output only. The root cause of the most recent external destruction
7775    /// failure. Only present if
7776    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7777    /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7778    ///
7779    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7780    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7781    pub external_destruction_failure_reason: std::string::String,
7782
7783    /// ExternalProtectionLevelOptions stores a group of additional fields for
7784    /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7785    /// are specific to the
7786    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7787    /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7788    /// protection levels.
7789    ///
7790    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7791    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7792    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7793    pub external_protection_level_options:
7794        std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7795
7796    /// Output only. Whether or not this key version is eligible for reimport, by
7797    /// being specified as a target in
7798    /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7799    ///
7800    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7801    pub reimport_eligible: bool,
7802
7803    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7804}
7805
7806impl CryptoKeyVersion {
7807    /// Creates a new default instance.
7808    pub fn new() -> Self {
7809        std::default::Default::default()
7810    }
7811
7812    /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7813    ///
7814    /// # Example
7815    /// ```ignore,no_run
7816    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7817    /// # let project_id = "project_id";
7818    /// # let location_id = "location_id";
7819    /// # let key_ring_id = "key_ring_id";
7820    /// # let crypto_key_id = "crypto_key_id";
7821    /// # let crypto_key_version_id = "crypto_key_version_id";
7822    /// let x = CryptoKeyVersion::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
7823    /// ```
7824    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7825        self.name = v.into();
7826        self
7827    }
7828
7829    /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7830    ///
7831    /// # Example
7832    /// ```ignore,no_run
7833    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7834    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7835    /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7836    /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7837    /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7838    /// ```
7839    pub fn set_state<
7840        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
7841    >(
7842        mut self,
7843        v: T,
7844    ) -> Self {
7845        self.state = v.into();
7846        self
7847    }
7848
7849    /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
7850    ///
7851    /// # Example
7852    /// ```ignore,no_run
7853    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7854    /// use google_cloud_kms_v1::model::ProtectionLevel;
7855    /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
7856    /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
7857    /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
7858    /// ```
7859    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7860        mut self,
7861        v: T,
7862    ) -> Self {
7863        self.protection_level = v.into();
7864        self
7865    }
7866
7867    /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
7868    ///
7869    /// # Example
7870    /// ```ignore,no_run
7871    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7872    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7873    /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7874    /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7875    /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7876    /// ```
7877    pub fn set_algorithm<
7878        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7879    >(
7880        mut self,
7881        v: T,
7882    ) -> Self {
7883        self.algorithm = v.into();
7884        self
7885    }
7886
7887    /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7888    ///
7889    /// # Example
7890    /// ```ignore,no_run
7891    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7892    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7893    /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
7894    /// ```
7895    pub fn set_attestation<T>(mut self, v: T) -> Self
7896    where
7897        T: std::convert::Into<crate::model::KeyOperationAttestation>,
7898    {
7899        self.attestation = std::option::Option::Some(v.into());
7900        self
7901    }
7902
7903    /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7904    ///
7905    /// # Example
7906    /// ```ignore,no_run
7907    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7908    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7909    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
7910    /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
7911    /// ```
7912    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
7913    where
7914        T: std::convert::Into<crate::model::KeyOperationAttestation>,
7915    {
7916        self.attestation = v.map(|x| x.into());
7917        self
7918    }
7919
7920    /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7921    ///
7922    /// # Example
7923    /// ```ignore,no_run
7924    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7925    /// use wkt::Timestamp;
7926    /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
7927    /// ```
7928    pub fn set_create_time<T>(mut self, v: T) -> Self
7929    where
7930        T: std::convert::Into<wkt::Timestamp>,
7931    {
7932        self.create_time = std::option::Option::Some(v.into());
7933        self
7934    }
7935
7936    /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7937    ///
7938    /// # Example
7939    /// ```ignore,no_run
7940    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7941    /// use wkt::Timestamp;
7942    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7943    /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
7944    /// ```
7945    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7946    where
7947        T: std::convert::Into<wkt::Timestamp>,
7948    {
7949        self.create_time = v.map(|x| x.into());
7950        self
7951    }
7952
7953    /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7954    ///
7955    /// # Example
7956    /// ```ignore,no_run
7957    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7958    /// use wkt::Timestamp;
7959    /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
7960    /// ```
7961    pub fn set_generate_time<T>(mut self, v: T) -> Self
7962    where
7963        T: std::convert::Into<wkt::Timestamp>,
7964    {
7965        self.generate_time = std::option::Option::Some(v.into());
7966        self
7967    }
7968
7969    /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7970    ///
7971    /// # Example
7972    /// ```ignore,no_run
7973    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7974    /// use wkt::Timestamp;
7975    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
7976    /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
7977    /// ```
7978    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
7979    where
7980        T: std::convert::Into<wkt::Timestamp>,
7981    {
7982        self.generate_time = v.map(|x| x.into());
7983        self
7984    }
7985
7986    /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7987    ///
7988    /// # Example
7989    /// ```ignore,no_run
7990    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7991    /// use wkt::Timestamp;
7992    /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
7993    /// ```
7994    pub fn set_destroy_time<T>(mut self, v: T) -> Self
7995    where
7996        T: std::convert::Into<wkt::Timestamp>,
7997    {
7998        self.destroy_time = std::option::Option::Some(v.into());
7999        self
8000    }
8001
8002    /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
8003    ///
8004    /// # Example
8005    /// ```ignore,no_run
8006    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8007    /// use wkt::Timestamp;
8008    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
8009    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
8010    /// ```
8011    pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
8012    where
8013        T: std::convert::Into<wkt::Timestamp>,
8014    {
8015        self.destroy_time = v.map(|x| x.into());
8016        self
8017    }
8018
8019    /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
8020    ///
8021    /// # Example
8022    /// ```ignore,no_run
8023    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8024    /// use wkt::Timestamp;
8025    /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
8026    /// ```
8027    pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
8028    where
8029        T: std::convert::Into<wkt::Timestamp>,
8030    {
8031        self.destroy_event_time = std::option::Option::Some(v.into());
8032        self
8033    }
8034
8035    /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
8036    ///
8037    /// # Example
8038    /// ```ignore,no_run
8039    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8040    /// use wkt::Timestamp;
8041    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
8042    /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
8043    /// ```
8044    pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
8045    where
8046        T: std::convert::Into<wkt::Timestamp>,
8047    {
8048        self.destroy_event_time = v.map(|x| x.into());
8049        self
8050    }
8051
8052    /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
8053    ///
8054    /// # Example
8055    /// ```ignore,no_run
8056    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8057    /// let x = CryptoKeyVersion::new().set_import_job("example");
8058    /// ```
8059    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8060        self.import_job = v.into();
8061        self
8062    }
8063
8064    /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
8065    ///
8066    /// # Example
8067    /// ```ignore,no_run
8068    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8069    /// use wkt::Timestamp;
8070    /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
8071    /// ```
8072    pub fn set_import_time<T>(mut self, v: T) -> Self
8073    where
8074        T: std::convert::Into<wkt::Timestamp>,
8075    {
8076        self.import_time = std::option::Option::Some(v.into());
8077        self
8078    }
8079
8080    /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
8081    ///
8082    /// # Example
8083    /// ```ignore,no_run
8084    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8085    /// use wkt::Timestamp;
8086    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
8087    /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
8088    /// ```
8089    pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
8090    where
8091        T: std::convert::Into<wkt::Timestamp>,
8092    {
8093        self.import_time = v.map(|x| x.into());
8094        self
8095    }
8096
8097    /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
8098    ///
8099    /// # Example
8100    /// ```ignore,no_run
8101    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8102    /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
8103    /// ```
8104    pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
8105        mut self,
8106        v: T,
8107    ) -> Self {
8108        self.import_failure_reason = v.into();
8109        self
8110    }
8111
8112    /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
8113    ///
8114    /// # Example
8115    /// ```ignore,no_run
8116    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8117    /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
8118    /// ```
8119    pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
8120        mut self,
8121        v: T,
8122    ) -> Self {
8123        self.generation_failure_reason = v.into();
8124        self
8125    }
8126
8127    /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
8128    ///
8129    /// # Example
8130    /// ```ignore,no_run
8131    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8132    /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
8133    /// ```
8134    pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
8135        mut self,
8136        v: T,
8137    ) -> Self {
8138        self.external_destruction_failure_reason = v.into();
8139        self
8140    }
8141
8142    /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8143    ///
8144    /// # Example
8145    /// ```ignore,no_run
8146    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8147    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8148    /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
8149    /// ```
8150    pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
8151    where
8152        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8153    {
8154        self.external_protection_level_options = std::option::Option::Some(v.into());
8155        self
8156    }
8157
8158    /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8159    ///
8160    /// # Example
8161    /// ```ignore,no_run
8162    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8163    /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8164    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
8165    /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
8166    /// ```
8167    pub fn set_or_clear_external_protection_level_options<T>(
8168        mut self,
8169        v: std::option::Option<T>,
8170    ) -> Self
8171    where
8172        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8173    {
8174        self.external_protection_level_options = v.map(|x| x.into());
8175        self
8176    }
8177
8178    /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
8179    ///
8180    /// # Example
8181    /// ```ignore,no_run
8182    /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8183    /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
8184    /// ```
8185    pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8186        self.reimport_eligible = v.into();
8187        self
8188    }
8189}
8190
8191impl wkt::message::Message for CryptoKeyVersion {
8192    fn typename() -> &'static str {
8193        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
8194    }
8195}
8196
8197/// Defines additional types related to [CryptoKeyVersion].
8198pub mod crypto_key_version {
8199    #[allow(unused_imports)]
8200    use super::*;
8201
8202    /// The algorithm of the
8203    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
8204    /// parameters must be used for each cryptographic operation.
8205    ///
8206    /// The
8207    /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
8208    /// algorithm is usable with
8209    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8210    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
8211    ///
8212    /// Algorithms beginning with `RSA_SIGN_` are usable with
8213    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8214    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8215    ///
8216    /// The fields in the name after `RSA_SIGN_` correspond to the following
8217    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8218    ///
8219    /// For PSS, the salt length used is equal to the length of digest
8220    /// algorithm. For example,
8221    /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
8222    /// will use PSS with a salt length of 256 bits or 32 bytes.
8223    ///
8224    /// Algorithms beginning with `RSA_DECRYPT_` are usable with
8225    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8226    /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
8227    ///
8228    /// The fields in the name after `RSA_DECRYPT_` correspond to the following
8229    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8230    ///
8231    /// Algorithms beginning with `EC_SIGN_` are usable with
8232    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8233    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8234    ///
8235    /// The fields in the name after `EC_SIGN_` correspond to the following
8236    /// parameters: elliptic curve, digest algorithm.
8237    ///
8238    /// Algorithms beginning with `HMAC_` are usable with
8239    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8240    /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
8241    ///
8242    /// The suffix following `HMAC_` corresponds to the hash algorithm being used
8243    /// (eg. SHA256).
8244    ///
8245    /// Algorithms beginning with `PQ_` are post-quantum.
8246    ///
8247    /// For more information, see [Key purposes and algorithms]
8248    /// (<https://cloud.google.com/kms/docs/algorithms>).
8249    ///
8250    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
8251    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
8252    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
8253    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
8254    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
8255    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8256    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
8257    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
8258    ///
8259    /// # Working with unknown values
8260    ///
8261    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8262    /// additional enum variants at any time. Adding new variants is not considered
8263    /// a breaking change. Applications should write their code in anticipation of:
8264    ///
8265    /// - New values appearing in future releases of the client library, **and**
8266    /// - New values received dynamically, without application changes.
8267    ///
8268    /// Please consult the [Working with enums] section in the user guide for some
8269    /// guidelines.
8270    ///
8271    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8272    #[derive(Clone, Debug, PartialEq)]
8273    #[non_exhaustive]
8274    pub enum CryptoKeyVersionAlgorithm {
8275        /// Not specified.
8276        Unspecified,
8277        /// Creates symmetric encryption keys.
8278        GoogleSymmetricEncryption,
8279        /// AES-GCM (Galois Counter Mode) using 128-bit keys.
8280        Aes128Gcm,
8281        /// AES-GCM (Galois Counter Mode) using 256-bit keys.
8282        Aes256Gcm,
8283        /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
8284        Aes128Cbc,
8285        /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
8286        Aes256Cbc,
8287        /// AES-CTR (Counter Mode) using 128-bit keys.
8288        Aes128Ctr,
8289        /// AES-CTR (Counter Mode) using 256-bit keys.
8290        Aes256Ctr,
8291        /// RSASSA-PSS 2048 bit key with a SHA256 digest.
8292        RsaSignPss2048Sha256,
8293        /// RSASSA-PSS 3072 bit key with a SHA256 digest.
8294        RsaSignPss3072Sha256,
8295        /// RSASSA-PSS 4096 bit key with a SHA256 digest.
8296        RsaSignPss4096Sha256,
8297        /// RSASSA-PSS 4096 bit key with a SHA512 digest.
8298        RsaSignPss4096Sha512,
8299        /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
8300        RsaSignPkcs12048Sha256,
8301        /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
8302        RsaSignPkcs13072Sha256,
8303        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
8304        RsaSignPkcs14096Sha256,
8305        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
8306        RsaSignPkcs14096Sha512,
8307        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
8308        RsaSignRawPkcs12048,
8309        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
8310        RsaSignRawPkcs13072,
8311        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
8312        RsaSignRawPkcs14096,
8313        /// RSAES-OAEP 2048 bit key with a SHA256 digest.
8314        RsaDecryptOaep2048Sha256,
8315        /// RSAES-OAEP 3072 bit key with a SHA256 digest.
8316        RsaDecryptOaep3072Sha256,
8317        /// RSAES-OAEP 4096 bit key with a SHA256 digest.
8318        RsaDecryptOaep4096Sha256,
8319        /// RSAES-OAEP 4096 bit key with a SHA512 digest.
8320        RsaDecryptOaep4096Sha512,
8321        /// RSAES-OAEP 2048 bit key with a SHA1 digest.
8322        RsaDecryptOaep2048Sha1,
8323        /// RSAES-OAEP 3072 bit key with a SHA1 digest.
8324        RsaDecryptOaep3072Sha1,
8325        /// RSAES-OAEP 4096 bit key with a SHA1 digest.
8326        RsaDecryptOaep4096Sha1,
8327        /// ECDSA on the NIST P-256 curve with a SHA256 digest.
8328        /// Other hash functions can also be used:
8329        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8330        EcSignP256Sha256,
8331        /// ECDSA on the NIST P-384 curve with a SHA384 digest.
8332        /// Other hash functions can also be used:
8333        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8334        EcSignP384Sha384,
8335        /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
8336        /// HSM protection level.
8337        /// Other hash functions can also be used:
8338        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8339        EcSignSecp256K1Sha256,
8340        /// EdDSA on the Curve25519 in pure mode (taking data as input).
8341        EcSignEd25519,
8342        /// HMAC-SHA256 signing with a 256 bit key.
8343        HmacSha256,
8344        /// HMAC-SHA1 signing with a 160 bit key.
8345        HmacSha1,
8346        /// HMAC-SHA384 signing with a 384 bit key.
8347        HmacSha384,
8348        /// HMAC-SHA512 signing with a 512 bit key.
8349        HmacSha512,
8350        /// HMAC-SHA224 signing with a 224 bit key.
8351        HmacSha224,
8352        /// Algorithm representing symmetric encryption by an external key manager.
8353        ExternalSymmetricEncryption,
8354        /// ML-KEM-768 (FIPS 203)
8355        MlKem768,
8356        /// ML-KEM-1024 (FIPS 203)
8357        MlKem1024,
8358        /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
8359        /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8360        KemXwing,
8361        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8362        /// security level 1. Randomized version.
8363        PqSignMlDsa44,
8364        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8365        /// security level 3. Randomized version.
8366        PqSignMlDsa65,
8367        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8368        /// security level 5. Randomized version.
8369        PqSignMlDsa87,
8370        /// The post-quantum stateless hash-based digital signature algorithm, at
8371        /// security level 1. Randomized version.
8372        PqSignSlhDsaSha2128S,
8373        /// The post-quantum stateless hash-based digital signature algorithm, at
8374        /// security level 1. Randomized pre-hash version supporting SHA256 digests.
8375        PqSignHashSlhDsaSha2128SSha256,
8376        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8377        /// security level 1. Randomized version supporting externally-computed
8378        /// message representatives.
8379        PqSignMlDsa44ExternalMu,
8380        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8381        /// security level 3. Randomized version supporting externally-computed
8382        /// message representatives.
8383        PqSignMlDsa65ExternalMu,
8384        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8385        /// security level 5. Randomized version supporting externally-computed
8386        /// message representatives.
8387        PqSignMlDsa87ExternalMu,
8388        /// If set, the enum was initialized with an unknown value.
8389        ///
8390        /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8391        /// [CryptoKeyVersionAlgorithm::name].
8392        UnknownValue(crypto_key_version_algorithm::UnknownValue),
8393    }
8394
8395    #[doc(hidden)]
8396    pub mod crypto_key_version_algorithm {
8397        #[allow(unused_imports)]
8398        use super::*;
8399        #[derive(Clone, Debug, PartialEq)]
8400        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8401    }
8402
8403    impl CryptoKeyVersionAlgorithm {
8404        /// Gets the enum value.
8405        ///
8406        /// Returns `None` if the enum contains an unknown value deserialized from
8407        /// the string representation of enums.
8408        pub fn value(&self) -> std::option::Option<i32> {
8409            match self {
8410                Self::Unspecified => std::option::Option::Some(0),
8411                Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8412                Self::Aes128Gcm => std::option::Option::Some(41),
8413                Self::Aes256Gcm => std::option::Option::Some(19),
8414                Self::Aes128Cbc => std::option::Option::Some(42),
8415                Self::Aes256Cbc => std::option::Option::Some(43),
8416                Self::Aes128Ctr => std::option::Option::Some(44),
8417                Self::Aes256Ctr => std::option::Option::Some(45),
8418                Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8419                Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8420                Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8421                Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8422                Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8423                Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8424                Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8425                Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8426                Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8427                Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8428                Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8429                Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8430                Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8431                Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8432                Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8433                Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8434                Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8435                Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8436                Self::EcSignP256Sha256 => std::option::Option::Some(12),
8437                Self::EcSignP384Sha384 => std::option::Option::Some(13),
8438                Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8439                Self::EcSignEd25519 => std::option::Option::Some(40),
8440                Self::HmacSha256 => std::option::Option::Some(32),
8441                Self::HmacSha1 => std::option::Option::Some(33),
8442                Self::HmacSha384 => std::option::Option::Some(34),
8443                Self::HmacSha512 => std::option::Option::Some(35),
8444                Self::HmacSha224 => std::option::Option::Some(36),
8445                Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8446                Self::MlKem768 => std::option::Option::Some(47),
8447                Self::MlKem1024 => std::option::Option::Some(48),
8448                Self::KemXwing => std::option::Option::Some(63),
8449                Self::PqSignMlDsa44 => std::option::Option::Some(68),
8450                Self::PqSignMlDsa65 => std::option::Option::Some(56),
8451                Self::PqSignMlDsa87 => std::option::Option::Some(69),
8452                Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8453                Self::PqSignHashSlhDsaSha2128SSha256 => std::option::Option::Some(60),
8454                Self::PqSignMlDsa44ExternalMu => std::option::Option::Some(70),
8455                Self::PqSignMlDsa65ExternalMu => std::option::Option::Some(67),
8456                Self::PqSignMlDsa87ExternalMu => std::option::Option::Some(71),
8457                Self::UnknownValue(u) => u.0.value(),
8458            }
8459        }
8460
8461        /// Gets the enum value as a string.
8462        ///
8463        /// Returns `None` if the enum contains an unknown value deserialized from
8464        /// the integer representation of enums.
8465        pub fn name(&self) -> std::option::Option<&str> {
8466            match self {
8467                Self::Unspecified => {
8468                    std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8469                }
8470                Self::GoogleSymmetricEncryption => {
8471                    std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8472                }
8473                Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8474                Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8475                Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8476                Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8477                Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8478                Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8479                Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8480                Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8481                Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8482                Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8483                Self::RsaSignPkcs12048Sha256 => {
8484                    std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8485                }
8486                Self::RsaSignPkcs13072Sha256 => {
8487                    std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8488                }
8489                Self::RsaSignPkcs14096Sha256 => {
8490                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8491                }
8492                Self::RsaSignPkcs14096Sha512 => {
8493                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8494                }
8495                Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8496                Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8497                Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8498                Self::RsaDecryptOaep2048Sha256 => {
8499                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8500                }
8501                Self::RsaDecryptOaep3072Sha256 => {
8502                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8503                }
8504                Self::RsaDecryptOaep4096Sha256 => {
8505                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8506                }
8507                Self::RsaDecryptOaep4096Sha512 => {
8508                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8509                }
8510                Self::RsaDecryptOaep2048Sha1 => {
8511                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8512                }
8513                Self::RsaDecryptOaep3072Sha1 => {
8514                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8515                }
8516                Self::RsaDecryptOaep4096Sha1 => {
8517                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8518                }
8519                Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8520                Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8521                Self::EcSignSecp256K1Sha256 => {
8522                    std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8523                }
8524                Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8525                Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8526                Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8527                Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8528                Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8529                Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8530                Self::ExternalSymmetricEncryption => {
8531                    std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8532                }
8533                Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8534                Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8535                Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8536                Self::PqSignMlDsa44 => std::option::Option::Some("PQ_SIGN_ML_DSA_44"),
8537                Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8538                Self::PqSignMlDsa87 => std::option::Option::Some("PQ_SIGN_ML_DSA_87"),
8539                Self::PqSignSlhDsaSha2128S => {
8540                    std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8541                }
8542                Self::PqSignHashSlhDsaSha2128SSha256 => {
8543                    std::option::Option::Some("PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256")
8544                }
8545                Self::PqSignMlDsa44ExternalMu => {
8546                    std::option::Option::Some("PQ_SIGN_ML_DSA_44_EXTERNAL_MU")
8547                }
8548                Self::PqSignMlDsa65ExternalMu => {
8549                    std::option::Option::Some("PQ_SIGN_ML_DSA_65_EXTERNAL_MU")
8550                }
8551                Self::PqSignMlDsa87ExternalMu => {
8552                    std::option::Option::Some("PQ_SIGN_ML_DSA_87_EXTERNAL_MU")
8553                }
8554                Self::UnknownValue(u) => u.0.name(),
8555            }
8556        }
8557    }
8558
8559    impl std::default::Default for CryptoKeyVersionAlgorithm {
8560        fn default() -> Self {
8561            use std::convert::From;
8562            Self::from(0)
8563        }
8564    }
8565
8566    impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8567        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8568            wkt::internal::display_enum(f, self.name(), self.value())
8569        }
8570    }
8571
8572    impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8573        fn from(value: i32) -> Self {
8574            match value {
8575                0 => Self::Unspecified,
8576                1 => Self::GoogleSymmetricEncryption,
8577                2 => Self::RsaSignPss2048Sha256,
8578                3 => Self::RsaSignPss3072Sha256,
8579                4 => Self::RsaSignPss4096Sha256,
8580                5 => Self::RsaSignPkcs12048Sha256,
8581                6 => Self::RsaSignPkcs13072Sha256,
8582                7 => Self::RsaSignPkcs14096Sha256,
8583                8 => Self::RsaDecryptOaep2048Sha256,
8584                9 => Self::RsaDecryptOaep3072Sha256,
8585                10 => Self::RsaDecryptOaep4096Sha256,
8586                12 => Self::EcSignP256Sha256,
8587                13 => Self::EcSignP384Sha384,
8588                15 => Self::RsaSignPss4096Sha512,
8589                16 => Self::RsaSignPkcs14096Sha512,
8590                17 => Self::RsaDecryptOaep4096Sha512,
8591                18 => Self::ExternalSymmetricEncryption,
8592                19 => Self::Aes256Gcm,
8593                28 => Self::RsaSignRawPkcs12048,
8594                29 => Self::RsaSignRawPkcs13072,
8595                30 => Self::RsaSignRawPkcs14096,
8596                31 => Self::EcSignSecp256K1Sha256,
8597                32 => Self::HmacSha256,
8598                33 => Self::HmacSha1,
8599                34 => Self::HmacSha384,
8600                35 => Self::HmacSha512,
8601                36 => Self::HmacSha224,
8602                37 => Self::RsaDecryptOaep2048Sha1,
8603                38 => Self::RsaDecryptOaep3072Sha1,
8604                39 => Self::RsaDecryptOaep4096Sha1,
8605                40 => Self::EcSignEd25519,
8606                41 => Self::Aes128Gcm,
8607                42 => Self::Aes128Cbc,
8608                43 => Self::Aes256Cbc,
8609                44 => Self::Aes128Ctr,
8610                45 => Self::Aes256Ctr,
8611                47 => Self::MlKem768,
8612                48 => Self::MlKem1024,
8613                56 => Self::PqSignMlDsa65,
8614                57 => Self::PqSignSlhDsaSha2128S,
8615                60 => Self::PqSignHashSlhDsaSha2128SSha256,
8616                63 => Self::KemXwing,
8617                67 => Self::PqSignMlDsa65ExternalMu,
8618                68 => Self::PqSignMlDsa44,
8619                69 => Self::PqSignMlDsa87,
8620                70 => Self::PqSignMlDsa44ExternalMu,
8621                71 => Self::PqSignMlDsa87ExternalMu,
8622                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8623                    wkt::internal::UnknownEnumValue::Integer(value),
8624                )),
8625            }
8626        }
8627    }
8628
8629    impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8630        fn from(value: &str) -> Self {
8631            use std::string::ToString;
8632            match value {
8633                "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8634                "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8635                "AES_128_GCM" => Self::Aes128Gcm,
8636                "AES_256_GCM" => Self::Aes256Gcm,
8637                "AES_128_CBC" => Self::Aes128Cbc,
8638                "AES_256_CBC" => Self::Aes256Cbc,
8639                "AES_128_CTR" => Self::Aes128Ctr,
8640                "AES_256_CTR" => Self::Aes256Ctr,
8641                "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8642                "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8643                "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8644                "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8645                "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8646                "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8647                "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8648                "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8649                "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8650                "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8651                "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8652                "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8653                "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8654                "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8655                "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8656                "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8657                "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8658                "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8659                "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8660                "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8661                "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8662                "EC_SIGN_ED25519" => Self::EcSignEd25519,
8663                "HMAC_SHA256" => Self::HmacSha256,
8664                "HMAC_SHA1" => Self::HmacSha1,
8665                "HMAC_SHA384" => Self::HmacSha384,
8666                "HMAC_SHA512" => Self::HmacSha512,
8667                "HMAC_SHA224" => Self::HmacSha224,
8668                "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8669                "ML_KEM_768" => Self::MlKem768,
8670                "ML_KEM_1024" => Self::MlKem1024,
8671                "KEM_XWING" => Self::KemXwing,
8672                "PQ_SIGN_ML_DSA_44" => Self::PqSignMlDsa44,
8673                "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8674                "PQ_SIGN_ML_DSA_87" => Self::PqSignMlDsa87,
8675                "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8676                "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256" => Self::PqSignHashSlhDsaSha2128SSha256,
8677                "PQ_SIGN_ML_DSA_44_EXTERNAL_MU" => Self::PqSignMlDsa44ExternalMu,
8678                "PQ_SIGN_ML_DSA_65_EXTERNAL_MU" => Self::PqSignMlDsa65ExternalMu,
8679                "PQ_SIGN_ML_DSA_87_EXTERNAL_MU" => Self::PqSignMlDsa87ExternalMu,
8680                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8681                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8682                )),
8683            }
8684        }
8685    }
8686
8687    impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8688        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8689        where
8690            S: serde::Serializer,
8691        {
8692            match self {
8693                Self::Unspecified => serializer.serialize_i32(0),
8694                Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8695                Self::Aes128Gcm => serializer.serialize_i32(41),
8696                Self::Aes256Gcm => serializer.serialize_i32(19),
8697                Self::Aes128Cbc => serializer.serialize_i32(42),
8698                Self::Aes256Cbc => serializer.serialize_i32(43),
8699                Self::Aes128Ctr => serializer.serialize_i32(44),
8700                Self::Aes256Ctr => serializer.serialize_i32(45),
8701                Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8702                Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8703                Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8704                Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8705                Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8706                Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8707                Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8708                Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8709                Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8710                Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8711                Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8712                Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8713                Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8714                Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8715                Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8716                Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8717                Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8718                Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8719                Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8720                Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8721                Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8722                Self::EcSignEd25519 => serializer.serialize_i32(40),
8723                Self::HmacSha256 => serializer.serialize_i32(32),
8724                Self::HmacSha1 => serializer.serialize_i32(33),
8725                Self::HmacSha384 => serializer.serialize_i32(34),
8726                Self::HmacSha512 => serializer.serialize_i32(35),
8727                Self::HmacSha224 => serializer.serialize_i32(36),
8728                Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8729                Self::MlKem768 => serializer.serialize_i32(47),
8730                Self::MlKem1024 => serializer.serialize_i32(48),
8731                Self::KemXwing => serializer.serialize_i32(63),
8732                Self::PqSignMlDsa44 => serializer.serialize_i32(68),
8733                Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8734                Self::PqSignMlDsa87 => serializer.serialize_i32(69),
8735                Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8736                Self::PqSignHashSlhDsaSha2128SSha256 => serializer.serialize_i32(60),
8737                Self::PqSignMlDsa44ExternalMu => serializer.serialize_i32(70),
8738                Self::PqSignMlDsa65ExternalMu => serializer.serialize_i32(67),
8739                Self::PqSignMlDsa87ExternalMu => serializer.serialize_i32(71),
8740                Self::UnknownValue(u) => u.0.serialize(serializer),
8741            }
8742        }
8743    }
8744
8745    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8746        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8747        where
8748            D: serde::Deserializer<'de>,
8749        {
8750            deserializer.deserialize_any(
8751                wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8752                    ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8753                ),
8754            )
8755        }
8756    }
8757
8758    /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8759    /// indicating if it can be used.
8760    ///
8761    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8762    ///
8763    /// # Working with unknown values
8764    ///
8765    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8766    /// additional enum variants at any time. Adding new variants is not considered
8767    /// a breaking change. Applications should write their code in anticipation of:
8768    ///
8769    /// - New values appearing in future releases of the client library, **and**
8770    /// - New values received dynamically, without application changes.
8771    ///
8772    /// Please consult the [Working with enums] section in the user guide for some
8773    /// guidelines.
8774    ///
8775    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8776    #[derive(Clone, Debug, PartialEq)]
8777    #[non_exhaustive]
8778    pub enum CryptoKeyVersionState {
8779        /// Not specified.
8780        Unspecified,
8781        /// This version is still being generated. It may not be used, enabled,
8782        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8783        /// version
8784        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8785        /// as soon as the version is ready.
8786        ///
8787        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8788        PendingGeneration,
8789        /// This version may be used for cryptographic operations.
8790        Enabled,
8791        /// This version may not be used, but the key material is still available,
8792        /// and the version can be placed back into the
8793        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8794        /// state.
8795        ///
8796        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8797        Disabled,
8798        /// The key material of this version is destroyed and no longer stored.
8799        /// This version may only become
8800        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8801        /// again if this version is
8802        /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8803        /// and the original key material is reimported with a call to
8804        /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8805        ///
8806        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8807        /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
8808        /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8809        Destroyed,
8810        /// This version is scheduled for destruction, and will be destroyed soon.
8811        /// Call
8812        /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
8813        /// to put it back into the
8814        /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
8815        /// state.
8816        ///
8817        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
8818        /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8819        DestroyScheduled,
8820        /// This version is still being imported. It may not be used, enabled,
8821        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8822        /// version
8823        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8824        /// as soon as the version is ready.
8825        ///
8826        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8827        PendingImport,
8828        /// This version was not imported successfully. It may not be used, enabled,
8829        /// disabled, or destroyed. The submitted key material has been discarded.
8830        /// Additional details can be found in
8831        /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
8832        ///
8833        /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
8834        ImportFailed,
8835        /// This version was not generated successfully. It may not be used, enabled,
8836        /// disabled, or destroyed. Additional details can be found in
8837        /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
8838        ///
8839        /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
8840        GenerationFailed,
8841        /// This version was destroyed, and it may not be used or enabled again.
8842        /// Cloud KMS is waiting for the corresponding key material residing in an
8843        /// external key manager to be destroyed.
8844        PendingExternalDestruction,
8845        /// This version was destroyed, and it may not be used or enabled again.
8846        /// However, Cloud KMS could not confirm that the corresponding key material
8847        /// residing in an external key manager was destroyed. Additional details can
8848        /// be found in
8849        /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
8850        ///
8851        /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
8852        ExternalDestructionFailed,
8853        /// If set, the enum was initialized with an unknown value.
8854        ///
8855        /// Applications can examine the value using [CryptoKeyVersionState::value] or
8856        /// [CryptoKeyVersionState::name].
8857        UnknownValue(crypto_key_version_state::UnknownValue),
8858    }
8859
8860    #[doc(hidden)]
8861    pub mod crypto_key_version_state {
8862        #[allow(unused_imports)]
8863        use super::*;
8864        #[derive(Clone, Debug, PartialEq)]
8865        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8866    }
8867
8868    impl CryptoKeyVersionState {
8869        /// Gets the enum value.
8870        ///
8871        /// Returns `None` if the enum contains an unknown value deserialized from
8872        /// the string representation of enums.
8873        pub fn value(&self) -> std::option::Option<i32> {
8874            match self {
8875                Self::Unspecified => std::option::Option::Some(0),
8876                Self::PendingGeneration => std::option::Option::Some(5),
8877                Self::Enabled => std::option::Option::Some(1),
8878                Self::Disabled => std::option::Option::Some(2),
8879                Self::Destroyed => std::option::Option::Some(3),
8880                Self::DestroyScheduled => std::option::Option::Some(4),
8881                Self::PendingImport => std::option::Option::Some(6),
8882                Self::ImportFailed => std::option::Option::Some(7),
8883                Self::GenerationFailed => std::option::Option::Some(8),
8884                Self::PendingExternalDestruction => std::option::Option::Some(9),
8885                Self::ExternalDestructionFailed => std::option::Option::Some(10),
8886                Self::UnknownValue(u) => u.0.value(),
8887            }
8888        }
8889
8890        /// Gets the enum value as a string.
8891        ///
8892        /// Returns `None` if the enum contains an unknown value deserialized from
8893        /// the integer representation of enums.
8894        pub fn name(&self) -> std::option::Option<&str> {
8895            match self {
8896                Self::Unspecified => {
8897                    std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
8898                }
8899                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
8900                Self::Enabled => std::option::Option::Some("ENABLED"),
8901                Self::Disabled => std::option::Option::Some("DISABLED"),
8902                Self::Destroyed => std::option::Option::Some("DESTROYED"),
8903                Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
8904                Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
8905                Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
8906                Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
8907                Self::PendingExternalDestruction => {
8908                    std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
8909                }
8910                Self::ExternalDestructionFailed => {
8911                    std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
8912                }
8913                Self::UnknownValue(u) => u.0.name(),
8914            }
8915        }
8916    }
8917
8918    impl std::default::Default for CryptoKeyVersionState {
8919        fn default() -> Self {
8920            use std::convert::From;
8921            Self::from(0)
8922        }
8923    }
8924
8925    impl std::fmt::Display for CryptoKeyVersionState {
8926        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8927            wkt::internal::display_enum(f, self.name(), self.value())
8928        }
8929    }
8930
8931    impl std::convert::From<i32> for CryptoKeyVersionState {
8932        fn from(value: i32) -> Self {
8933            match value {
8934                0 => Self::Unspecified,
8935                1 => Self::Enabled,
8936                2 => Self::Disabled,
8937                3 => Self::Destroyed,
8938                4 => Self::DestroyScheduled,
8939                5 => Self::PendingGeneration,
8940                6 => Self::PendingImport,
8941                7 => Self::ImportFailed,
8942                8 => Self::GenerationFailed,
8943                9 => Self::PendingExternalDestruction,
8944                10 => Self::ExternalDestructionFailed,
8945                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8946                    wkt::internal::UnknownEnumValue::Integer(value),
8947                )),
8948            }
8949        }
8950    }
8951
8952    impl std::convert::From<&str> for CryptoKeyVersionState {
8953        fn from(value: &str) -> Self {
8954            use std::string::ToString;
8955            match value {
8956                "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
8957                "PENDING_GENERATION" => Self::PendingGeneration,
8958                "ENABLED" => Self::Enabled,
8959                "DISABLED" => Self::Disabled,
8960                "DESTROYED" => Self::Destroyed,
8961                "DESTROY_SCHEDULED" => Self::DestroyScheduled,
8962                "PENDING_IMPORT" => Self::PendingImport,
8963                "IMPORT_FAILED" => Self::ImportFailed,
8964                "GENERATION_FAILED" => Self::GenerationFailed,
8965                "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
8966                "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
8967                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8968                    wkt::internal::UnknownEnumValue::String(value.to_string()),
8969                )),
8970            }
8971        }
8972    }
8973
8974    impl serde::ser::Serialize for CryptoKeyVersionState {
8975        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8976        where
8977            S: serde::Serializer,
8978        {
8979            match self {
8980                Self::Unspecified => serializer.serialize_i32(0),
8981                Self::PendingGeneration => serializer.serialize_i32(5),
8982                Self::Enabled => serializer.serialize_i32(1),
8983                Self::Disabled => serializer.serialize_i32(2),
8984                Self::Destroyed => serializer.serialize_i32(3),
8985                Self::DestroyScheduled => serializer.serialize_i32(4),
8986                Self::PendingImport => serializer.serialize_i32(6),
8987                Self::ImportFailed => serializer.serialize_i32(7),
8988                Self::GenerationFailed => serializer.serialize_i32(8),
8989                Self::PendingExternalDestruction => serializer.serialize_i32(9),
8990                Self::ExternalDestructionFailed => serializer.serialize_i32(10),
8991                Self::UnknownValue(u) => u.0.serialize(serializer),
8992            }
8993        }
8994    }
8995
8996    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
8997        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8998        where
8999            D: serde::Deserializer<'de>,
9000        {
9001            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
9002                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
9003            ))
9004        }
9005    }
9006
9007    /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
9008    /// Controls the level of detail returned for
9009    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
9010    /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
9011    /// and
9012    /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
9013    ///
9014    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9015    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
9016    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
9017    ///
9018    /// # Working with unknown values
9019    ///
9020    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9021    /// additional enum variants at any time. Adding new variants is not considered
9022    /// a breaking change. Applications should write their code in anticipation of:
9023    ///
9024    /// - New values appearing in future releases of the client library, **and**
9025    /// - New values received dynamically, without application changes.
9026    ///
9027    /// Please consult the [Working with enums] section in the user guide for some
9028    /// guidelines.
9029    ///
9030    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9031    #[derive(Clone, Debug, PartialEq)]
9032    #[non_exhaustive]
9033    pub enum CryptoKeyVersionView {
9034        /// Default view for each
9035        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
9036        /// include the
9037        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
9038        ///
9039        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9040        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
9041        Unspecified,
9042        /// Provides all fields in each
9043        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
9044        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
9045        ///
9046        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9047        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
9048        Full,
9049        /// If set, the enum was initialized with an unknown value.
9050        ///
9051        /// Applications can examine the value using [CryptoKeyVersionView::value] or
9052        /// [CryptoKeyVersionView::name].
9053        UnknownValue(crypto_key_version_view::UnknownValue),
9054    }
9055
9056    #[doc(hidden)]
9057    pub mod crypto_key_version_view {
9058        #[allow(unused_imports)]
9059        use super::*;
9060        #[derive(Clone, Debug, PartialEq)]
9061        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9062    }
9063
9064    impl CryptoKeyVersionView {
9065        /// Gets the enum value.
9066        ///
9067        /// Returns `None` if the enum contains an unknown value deserialized from
9068        /// the string representation of enums.
9069        pub fn value(&self) -> std::option::Option<i32> {
9070            match self {
9071                Self::Unspecified => std::option::Option::Some(0),
9072                Self::Full => std::option::Option::Some(1),
9073                Self::UnknownValue(u) => u.0.value(),
9074            }
9075        }
9076
9077        /// Gets the enum value as a string.
9078        ///
9079        /// Returns `None` if the enum contains an unknown value deserialized from
9080        /// the integer representation of enums.
9081        pub fn name(&self) -> std::option::Option<&str> {
9082            match self {
9083                Self::Unspecified => {
9084                    std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
9085                }
9086                Self::Full => std::option::Option::Some("FULL"),
9087                Self::UnknownValue(u) => u.0.name(),
9088            }
9089        }
9090    }
9091
9092    impl std::default::Default for CryptoKeyVersionView {
9093        fn default() -> Self {
9094            use std::convert::From;
9095            Self::from(0)
9096        }
9097    }
9098
9099    impl std::fmt::Display for CryptoKeyVersionView {
9100        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9101            wkt::internal::display_enum(f, self.name(), self.value())
9102        }
9103    }
9104
9105    impl std::convert::From<i32> for CryptoKeyVersionView {
9106        fn from(value: i32) -> Self {
9107            match value {
9108                0 => Self::Unspecified,
9109                1 => Self::Full,
9110                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9111                    wkt::internal::UnknownEnumValue::Integer(value),
9112                )),
9113            }
9114        }
9115    }
9116
9117    impl std::convert::From<&str> for CryptoKeyVersionView {
9118        fn from(value: &str) -> Self {
9119            use std::string::ToString;
9120            match value {
9121                "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
9122                "FULL" => Self::Full,
9123                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9124                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9125                )),
9126            }
9127        }
9128    }
9129
9130    impl serde::ser::Serialize for CryptoKeyVersionView {
9131        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9132        where
9133            S: serde::Serializer,
9134        {
9135            match self {
9136                Self::Unspecified => serializer.serialize_i32(0),
9137                Self::Full => serializer.serialize_i32(1),
9138                Self::UnknownValue(u) => u.0.serialize(serializer),
9139            }
9140        }
9141    }
9142
9143    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
9144        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9145        where
9146            D: serde::Deserializer<'de>,
9147        {
9148            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
9149                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
9150            ))
9151        }
9152    }
9153}
9154
9155/// Data with integrity verification field.
9156#[derive(Clone, Default, PartialEq)]
9157#[non_exhaustive]
9158pub struct ChecksummedData {
9159    /// Raw Data.
9160    pub data: ::bytes::Bytes,
9161
9162    /// Integrity verification field. A CRC32C
9163    /// checksum of the returned
9164    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
9165    /// integrity check of
9166    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
9167    /// performed by computing the CRC32C checksum of
9168    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
9169    /// comparing your results to this field. Discard the response in case of
9170    /// non-matching checksum values, and perform a limited number of retries. A
9171    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9172    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9173    /// across different languages. However, it is a non-negative integer, which
9174    /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
9175    /// languages that support this type.
9176    ///
9177    /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
9178    pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
9179
9180    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9181}
9182
9183impl ChecksummedData {
9184    /// Creates a new default instance.
9185    pub fn new() -> Self {
9186        std::default::Default::default()
9187    }
9188
9189    /// Sets the value of [data][crate::model::ChecksummedData::data].
9190    ///
9191    /// # Example
9192    /// ```ignore,no_run
9193    /// # use google_cloud_kms_v1::model::ChecksummedData;
9194    /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
9195    /// ```
9196    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9197        self.data = v.into();
9198        self
9199    }
9200
9201    /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9202    ///
9203    /// # Example
9204    /// ```ignore,no_run
9205    /// # use google_cloud_kms_v1::model::ChecksummedData;
9206    /// use wkt::Int64Value;
9207    /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
9208    /// ```
9209    pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
9210    where
9211        T: std::convert::Into<wkt::Int64Value>,
9212    {
9213        self.crc32c_checksum = std::option::Option::Some(v.into());
9214        self
9215    }
9216
9217    /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9218    ///
9219    /// # Example
9220    /// ```ignore,no_run
9221    /// # use google_cloud_kms_v1::model::ChecksummedData;
9222    /// use wkt::Int64Value;
9223    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
9224    /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
9225    /// ```
9226    pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
9227    where
9228        T: std::convert::Into<wkt::Int64Value>,
9229    {
9230        self.crc32c_checksum = v.map(|x| x.into());
9231        self
9232    }
9233}
9234
9235impl wkt::message::Message for ChecksummedData {
9236    fn typename() -> &'static str {
9237        "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
9238    }
9239}
9240
9241/// The public keys for a given
9242/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
9243/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
9244///
9245/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9246/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
9247#[derive(Clone, Default, PartialEq)]
9248#[non_exhaustive]
9249pub struct PublicKey {
9250    /// The public key, encoded in PEM format. For more information, see the
9251    /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
9252    /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9253    /// [Textual Encoding of Subject Public Key Info]
9254    /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9255    pub pem: std::string::String,
9256
9257    /// The
9258    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
9259    /// associated with this key.
9260    ///
9261    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
9262    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
9263
9264    /// Integrity verification field. A CRC32C checksum of the returned
9265    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
9266    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
9267    /// computing the CRC32C checksum of
9268    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
9269    /// results to this field. Discard the response in case of non-matching
9270    /// checksum values, and perform a limited number of retries. A persistent
9271    /// mismatch may indicate an issue in your computation of the CRC32C checksum.
9272    /// Note: This field is defined as int64 for reasons of compatibility across
9273    /// different languages. However, it is a non-negative integer, which will
9274    /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
9275    /// languages that support this type.
9276    ///
9277    /// NOTE: This field is in Beta.
9278    ///
9279    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9280    pub pem_crc32c: std::option::Option<wkt::Int64Value>,
9281
9282    /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
9283    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9284    /// Provided here for verification.
9285    ///
9286    /// NOTE: This field is in Beta.
9287    ///
9288    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9289    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
9290    pub name: std::string::String,
9291
9292    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9293    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9294    ///
9295    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9296    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9297    pub protection_level: crate::model::ProtectionLevel,
9298
9299    /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
9300    /// customer through the
9301    /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9302    /// field.
9303    ///
9304    /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9305    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9306    pub public_key_format: crate::model::public_key::PublicKeyFormat,
9307
9308    /// This field contains the public key (with integrity verification), formatted
9309    /// according to the
9310    /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
9311    ///
9312    /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
9313    pub public_key: std::option::Option<crate::model::ChecksummedData>,
9314
9315    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9316}
9317
9318impl PublicKey {
9319    /// Creates a new default instance.
9320    pub fn new() -> Self {
9321        std::default::Default::default()
9322    }
9323
9324    /// Sets the value of [pem][crate::model::PublicKey::pem].
9325    ///
9326    /// # Example
9327    /// ```ignore,no_run
9328    /// # use google_cloud_kms_v1::model::PublicKey;
9329    /// let x = PublicKey::new().set_pem("example");
9330    /// ```
9331    pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9332        self.pem = v.into();
9333        self
9334    }
9335
9336    /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
9337    ///
9338    /// # Example
9339    /// ```ignore,no_run
9340    /// # use google_cloud_kms_v1::model::PublicKey;
9341    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
9342    /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
9343    /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
9344    /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
9345    /// ```
9346    pub fn set_algorithm<
9347        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
9348    >(
9349        mut self,
9350        v: T,
9351    ) -> Self {
9352        self.algorithm = v.into();
9353        self
9354    }
9355
9356    /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9357    ///
9358    /// # Example
9359    /// ```ignore,no_run
9360    /// # use google_cloud_kms_v1::model::PublicKey;
9361    /// use wkt::Int64Value;
9362    /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
9363    /// ```
9364    pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
9365    where
9366        T: std::convert::Into<wkt::Int64Value>,
9367    {
9368        self.pem_crc32c = std::option::Option::Some(v.into());
9369        self
9370    }
9371
9372    /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9373    ///
9374    /// # Example
9375    /// ```ignore,no_run
9376    /// # use google_cloud_kms_v1::model::PublicKey;
9377    /// use wkt::Int64Value;
9378    /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
9379    /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
9380    /// ```
9381    pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9382    where
9383        T: std::convert::Into<wkt::Int64Value>,
9384    {
9385        self.pem_crc32c = v.map(|x| x.into());
9386        self
9387    }
9388
9389    /// Sets the value of [name][crate::model::PublicKey::name].
9390    ///
9391    /// # Example
9392    /// ```ignore,no_run
9393    /// # use google_cloud_kms_v1::model::PublicKey;
9394    /// # let project_id = "project_id";
9395    /// # let location_id = "location_id";
9396    /// # let key_ring_id = "key_ring_id";
9397    /// # let crypto_key_id = "crypto_key_id";
9398    /// # let crypto_key_version_id = "crypto_key_version_id";
9399    /// let x = PublicKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}/publicKey"));
9400    /// ```
9401    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9402        self.name = v.into();
9403        self
9404    }
9405
9406    /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
9407    ///
9408    /// # Example
9409    /// ```ignore,no_run
9410    /// # use google_cloud_kms_v1::model::PublicKey;
9411    /// use google_cloud_kms_v1::model::ProtectionLevel;
9412    /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
9413    /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
9414    /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
9415    /// ```
9416    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9417        mut self,
9418        v: T,
9419    ) -> Self {
9420        self.protection_level = v.into();
9421        self
9422    }
9423
9424    /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
9425    ///
9426    /// # Example
9427    /// ```ignore,no_run
9428    /// # use google_cloud_kms_v1::model::PublicKey;
9429    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9430    /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9431    /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9432    /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9433    /// ```
9434    pub fn set_public_key_format<
9435        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9436    >(
9437        mut self,
9438        v: T,
9439    ) -> Self {
9440        self.public_key_format = v.into();
9441        self
9442    }
9443
9444    /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9445    ///
9446    /// # Example
9447    /// ```ignore,no_run
9448    /// # use google_cloud_kms_v1::model::PublicKey;
9449    /// use google_cloud_kms_v1::model::ChecksummedData;
9450    /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9451    /// ```
9452    pub fn set_public_key<T>(mut self, v: T) -> Self
9453    where
9454        T: std::convert::Into<crate::model::ChecksummedData>,
9455    {
9456        self.public_key = std::option::Option::Some(v.into());
9457        self
9458    }
9459
9460    /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9461    ///
9462    /// # Example
9463    /// ```ignore,no_run
9464    /// # use google_cloud_kms_v1::model::PublicKey;
9465    /// use google_cloud_kms_v1::model::ChecksummedData;
9466    /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9467    /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9468    /// ```
9469    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9470    where
9471        T: std::convert::Into<crate::model::ChecksummedData>,
9472    {
9473        self.public_key = v.map(|x| x.into());
9474        self
9475    }
9476}
9477
9478impl wkt::message::Message for PublicKey {
9479    fn typename() -> &'static str {
9480        "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9481    }
9482}
9483
9484/// Defines additional types related to [PublicKey].
9485pub mod public_key {
9486    #[allow(unused_imports)]
9487    use super::*;
9488
9489    /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9490    ///
9491    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9492    ///
9493    /// # Working with unknown values
9494    ///
9495    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9496    /// additional enum variants at any time. Adding new variants is not considered
9497    /// a breaking change. Applications should write their code in anticipation of:
9498    ///
9499    /// - New values appearing in future releases of the client library, **and**
9500    /// - New values received dynamically, without application changes.
9501    ///
9502    /// Please consult the [Working with enums] section in the user guide for some
9503    /// guidelines.
9504    ///
9505    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9506    #[derive(Clone, Debug, PartialEq)]
9507    #[non_exhaustive]
9508    pub enum PublicKeyFormat {
9509        /// If the
9510        /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9511        /// field is not specified:
9512        ///
9513        /// - For PQC algorithms, an error will be returned.
9514        /// - For non-PQC algorithms, the default format is PEM, and the field
9515        ///   [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9516        ///
9517        /// Otherwise, the public key will be exported through the
9518        /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9519        /// requested format.
9520        ///
9521        /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9522        /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9523        /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9524        Unspecified,
9525        /// The returned public key will be encoded in PEM format.
9526        /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9527        /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9528        /// and [Textual Encoding of Subject Public Key Info]
9529        /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9530        Pem,
9531        /// The returned public key will be encoded in DER format (the
9532        /// PrivateKeyInfo structure from RFC 5208).
9533        Der,
9534        /// This is supported only for PQC algorithms.
9535        /// The key material is returned in the format defined by NIST PQC
9536        /// standards (FIPS 203, FIPS 204, and FIPS 205).
9537        NistPqc,
9538        /// The returned public key is in raw bytes format defined in its standard
9539        /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9540        XwingRawBytes,
9541        /// If set, the enum was initialized with an unknown value.
9542        ///
9543        /// Applications can examine the value using [PublicKeyFormat::value] or
9544        /// [PublicKeyFormat::name].
9545        UnknownValue(public_key_format::UnknownValue),
9546    }
9547
9548    #[doc(hidden)]
9549    pub mod public_key_format {
9550        #[allow(unused_imports)]
9551        use super::*;
9552        #[derive(Clone, Debug, PartialEq)]
9553        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9554    }
9555
9556    impl PublicKeyFormat {
9557        /// Gets the enum value.
9558        ///
9559        /// Returns `None` if the enum contains an unknown value deserialized from
9560        /// the string representation of enums.
9561        pub fn value(&self) -> std::option::Option<i32> {
9562            match self {
9563                Self::Unspecified => std::option::Option::Some(0),
9564                Self::Pem => std::option::Option::Some(1),
9565                Self::Der => std::option::Option::Some(2),
9566                Self::NistPqc => std::option::Option::Some(3),
9567                Self::XwingRawBytes => std::option::Option::Some(4),
9568                Self::UnknownValue(u) => u.0.value(),
9569            }
9570        }
9571
9572        /// Gets the enum value as a string.
9573        ///
9574        /// Returns `None` if the enum contains an unknown value deserialized from
9575        /// the integer representation of enums.
9576        pub fn name(&self) -> std::option::Option<&str> {
9577            match self {
9578                Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9579                Self::Pem => std::option::Option::Some("PEM"),
9580                Self::Der => std::option::Option::Some("DER"),
9581                Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9582                Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9583                Self::UnknownValue(u) => u.0.name(),
9584            }
9585        }
9586    }
9587
9588    impl std::default::Default for PublicKeyFormat {
9589        fn default() -> Self {
9590            use std::convert::From;
9591            Self::from(0)
9592        }
9593    }
9594
9595    impl std::fmt::Display for PublicKeyFormat {
9596        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9597            wkt::internal::display_enum(f, self.name(), self.value())
9598        }
9599    }
9600
9601    impl std::convert::From<i32> for PublicKeyFormat {
9602        fn from(value: i32) -> Self {
9603            match value {
9604                0 => Self::Unspecified,
9605                1 => Self::Pem,
9606                2 => Self::Der,
9607                3 => Self::NistPqc,
9608                4 => Self::XwingRawBytes,
9609                _ => Self::UnknownValue(public_key_format::UnknownValue(
9610                    wkt::internal::UnknownEnumValue::Integer(value),
9611                )),
9612            }
9613        }
9614    }
9615
9616    impl std::convert::From<&str> for PublicKeyFormat {
9617        fn from(value: &str) -> Self {
9618            use std::string::ToString;
9619            match value {
9620                "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9621                "PEM" => Self::Pem,
9622                "DER" => Self::Der,
9623                "NIST_PQC" => Self::NistPqc,
9624                "XWING_RAW_BYTES" => Self::XwingRawBytes,
9625                _ => Self::UnknownValue(public_key_format::UnknownValue(
9626                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9627                )),
9628            }
9629        }
9630    }
9631
9632    impl serde::ser::Serialize for PublicKeyFormat {
9633        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9634        where
9635            S: serde::Serializer,
9636        {
9637            match self {
9638                Self::Unspecified => serializer.serialize_i32(0),
9639                Self::Pem => serializer.serialize_i32(1),
9640                Self::Der => serializer.serialize_i32(2),
9641                Self::NistPqc => serializer.serialize_i32(3),
9642                Self::XwingRawBytes => serializer.serialize_i32(4),
9643                Self::UnknownValue(u) => u.0.serialize(serializer),
9644            }
9645        }
9646    }
9647
9648    impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9649        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9650        where
9651            D: serde::Deserializer<'de>,
9652        {
9653            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9654                ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9655            ))
9656        }
9657    }
9658}
9659
9660/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9661/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9662/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9663/// key material, generated outside of Cloud KMS.
9664///
9665/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9666/// generate a "wrapping key", which is a public/private key pair. You use the
9667/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9668/// protect it during the import process. The nature of the wrapping key depends
9669/// on the choice of
9670/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9671/// wrapping key generation is complete, the
9672/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9673/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9674/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9675/// fetched public key can then be used to wrap your pre-existing key material.
9676///
9677/// Once the key material is wrapped, it can be imported into a new
9678/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9679/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9680/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9681/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9682/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9683/// uses the private key portion of the wrapping key to unwrap the key material.
9684/// Only Cloud KMS has access to the private key.
9685///
9686/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9687/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9688/// any key material that was wrapped with the
9689/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9690///
9691/// For more information, see
9692/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9693///
9694/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9695/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9696/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9697/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9698/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9699/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9700/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9701/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9702#[derive(Clone, Default, PartialEq)]
9703#[non_exhaustive]
9704pub struct ImportJob {
9705    /// Output only. The resource name for this
9706    /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9707    /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9708    ///
9709    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9710    pub name: std::string::String,
9711
9712    /// Required. Immutable. The wrapping method to be used for incoming key
9713    /// material.
9714    pub import_method: crate::model::import_job::ImportMethod,
9715
9716    /// Required. Immutable. The protection level of the
9717    /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9718    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9719    /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9720    /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9721    /// into.
9722    ///
9723    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9724    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9725    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9726    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9727    pub protection_level: crate::model::ProtectionLevel,
9728
9729    /// Output only. The time at which this
9730    /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9731    ///
9732    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9733    pub create_time: std::option::Option<wkt::Timestamp>,
9734
9735    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9736    /// material was generated.
9737    ///
9738    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9739    pub generate_time: std::option::Option<wkt::Timestamp>,
9740
9741    /// Output only. The time at which this
9742    /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9743    /// can no longer be used to import key material.
9744    ///
9745    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9746    pub expire_time: std::option::Option<wkt::Timestamp>,
9747
9748    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9749    /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9750    /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9751    ///
9752    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9753    /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9754    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9755    pub expire_event_time: std::option::Option<wkt::Timestamp>,
9756
9757    /// Output only. The current state of the
9758    /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9759    ///
9760    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9761    pub state: crate::model::import_job::ImportJobState,
9762
9763    /// Output only. The public key with which to wrap key material prior to
9764    /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9765    /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9766    ///
9767    /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9768    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9769    pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9770
9771    /// Output only. Specifies the
9772    /// [WrappingPublicKey][google.cloud.kms.v1.ImportJob.WrappingPublicKey] format
9773    /// provided by the customer in the
9774    /// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]
9775    /// request.
9776    ///
9777    /// [google.cloud.kms.v1.ImportJob.WrappingPublicKey]: crate::model::import_job::WrappingPublicKey
9778    /// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
9779    pub public_key_format: crate::model::public_key::PublicKeyFormat,
9780
9781    /// Output only. Statement that was generated and signed by the key creator
9782    /// (for example, an HSM) at key creation time. Use this statement to verify
9783    /// attributes of the key as stored on the HSM, independently of Google.
9784    /// Only present if the chosen
9785    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9786    /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9787    ///
9788    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9789    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9790    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9791
9792    /// Immutable. The resource name of the backend environment where the key
9793    /// material for the wrapping key resides and where all related cryptographic
9794    /// operations are performed. Currently, this field is only populated for keys
9795    /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9796    /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9797    /// in the future. Supported resources:
9798    ///
9799    /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9800    ///
9801    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9802    pub crypto_key_backend: std::string::String,
9803
9804    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9805}
9806
9807impl ImportJob {
9808    /// Creates a new default instance.
9809    pub fn new() -> Self {
9810        std::default::Default::default()
9811    }
9812
9813    /// Sets the value of [name][crate::model::ImportJob::name].
9814    ///
9815    /// # Example
9816    /// ```ignore,no_run
9817    /// # use google_cloud_kms_v1::model::ImportJob;
9818    /// # let project_id = "project_id";
9819    /// # let location_id = "location_id";
9820    /// # let key_ring_id = "key_ring_id";
9821    /// # let import_job_id = "import_job_id";
9822    /// let x = ImportJob::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/importJobs/{import_job_id}"));
9823    /// ```
9824    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9825        self.name = v.into();
9826        self
9827    }
9828
9829    /// Sets the value of [import_method][crate::model::ImportJob::import_method].
9830    ///
9831    /// # Example
9832    /// ```ignore,no_run
9833    /// # use google_cloud_kms_v1::model::ImportJob;
9834    /// use google_cloud_kms_v1::model::import_job::ImportMethod;
9835    /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
9836    /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
9837    /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
9838    /// ```
9839    pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
9840        mut self,
9841        v: T,
9842    ) -> Self {
9843        self.import_method = v.into();
9844        self
9845    }
9846
9847    /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
9848    ///
9849    /// # Example
9850    /// ```ignore,no_run
9851    /// # use google_cloud_kms_v1::model::ImportJob;
9852    /// use google_cloud_kms_v1::model::ProtectionLevel;
9853    /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
9854    /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
9855    /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
9856    /// ```
9857    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9858        mut self,
9859        v: T,
9860    ) -> Self {
9861        self.protection_level = v.into();
9862        self
9863    }
9864
9865    /// Sets the value of [create_time][crate::model::ImportJob::create_time].
9866    ///
9867    /// # Example
9868    /// ```ignore,no_run
9869    /// # use google_cloud_kms_v1::model::ImportJob;
9870    /// use wkt::Timestamp;
9871    /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
9872    /// ```
9873    pub fn set_create_time<T>(mut self, v: T) -> Self
9874    where
9875        T: std::convert::Into<wkt::Timestamp>,
9876    {
9877        self.create_time = std::option::Option::Some(v.into());
9878        self
9879    }
9880
9881    /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
9882    ///
9883    /// # Example
9884    /// ```ignore,no_run
9885    /// # use google_cloud_kms_v1::model::ImportJob;
9886    /// use wkt::Timestamp;
9887    /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9888    /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
9889    /// ```
9890    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9891    where
9892        T: std::convert::Into<wkt::Timestamp>,
9893    {
9894        self.create_time = v.map(|x| x.into());
9895        self
9896    }
9897
9898    /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
9899    ///
9900    /// # Example
9901    /// ```ignore,no_run
9902    /// # use google_cloud_kms_v1::model::ImportJob;
9903    /// use wkt::Timestamp;
9904    /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
9905    /// ```
9906    pub fn set_generate_time<T>(mut self, v: T) -> Self
9907    where
9908        T: std::convert::Into<wkt::Timestamp>,
9909    {
9910        self.generate_time = std::option::Option::Some(v.into());
9911        self
9912    }
9913
9914    /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
9915    ///
9916    /// # Example
9917    /// ```ignore,no_run
9918    /// # use google_cloud_kms_v1::model::ImportJob;
9919    /// use wkt::Timestamp;
9920    /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
9921    /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
9922    /// ```
9923    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
9924    where
9925        T: std::convert::Into<wkt::Timestamp>,
9926    {
9927        self.generate_time = v.map(|x| x.into());
9928        self
9929    }
9930
9931    /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
9932    ///
9933    /// # Example
9934    /// ```ignore,no_run
9935    /// # use google_cloud_kms_v1::model::ImportJob;
9936    /// use wkt::Timestamp;
9937    /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
9938    /// ```
9939    pub fn set_expire_time<T>(mut self, v: T) -> Self
9940    where
9941        T: std::convert::Into<wkt::Timestamp>,
9942    {
9943        self.expire_time = std::option::Option::Some(v.into());
9944        self
9945    }
9946
9947    /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
9948    ///
9949    /// # Example
9950    /// ```ignore,no_run
9951    /// # use google_cloud_kms_v1::model::ImportJob;
9952    /// use wkt::Timestamp;
9953    /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9954    /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
9955    /// ```
9956    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9957    where
9958        T: std::convert::Into<wkt::Timestamp>,
9959    {
9960        self.expire_time = v.map(|x| x.into());
9961        self
9962    }
9963
9964    /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9965    ///
9966    /// # Example
9967    /// ```ignore,no_run
9968    /// # use google_cloud_kms_v1::model::ImportJob;
9969    /// use wkt::Timestamp;
9970    /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
9971    /// ```
9972    pub fn set_expire_event_time<T>(mut self, v: T) -> Self
9973    where
9974        T: std::convert::Into<wkt::Timestamp>,
9975    {
9976        self.expire_event_time = std::option::Option::Some(v.into());
9977        self
9978    }
9979
9980    /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9981    ///
9982    /// # Example
9983    /// ```ignore,no_run
9984    /// # use google_cloud_kms_v1::model::ImportJob;
9985    /// use wkt::Timestamp;
9986    /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
9987    /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
9988    /// ```
9989    pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
9990    where
9991        T: std::convert::Into<wkt::Timestamp>,
9992    {
9993        self.expire_event_time = v.map(|x| x.into());
9994        self
9995    }
9996
9997    /// Sets the value of [state][crate::model::ImportJob::state].
9998    ///
9999    /// # Example
10000    /// ```ignore,no_run
10001    /// # use google_cloud_kms_v1::model::ImportJob;
10002    /// use google_cloud_kms_v1::model::import_job::ImportJobState;
10003    /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
10004    /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
10005    /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
10006    /// ```
10007    pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
10008        mut self,
10009        v: T,
10010    ) -> Self {
10011        self.state = v.into();
10012        self
10013    }
10014
10015    /// Sets the value of [public_key][crate::model::ImportJob::public_key].
10016    ///
10017    /// # Example
10018    /// ```ignore,no_run
10019    /// # use google_cloud_kms_v1::model::ImportJob;
10020    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10021    /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
10022    /// ```
10023    pub fn set_public_key<T>(mut self, v: T) -> Self
10024    where
10025        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
10026    {
10027        self.public_key = std::option::Option::Some(v.into());
10028        self
10029    }
10030
10031    /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
10032    ///
10033    /// # Example
10034    /// ```ignore,no_run
10035    /// # use google_cloud_kms_v1::model::ImportJob;
10036    /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10037    /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
10038    /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
10039    /// ```
10040    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
10041    where
10042        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
10043    {
10044        self.public_key = v.map(|x| x.into());
10045        self
10046    }
10047
10048    /// Sets the value of [public_key_format][crate::model::ImportJob::public_key_format].
10049    ///
10050    /// # Example
10051    /// ```ignore,no_run
10052    /// # use google_cloud_kms_v1::model::ImportJob;
10053    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
10054    /// let x0 = ImportJob::new().set_public_key_format(PublicKeyFormat::Pem);
10055    /// let x1 = ImportJob::new().set_public_key_format(PublicKeyFormat::Der);
10056    /// let x2 = ImportJob::new().set_public_key_format(PublicKeyFormat::NistPqc);
10057    /// ```
10058    pub fn set_public_key_format<
10059        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
10060    >(
10061        mut self,
10062        v: T,
10063    ) -> Self {
10064        self.public_key_format = v.into();
10065        self
10066    }
10067
10068    /// Sets the value of [attestation][crate::model::ImportJob::attestation].
10069    ///
10070    /// # Example
10071    /// ```ignore,no_run
10072    /// # use google_cloud_kms_v1::model::ImportJob;
10073    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
10074    /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
10075    /// ```
10076    pub fn set_attestation<T>(mut self, v: T) -> Self
10077    where
10078        T: std::convert::Into<crate::model::KeyOperationAttestation>,
10079    {
10080        self.attestation = std::option::Option::Some(v.into());
10081        self
10082    }
10083
10084    /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
10085    ///
10086    /// # Example
10087    /// ```ignore,no_run
10088    /// # use google_cloud_kms_v1::model::ImportJob;
10089    /// use google_cloud_kms_v1::model::KeyOperationAttestation;
10090    /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
10091    /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
10092    /// ```
10093    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
10094    where
10095        T: std::convert::Into<crate::model::KeyOperationAttestation>,
10096    {
10097        self.attestation = v.map(|x| x.into());
10098        self
10099    }
10100
10101    /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
10102    ///
10103    /// # Example
10104    /// ```ignore,no_run
10105    /// # use google_cloud_kms_v1::model::ImportJob;
10106    /// let x = ImportJob::new().set_crypto_key_backend("example");
10107    /// ```
10108    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
10109        mut self,
10110        v: T,
10111    ) -> Self {
10112        self.crypto_key_backend = v.into();
10113        self
10114    }
10115}
10116
10117impl wkt::message::Message for ImportJob {
10118    fn typename() -> &'static str {
10119        "type.googleapis.com/google.cloud.kms.v1.ImportJob"
10120    }
10121}
10122
10123/// Defines additional types related to [ImportJob].
10124pub mod import_job {
10125    #[allow(unused_imports)]
10126    use super::*;
10127
10128    /// The public key component of the wrapping key. For details of the type of
10129    /// key this public key corresponds to, see the
10130    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
10131    ///
10132    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10133    #[derive(Clone, Default, PartialEq)]
10134    #[non_exhaustive]
10135    pub struct WrappingPublicKey {
10136        /// The public key, encoded in PEM format. For more information, see the [RFC
10137        /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
10138        /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
10139        /// [Textual Encoding of Subject Public Key Info]
10140        /// (<https://tools.ietf.org/html/rfc7468#section-13>).
10141        /// This field gets populated by default for RSA-based import methods, if no
10142        /// public_key_format is specified in the request.
10143        /// If you want to retrieve the wrapping key of an
10144        /// [ImportJob][google.cloud.kms.v1.ImportJob] in some other format, use
10145        /// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]
10146        /// and set the public_key_format to the desired public key format.
10147        ///
10148        /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10149        /// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
10150        pub pem: std::string::String,
10151
10152        /// Output only. Contains the public key, formatted according to the
10153        /// [PublicKey.PublicKeyFormat][google.cloud.kms.v1.PublicKey.PublicKeyFormat]
10154        /// specified in the
10155        /// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]
10156        /// request.
10157        ///
10158        /// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
10159        /// [google.cloud.kms.v1.PublicKey.PublicKeyFormat]: crate::model::public_key::PublicKeyFormat
10160        pub data: ::bytes::Bytes,
10161
10162        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10163    }
10164
10165    impl WrappingPublicKey {
10166        /// Creates a new default instance.
10167        pub fn new() -> Self {
10168            std::default::Default::default()
10169        }
10170
10171        /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
10172        ///
10173        /// # Example
10174        /// ```ignore,no_run
10175        /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10176        /// let x = WrappingPublicKey::new().set_pem("example");
10177        /// ```
10178        pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10179            self.pem = v.into();
10180            self
10181        }
10182
10183        /// Sets the value of [data][crate::model::import_job::WrappingPublicKey::data].
10184        ///
10185        /// # Example
10186        /// ```ignore,no_run
10187        /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10188        /// let x = WrappingPublicKey::new().set_data(bytes::Bytes::from_static(b"example"));
10189        /// ```
10190        pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10191            self.data = v.into();
10192            self
10193        }
10194    }
10195
10196    impl wkt::message::Message for WrappingPublicKey {
10197        fn typename() -> &'static str {
10198            "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
10199        }
10200    }
10201
10202    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
10203    /// key wrapping method chosen for this
10204    /// [ImportJob][google.cloud.kms.v1.ImportJob].
10205    ///
10206    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10207    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10208    ///
10209    /// # Working with unknown values
10210    ///
10211    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10212    /// additional enum variants at any time. Adding new variants is not considered
10213    /// a breaking change. Applications should write their code in anticipation of:
10214    ///
10215    /// - New values appearing in future releases of the client library, **and**
10216    /// - New values received dynamically, without application changes.
10217    ///
10218    /// Please consult the [Working with enums] section in the user guide for some
10219    /// guidelines.
10220    ///
10221    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10222    #[derive(Clone, Debug, PartialEq)]
10223    #[non_exhaustive]
10224    pub enum ImportMethod {
10225        /// Not specified.
10226        Unspecified,
10227        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10228        /// scheme defined in the PKCS #11 standard. In summary, this involves
10229        /// wrapping the raw key with an ephemeral AES key, and wrapping the
10230        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10231        /// [RSA AES key wrap
10232        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10233        RsaOaep3072Sha1Aes256,
10234        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10235        /// scheme defined in the PKCS #11 standard. In summary, this involves
10236        /// wrapping the raw key with an ephemeral AES key, and wrapping the
10237        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10238        /// [RSA AES key wrap
10239        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10240        RsaOaep4096Sha1Aes256,
10241        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10242        /// scheme defined in the PKCS #11 standard. In summary, this involves
10243        /// wrapping the raw key with an ephemeral AES key, and wrapping the
10244        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10245        /// [RSA AES key wrap
10246        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10247        RsaOaep3072Sha256Aes256,
10248        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10249        /// scheme defined in the PKCS #11 standard. In summary, this involves
10250        /// wrapping the raw key with an ephemeral AES key, and wrapping the
10251        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10252        /// [RSA AES key wrap
10253        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10254        RsaOaep4096Sha256Aes256,
10255        /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
10256        /// key material to be imported is wrapped directly with the RSA key. Due
10257        /// to technical limitations of RSA wrapping, this method cannot be used to
10258        /// wrap RSA keys for import.
10259        RsaOaep3072Sha256,
10260        /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
10261        /// key material to be imported is wrapped directly with the RSA key. Due
10262        /// to technical limitations of RSA wrapping, this method cannot be used to
10263        /// wrap RSA keys for import.
10264        RsaOaep4096Sha256,
10265        /// Represents the Hybrid Public Key Encryption (HPKE) Scheme originally
10266        /// defined in [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180). It
10267        /// involves wrapping the raw key with an ephemeral AES key, derived with
10268        /// HKDF-SHA256 from an encryption context, that is, in turn obtained from
10269        /// the receiver’s public key with the help of the ML-KEM-768 KEM. For more
10270        /// details, see the [ML-KEM HPKE
10271        /// standard](http://datatracker.ietf.org/doc/draft-ietf-hpke-pq/01/).
10272        HpkeKemMlKem768HkdfSha256Aes256Gcm,
10273        /// Represents the Hybrid Public Key Encryption (HPKE) Scheme originally
10274        /// defined in [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180). It
10275        /// involves wrapping the raw key with an ephemeral AES key, derived with
10276        /// HKDF-SHA256 from an encryption context, that is, in turn obtained from
10277        /// the receiver’s public key with the help of the ML-KEM-1024 KEM. For more
10278        /// details, see the [ML-KEM HPKE
10279        /// standard](http://datatracker.ietf.org/doc/draft-ietf-hpke-pq/01/).
10280        HpkeKemMlKem1024HkdfSha256Aes256Gcm,
10281        /// Represents the Hybrid Public Key Encryption (HPKE) Scheme originally
10282        /// defined in [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180). It
10283        /// involves wrapping the raw key with an ephemeral AES key, derived with
10284        /// HKDF-SHA256 from an encryption context, that is, in turn obtained from
10285        /// the receiver’s public key with the help of the X-Wing hybrid KEM. For
10286        /// more details, see the [X-Wing
10287        /// standard](http://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/09/).
10288        HpkeKemXwingHkdfSha256Aes256Gcm,
10289        /// If set, the enum was initialized with an unknown value.
10290        ///
10291        /// Applications can examine the value using [ImportMethod::value] or
10292        /// [ImportMethod::name].
10293        UnknownValue(import_method::UnknownValue),
10294    }
10295
10296    #[doc(hidden)]
10297    pub mod import_method {
10298        #[allow(unused_imports)]
10299        use super::*;
10300        #[derive(Clone, Debug, PartialEq)]
10301        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10302    }
10303
10304    impl ImportMethod {
10305        /// Gets the enum value.
10306        ///
10307        /// Returns `None` if the enum contains an unknown value deserialized from
10308        /// the string representation of enums.
10309        pub fn value(&self) -> std::option::Option<i32> {
10310            match self {
10311                Self::Unspecified => std::option::Option::Some(0),
10312                Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
10313                Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
10314                Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
10315                Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
10316                Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
10317                Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
10318                Self::HpkeKemMlKem768HkdfSha256Aes256Gcm => std::option::Option::Some(8),
10319                Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm => std::option::Option::Some(9),
10320                Self::HpkeKemXwingHkdfSha256Aes256Gcm => std::option::Option::Some(10),
10321                Self::UnknownValue(u) => u.0.value(),
10322            }
10323        }
10324
10325        /// Gets the enum value as a string.
10326        ///
10327        /// Returns `None` if the enum contains an unknown value deserialized from
10328        /// the integer representation of enums.
10329        pub fn name(&self) -> std::option::Option<&str> {
10330            match self {
10331                Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
10332                Self::RsaOaep3072Sha1Aes256 => {
10333                    std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
10334                }
10335                Self::RsaOaep4096Sha1Aes256 => {
10336                    std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
10337                }
10338                Self::RsaOaep3072Sha256Aes256 => {
10339                    std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
10340                }
10341                Self::RsaOaep4096Sha256Aes256 => {
10342                    std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
10343                }
10344                Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
10345                Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
10346                Self::HpkeKemMlKem768HkdfSha256Aes256Gcm => {
10347                    std::option::Option::Some("HPKE_KEM_ML_KEM_768_HKDF_SHA256_AES_256_GCM")
10348                }
10349                Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm => {
10350                    std::option::Option::Some("HPKE_KEM_ML_KEM_1024_HKDF_SHA256_AES_256_GCM")
10351                }
10352                Self::HpkeKemXwingHkdfSha256Aes256Gcm => {
10353                    std::option::Option::Some("HPKE_KEM_XWING_HKDF_SHA256_AES_256_GCM")
10354                }
10355                Self::UnknownValue(u) => u.0.name(),
10356            }
10357        }
10358    }
10359
10360    impl std::default::Default for ImportMethod {
10361        fn default() -> Self {
10362            use std::convert::From;
10363            Self::from(0)
10364        }
10365    }
10366
10367    impl std::fmt::Display for ImportMethod {
10368        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10369            wkt::internal::display_enum(f, self.name(), self.value())
10370        }
10371    }
10372
10373    impl std::convert::From<i32> for ImportMethod {
10374        fn from(value: i32) -> Self {
10375            match value {
10376                0 => Self::Unspecified,
10377                1 => Self::RsaOaep3072Sha1Aes256,
10378                2 => Self::RsaOaep4096Sha1Aes256,
10379                3 => Self::RsaOaep3072Sha256Aes256,
10380                4 => Self::RsaOaep4096Sha256Aes256,
10381                5 => Self::RsaOaep3072Sha256,
10382                6 => Self::RsaOaep4096Sha256,
10383                8 => Self::HpkeKemMlKem768HkdfSha256Aes256Gcm,
10384                9 => Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm,
10385                10 => Self::HpkeKemXwingHkdfSha256Aes256Gcm,
10386                _ => Self::UnknownValue(import_method::UnknownValue(
10387                    wkt::internal::UnknownEnumValue::Integer(value),
10388                )),
10389            }
10390        }
10391    }
10392
10393    impl std::convert::From<&str> for ImportMethod {
10394        fn from(value: &str) -> Self {
10395            use std::string::ToString;
10396            match value {
10397                "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
10398                "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
10399                "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
10400                "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
10401                "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
10402                "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
10403                "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
10404                "HPKE_KEM_ML_KEM_768_HKDF_SHA256_AES_256_GCM" => {
10405                    Self::HpkeKemMlKem768HkdfSha256Aes256Gcm
10406                }
10407                "HPKE_KEM_ML_KEM_1024_HKDF_SHA256_AES_256_GCM" => {
10408                    Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm
10409                }
10410                "HPKE_KEM_XWING_HKDF_SHA256_AES_256_GCM" => Self::HpkeKemXwingHkdfSha256Aes256Gcm,
10411                _ => Self::UnknownValue(import_method::UnknownValue(
10412                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10413                )),
10414            }
10415        }
10416    }
10417
10418    impl serde::ser::Serialize for ImportMethod {
10419        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10420        where
10421            S: serde::Serializer,
10422        {
10423            match self {
10424                Self::Unspecified => serializer.serialize_i32(0),
10425                Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
10426                Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
10427                Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
10428                Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
10429                Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
10430                Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
10431                Self::HpkeKemMlKem768HkdfSha256Aes256Gcm => serializer.serialize_i32(8),
10432                Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm => serializer.serialize_i32(9),
10433                Self::HpkeKemXwingHkdfSha256Aes256Gcm => serializer.serialize_i32(10),
10434                Self::UnknownValue(u) => u.0.serialize(serializer),
10435            }
10436        }
10437    }
10438
10439    impl<'de> serde::de::Deserialize<'de> for ImportMethod {
10440        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10441        where
10442            D: serde::Deserializer<'de>,
10443        {
10444            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
10445                ".google.cloud.kms.v1.ImportJob.ImportMethod",
10446            ))
10447        }
10448    }
10449
10450    /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
10451    /// it can be used.
10452    ///
10453    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10454    ///
10455    /// # Working with unknown values
10456    ///
10457    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10458    /// additional enum variants at any time. Adding new variants is not considered
10459    /// a breaking change. Applications should write their code in anticipation of:
10460    ///
10461    /// - New values appearing in future releases of the client library, **and**
10462    /// - New values received dynamically, without application changes.
10463    ///
10464    /// Please consult the [Working with enums] section in the user guide for some
10465    /// guidelines.
10466    ///
10467    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10468    #[derive(Clone, Debug, PartialEq)]
10469    #[non_exhaustive]
10470    pub enum ImportJobState {
10471        /// Not specified.
10472        Unspecified,
10473        /// The wrapping key for this job is still being generated. It may not be
10474        /// used. Cloud KMS will automatically mark this job as
10475        /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
10476        /// the wrapping key is generated.
10477        ///
10478        /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
10479        PendingGeneration,
10480        /// This job may be used in
10481        /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
10482        /// and
10483        /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
10484        /// requests.
10485        ///
10486        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
10487        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
10488        Active,
10489        /// This job can no longer be used and may not leave this state once entered.
10490        Expired,
10491        /// If set, the enum was initialized with an unknown value.
10492        ///
10493        /// Applications can examine the value using [ImportJobState::value] or
10494        /// [ImportJobState::name].
10495        UnknownValue(import_job_state::UnknownValue),
10496    }
10497
10498    #[doc(hidden)]
10499    pub mod import_job_state {
10500        #[allow(unused_imports)]
10501        use super::*;
10502        #[derive(Clone, Debug, PartialEq)]
10503        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10504    }
10505
10506    impl ImportJobState {
10507        /// Gets the enum value.
10508        ///
10509        /// Returns `None` if the enum contains an unknown value deserialized from
10510        /// the string representation of enums.
10511        pub fn value(&self) -> std::option::Option<i32> {
10512            match self {
10513                Self::Unspecified => std::option::Option::Some(0),
10514                Self::PendingGeneration => std::option::Option::Some(1),
10515                Self::Active => std::option::Option::Some(2),
10516                Self::Expired => std::option::Option::Some(3),
10517                Self::UnknownValue(u) => u.0.value(),
10518            }
10519        }
10520
10521        /// Gets the enum value as a string.
10522        ///
10523        /// Returns `None` if the enum contains an unknown value deserialized from
10524        /// the integer representation of enums.
10525        pub fn name(&self) -> std::option::Option<&str> {
10526            match self {
10527                Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
10528                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
10529                Self::Active => std::option::Option::Some("ACTIVE"),
10530                Self::Expired => std::option::Option::Some("EXPIRED"),
10531                Self::UnknownValue(u) => u.0.name(),
10532            }
10533        }
10534    }
10535
10536    impl std::default::Default for ImportJobState {
10537        fn default() -> Self {
10538            use std::convert::From;
10539            Self::from(0)
10540        }
10541    }
10542
10543    impl std::fmt::Display for ImportJobState {
10544        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10545            wkt::internal::display_enum(f, self.name(), self.value())
10546        }
10547    }
10548
10549    impl std::convert::From<i32> for ImportJobState {
10550        fn from(value: i32) -> Self {
10551            match value {
10552                0 => Self::Unspecified,
10553                1 => Self::PendingGeneration,
10554                2 => Self::Active,
10555                3 => Self::Expired,
10556                _ => Self::UnknownValue(import_job_state::UnknownValue(
10557                    wkt::internal::UnknownEnumValue::Integer(value),
10558                )),
10559            }
10560        }
10561    }
10562
10563    impl std::convert::From<&str> for ImportJobState {
10564        fn from(value: &str) -> Self {
10565            use std::string::ToString;
10566            match value {
10567                "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10568                "PENDING_GENERATION" => Self::PendingGeneration,
10569                "ACTIVE" => Self::Active,
10570                "EXPIRED" => Self::Expired,
10571                _ => Self::UnknownValue(import_job_state::UnknownValue(
10572                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10573                )),
10574            }
10575        }
10576    }
10577
10578    impl serde::ser::Serialize for ImportJobState {
10579        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10580        where
10581            S: serde::Serializer,
10582        {
10583            match self {
10584                Self::Unspecified => serializer.serialize_i32(0),
10585                Self::PendingGeneration => serializer.serialize_i32(1),
10586                Self::Active => serializer.serialize_i32(2),
10587                Self::Expired => serializer.serialize_i32(3),
10588                Self::UnknownValue(u) => u.0.serialize(serializer),
10589            }
10590        }
10591    }
10592
10593    impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10594        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10595        where
10596            D: serde::Deserializer<'de>,
10597        {
10598            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10599                ".google.cloud.kms.v1.ImportJob.ImportJobState",
10600            ))
10601        }
10602    }
10603}
10604
10605/// ExternalProtectionLevelOptions stores a group of additional fields for
10606/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10607/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10608/// protection level and
10609/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10610/// levels.
10611///
10612/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10613/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10614/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10615#[derive(Clone, Default, PartialEq)]
10616#[non_exhaustive]
10617pub struct ExternalProtectionLevelOptions {
10618    /// The URI for an external resource that this
10619    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10620    ///
10621    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10622    pub external_key_uri: std::string::String,
10623
10624    /// The path to the external key material on the EKM when using
10625    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10626    /// this field instead of external_key_uri when using an
10627    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10628    ///
10629    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10630    pub ekm_connection_key_path: std::string::String,
10631
10632    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10633}
10634
10635impl ExternalProtectionLevelOptions {
10636    /// Creates a new default instance.
10637    pub fn new() -> Self {
10638        std::default::Default::default()
10639    }
10640
10641    /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10642    ///
10643    /// # Example
10644    /// ```ignore,no_run
10645    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10646    /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10647    /// ```
10648    pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10649        mut self,
10650        v: T,
10651    ) -> Self {
10652        self.external_key_uri = v.into();
10653        self
10654    }
10655
10656    /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10657    ///
10658    /// # Example
10659    /// ```ignore,no_run
10660    /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10661    /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10662    /// ```
10663    pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10664        mut self,
10665        v: T,
10666    ) -> Self {
10667        self.ekm_connection_key_path = v.into();
10668        self
10669    }
10670}
10671
10672impl wkt::message::Message for ExternalProtectionLevelOptions {
10673    fn typename() -> &'static str {
10674        "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10675    }
10676}
10677
10678/// A
10679/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10680/// specifies zero or more allowed
10681/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10682/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey] or
10683/// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig]
10684/// (the default Key Access Justifications policy).
10685///
10686/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10687/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10688/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10689#[derive(Clone, Default, PartialEq)]
10690#[non_exhaustive]
10691pub struct KeyAccessJustificationsPolicy {
10692    /// The list of allowed reasons for access to a
10693    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Note that empty
10694    /// allowed_access_reasons has a different meaning depending on where this
10695    /// message appears. If this is under
10696    /// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig],
10697    /// it means allow-all. If this is under
10698    /// [CryptoKey][google.cloud.kms.v1.CryptoKey], it means deny-all.
10699    ///
10700    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10701    pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10702
10703    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10704}
10705
10706impl KeyAccessJustificationsPolicy {
10707    /// Creates a new default instance.
10708    pub fn new() -> Self {
10709        std::default::Default::default()
10710    }
10711
10712    /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10713    ///
10714    /// # Example
10715    /// ```ignore,no_run
10716    /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10717    /// use google_cloud_kms_v1::model::AccessReason;
10718    /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10719    ///     AccessReason::CustomerInitiatedSupport,
10720    ///     AccessReason::GoogleInitiatedService,
10721    ///     AccessReason::ThirdPartyDataRequest,
10722    /// ]);
10723    /// ```
10724    pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10725    where
10726        T: std::iter::IntoIterator<Item = V>,
10727        V: std::convert::Into<crate::model::AccessReason>,
10728    {
10729        use std::iter::Iterator;
10730        self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10731        self
10732    }
10733}
10734
10735impl wkt::message::Message for KeyAccessJustificationsPolicy {
10736    fn typename() -> &'static str {
10737        "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10738    }
10739}
10740
10741/// A RetiredResource resource represents the record of a deleted
10742/// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Its purpose is to provide
10743/// visibility into retained user data and to prevent reuse of these names for
10744/// new [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10745///
10746/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10747#[derive(Clone, Default, PartialEq)]
10748#[non_exhaustive]
10749pub struct RetiredResource {
10750    /// Output only. Identifier. The resource name for this
10751    /// [RetiredResource][google.cloud.kms.v1.RetiredResource] in the format
10752    /// `projects/*/locations/*/retiredResources/*`.
10753    ///
10754    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10755    pub name: std::string::String,
10756
10757    /// Output only. The full resource name of the original
10758    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] that was deleted in the format
10759    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10760    ///
10761    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10762    pub original_resource: std::string::String,
10763
10764    /// Output only. The resource type of the original deleted resource.
10765    pub resource_type: std::string::String,
10766
10767    /// Output only. The time at which the original resource was deleted and this
10768    /// RetiredResource record was created.
10769    pub delete_time: std::option::Option<wkt::Timestamp>,
10770
10771    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10772}
10773
10774impl RetiredResource {
10775    /// Creates a new default instance.
10776    pub fn new() -> Self {
10777        std::default::Default::default()
10778    }
10779
10780    /// Sets the value of [name][crate::model::RetiredResource::name].
10781    ///
10782    /// # Example
10783    /// ```ignore,no_run
10784    /// # use google_cloud_kms_v1::model::RetiredResource;
10785    /// # let project_id = "project_id";
10786    /// # let location_id = "location_id";
10787    /// # let retired_resource_id = "retired_resource_id";
10788    /// let x = RetiredResource::new().set_name(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
10789    /// ```
10790    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10791        self.name = v.into();
10792        self
10793    }
10794
10795    /// Sets the value of [original_resource][crate::model::RetiredResource::original_resource].
10796    ///
10797    /// # Example
10798    /// ```ignore,no_run
10799    /// # use google_cloud_kms_v1::model::RetiredResource;
10800    /// let x = RetiredResource::new().set_original_resource("example");
10801    /// ```
10802    pub fn set_original_resource<T: std::convert::Into<std::string::String>>(
10803        mut self,
10804        v: T,
10805    ) -> Self {
10806        self.original_resource = v.into();
10807        self
10808    }
10809
10810    /// Sets the value of [resource_type][crate::model::RetiredResource::resource_type].
10811    ///
10812    /// # Example
10813    /// ```ignore,no_run
10814    /// # use google_cloud_kms_v1::model::RetiredResource;
10815    /// let x = RetiredResource::new().set_resource_type("example");
10816    /// ```
10817    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10818        self.resource_type = v.into();
10819        self
10820    }
10821
10822    /// Sets the value of [delete_time][crate::model::RetiredResource::delete_time].
10823    ///
10824    /// # Example
10825    /// ```ignore,no_run
10826    /// # use google_cloud_kms_v1::model::RetiredResource;
10827    /// use wkt::Timestamp;
10828    /// let x = RetiredResource::new().set_delete_time(Timestamp::default()/* use setters */);
10829    /// ```
10830    pub fn set_delete_time<T>(mut self, v: T) -> Self
10831    where
10832        T: std::convert::Into<wkt::Timestamp>,
10833    {
10834        self.delete_time = std::option::Option::Some(v.into());
10835        self
10836    }
10837
10838    /// Sets or clears the value of [delete_time][crate::model::RetiredResource::delete_time].
10839    ///
10840    /// # Example
10841    /// ```ignore,no_run
10842    /// # use google_cloud_kms_v1::model::RetiredResource;
10843    /// use wkt::Timestamp;
10844    /// let x = RetiredResource::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
10845    /// let x = RetiredResource::new().set_or_clear_delete_time(None::<Timestamp>);
10846    /// ```
10847    pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
10848    where
10849        T: std::convert::Into<wkt::Timestamp>,
10850    {
10851        self.delete_time = v.map(|x| x.into());
10852        self
10853    }
10854}
10855
10856impl wkt::message::Message for RetiredResource {
10857    fn typename() -> &'static str {
10858        "type.googleapis.com/google.cloud.kms.v1.RetiredResource"
10859    }
10860}
10861
10862/// Request message for
10863/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10864///
10865/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10866#[derive(Clone, Default, PartialEq)]
10867#[non_exhaustive]
10868pub struct ListKeyRingsRequest {
10869    /// Required. The resource name of the location associated with the
10870    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
10871    /// `projects/*/locations/*`.
10872    ///
10873    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10874    pub parent: std::string::String,
10875
10876    /// Optional. Optional limit on the number of
10877    /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
10878    /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
10879    /// including the
10880    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
10881    /// in a subsequent request.  If unspecified, the server will pick an
10882    /// appropriate default.
10883    ///
10884    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10885    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10886    pub page_size: i32,
10887
10888    /// Optional. Optional pagination token, returned earlier via
10889    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
10890    ///
10891    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10892    pub page_token: std::string::String,
10893
10894    /// Optional. Only include resources that match the filter in the response. For
10895    /// more information, see
10896    /// [Sorting and filtering list
10897    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10898    pub filter: std::string::String,
10899
10900    /// Optional. Specify how the results should be sorted. If not specified, the
10901    /// results will be sorted in the default order.  For more information, see
10902    /// [Sorting and filtering list
10903    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10904    pub order_by: std::string::String,
10905
10906    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10907}
10908
10909impl ListKeyRingsRequest {
10910    /// Creates a new default instance.
10911    pub fn new() -> Self {
10912        std::default::Default::default()
10913    }
10914
10915    /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
10916    ///
10917    /// # Example
10918    /// ```ignore,no_run
10919    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10920    /// let x = ListKeyRingsRequest::new().set_parent("example");
10921    /// ```
10922    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10923        self.parent = v.into();
10924        self
10925    }
10926
10927    /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
10928    ///
10929    /// # Example
10930    /// ```ignore,no_run
10931    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10932    /// let x = ListKeyRingsRequest::new().set_page_size(42);
10933    /// ```
10934    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10935        self.page_size = v.into();
10936        self
10937    }
10938
10939    /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
10940    ///
10941    /// # Example
10942    /// ```ignore,no_run
10943    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10944    /// let x = ListKeyRingsRequest::new().set_page_token("example");
10945    /// ```
10946    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10947        self.page_token = v.into();
10948        self
10949    }
10950
10951    /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
10952    ///
10953    /// # Example
10954    /// ```ignore,no_run
10955    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10956    /// let x = ListKeyRingsRequest::new().set_filter("example");
10957    /// ```
10958    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10959        self.filter = v.into();
10960        self
10961    }
10962
10963    /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
10964    ///
10965    /// # Example
10966    /// ```ignore,no_run
10967    /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10968    /// let x = ListKeyRingsRequest::new().set_order_by("example");
10969    /// ```
10970    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10971        self.order_by = v.into();
10972        self
10973    }
10974}
10975
10976impl wkt::message::Message for ListKeyRingsRequest {
10977    fn typename() -> &'static str {
10978        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
10979    }
10980}
10981
10982/// Request message for
10983/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10984///
10985/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10986#[derive(Clone, Default, PartialEq)]
10987#[non_exhaustive]
10988pub struct ListCryptoKeysRequest {
10989    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10990    /// to list, in the format `projects/*/locations/*/keyRings/*`.
10991    ///
10992    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10993    pub parent: std::string::String,
10994
10995    /// Optional. Optional limit on the number of
10996    /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
10997    /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
10998    /// obtained by including the
10999    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
11000    /// in a subsequent request.  If unspecified, the server will pick an
11001    /// appropriate default.
11002    ///
11003    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11004    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
11005    pub page_size: i32,
11006
11007    /// Optional. Optional pagination token, returned earlier via
11008    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
11009    ///
11010    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
11011    pub page_token: std::string::String,
11012
11013    /// The fields of the primary version to include in the response.
11014    pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
11015
11016    /// Optional. Only include resources that match the filter in the response. For
11017    /// more information, see
11018    /// [Sorting and filtering list
11019    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11020    pub filter: std::string::String,
11021
11022    /// Optional. Specify how the results should be sorted. If not specified, the
11023    /// results will be sorted in the default order. For more information, see
11024    /// [Sorting and filtering list
11025    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11026    pub order_by: std::string::String,
11027
11028    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11029}
11030
11031impl ListCryptoKeysRequest {
11032    /// Creates a new default instance.
11033    pub fn new() -> Self {
11034        std::default::Default::default()
11035    }
11036
11037    /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
11038    ///
11039    /// # Example
11040    /// ```ignore,no_run
11041    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11042    /// # let project_id = "project_id";
11043    /// # let location_id = "location_id";
11044    /// # let key_ring_id = "key_ring_id";
11045    /// let x = ListCryptoKeysRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
11046    /// ```
11047    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11048        self.parent = v.into();
11049        self
11050    }
11051
11052    /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
11053    ///
11054    /// # Example
11055    /// ```ignore,no_run
11056    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11057    /// let x = ListCryptoKeysRequest::new().set_page_size(42);
11058    /// ```
11059    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11060        self.page_size = v.into();
11061        self
11062    }
11063
11064    /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
11065    ///
11066    /// # Example
11067    /// ```ignore,no_run
11068    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11069    /// let x = ListCryptoKeysRequest::new().set_page_token("example");
11070    /// ```
11071    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11072        self.page_token = v.into();
11073        self
11074    }
11075
11076    /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
11077    ///
11078    /// # Example
11079    /// ```ignore,no_run
11080    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11081    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
11082    /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
11083    /// ```
11084    pub fn set_version_view<
11085        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
11086    >(
11087        mut self,
11088        v: T,
11089    ) -> Self {
11090        self.version_view = v.into();
11091        self
11092    }
11093
11094    /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
11095    ///
11096    /// # Example
11097    /// ```ignore,no_run
11098    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11099    /// let x = ListCryptoKeysRequest::new().set_filter("example");
11100    /// ```
11101    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11102        self.filter = v.into();
11103        self
11104    }
11105
11106    /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
11107    ///
11108    /// # Example
11109    /// ```ignore,no_run
11110    /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11111    /// let x = ListCryptoKeysRequest::new().set_order_by("example");
11112    /// ```
11113    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11114        self.order_by = v.into();
11115        self
11116    }
11117}
11118
11119impl wkt::message::Message for ListCryptoKeysRequest {
11120    fn typename() -> &'static str {
11121        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
11122    }
11123}
11124
11125/// Request message for
11126/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11127///
11128/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11129#[derive(Clone, Default, PartialEq)]
11130#[non_exhaustive]
11131pub struct ListCryptoKeyVersionsRequest {
11132    /// Required. The resource name of the
11133    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
11134    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
11135    ///
11136    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11137    pub parent: std::string::String,
11138
11139    /// Optional. Optional limit on the number of
11140    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
11141    /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
11142    /// can subsequently be obtained by including the
11143    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
11144    /// in a subsequent request. If unspecified, the server will pick an
11145    /// appropriate default.
11146    ///
11147    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11148    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
11149    pub page_size: i32,
11150
11151    /// Optional. Optional pagination token, returned earlier via
11152    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
11153    ///
11154    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
11155    pub page_token: std::string::String,
11156
11157    /// The fields to include in the response.
11158    pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
11159
11160    /// Optional. Only include resources that match the filter in the response. For
11161    /// more information, see
11162    /// [Sorting and filtering list
11163    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11164    pub filter: std::string::String,
11165
11166    /// Optional. Specify how the results should be sorted. If not specified, the
11167    /// results will be sorted in the default order. For more information, see
11168    /// [Sorting and filtering list
11169    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11170    pub order_by: std::string::String,
11171
11172    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11173}
11174
11175impl ListCryptoKeyVersionsRequest {
11176    /// Creates a new default instance.
11177    pub fn new() -> Self {
11178        std::default::Default::default()
11179    }
11180
11181    /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
11182    ///
11183    /// # Example
11184    /// ```ignore,no_run
11185    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11186    /// # let project_id = "project_id";
11187    /// # let location_id = "location_id";
11188    /// # let key_ring_id = "key_ring_id";
11189    /// # let crypto_key_id = "crypto_key_id";
11190    /// let x = ListCryptoKeyVersionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
11191    /// ```
11192    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11193        self.parent = v.into();
11194        self
11195    }
11196
11197    /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
11198    ///
11199    /// # Example
11200    /// ```ignore,no_run
11201    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11202    /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
11203    /// ```
11204    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11205        self.page_size = v.into();
11206        self
11207    }
11208
11209    /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
11210    ///
11211    /// # Example
11212    /// ```ignore,no_run
11213    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11214    /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
11215    /// ```
11216    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11217        self.page_token = v.into();
11218        self
11219    }
11220
11221    /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
11222    ///
11223    /// # Example
11224    /// ```ignore,no_run
11225    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11226    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
11227    /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
11228    /// ```
11229    pub fn set_view<
11230        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
11231    >(
11232        mut self,
11233        v: T,
11234    ) -> Self {
11235        self.view = v.into();
11236        self
11237    }
11238
11239    /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
11240    ///
11241    /// # Example
11242    /// ```ignore,no_run
11243    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11244    /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
11245    /// ```
11246    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11247        self.filter = v.into();
11248        self
11249    }
11250
11251    /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
11252    ///
11253    /// # Example
11254    /// ```ignore,no_run
11255    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11256    /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
11257    /// ```
11258    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11259        self.order_by = v.into();
11260        self
11261    }
11262}
11263
11264impl wkt::message::Message for ListCryptoKeyVersionsRequest {
11265    fn typename() -> &'static str {
11266        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
11267    }
11268}
11269
11270/// Request message for
11271/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11272///
11273/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11274#[derive(Clone, Default, PartialEq)]
11275#[non_exhaustive]
11276pub struct ListImportJobsRequest {
11277    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
11278    /// to list, in the format `projects/*/locations/*/keyRings/*`.
11279    ///
11280    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11281    pub parent: std::string::String,
11282
11283    /// Optional. Optional limit on the number of
11284    /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
11285    /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
11286    /// obtained by including the
11287    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
11288    /// in a subsequent request. If unspecified, the server will pick an
11289    /// appropriate default.
11290    ///
11291    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11292    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11293    pub page_size: i32,
11294
11295    /// Optional. Optional pagination token, returned earlier via
11296    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
11297    ///
11298    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11299    pub page_token: std::string::String,
11300
11301    /// Optional. Only include resources that match the filter in the response. For
11302    /// more information, see
11303    /// [Sorting and filtering list
11304    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11305    pub filter: std::string::String,
11306
11307    /// Optional. Specify how the results should be sorted. If not specified, the
11308    /// results will be sorted in the default order. For more information, see
11309    /// [Sorting and filtering list
11310    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11311    pub order_by: std::string::String,
11312
11313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11314}
11315
11316impl ListImportJobsRequest {
11317    /// Creates a new default instance.
11318    pub fn new() -> Self {
11319        std::default::Default::default()
11320    }
11321
11322    /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
11323    ///
11324    /// # Example
11325    /// ```ignore,no_run
11326    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11327    /// # let project_id = "project_id";
11328    /// # let location_id = "location_id";
11329    /// # let key_ring_id = "key_ring_id";
11330    /// let x = ListImportJobsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
11331    /// ```
11332    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11333        self.parent = v.into();
11334        self
11335    }
11336
11337    /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
11338    ///
11339    /// # Example
11340    /// ```ignore,no_run
11341    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11342    /// let x = ListImportJobsRequest::new().set_page_size(42);
11343    /// ```
11344    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11345        self.page_size = v.into();
11346        self
11347    }
11348
11349    /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
11350    ///
11351    /// # Example
11352    /// ```ignore,no_run
11353    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11354    /// let x = ListImportJobsRequest::new().set_page_token("example");
11355    /// ```
11356    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11357        self.page_token = v.into();
11358        self
11359    }
11360
11361    /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
11362    ///
11363    /// # Example
11364    /// ```ignore,no_run
11365    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11366    /// let x = ListImportJobsRequest::new().set_filter("example");
11367    /// ```
11368    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11369        self.filter = v.into();
11370        self
11371    }
11372
11373    /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
11374    ///
11375    /// # Example
11376    /// ```ignore,no_run
11377    /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11378    /// let x = ListImportJobsRequest::new().set_order_by("example");
11379    /// ```
11380    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11381        self.order_by = v.into();
11382        self
11383    }
11384}
11385
11386impl wkt::message::Message for ListImportJobsRequest {
11387    fn typename() -> &'static str {
11388        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
11389    }
11390}
11391
11392/// Request message for
11393/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11394///
11395/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11396#[derive(Clone, Default, PartialEq)]
11397#[non_exhaustive]
11398pub struct ListRetiredResourcesRequest {
11399    /// Required. The project-specific location holding the
11400    /// [RetiredResources][google.cloud.kms.v1.RetiredResource], in the format
11401    /// `projects/*/locations/*`.
11402    ///
11403    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11404    pub parent: std::string::String,
11405
11406    /// Optional. Optional limit on the number of
11407    /// [RetiredResources][google.cloud.kms.v1.RetiredResource] to be included in
11408    /// the response. Further
11409    /// [RetiredResources][google.cloud.kms.v1.RetiredResource] can subsequently be
11410    /// obtained by including the
11411    /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]
11412    /// in a subsequent request. If unspecified, the server will pick an
11413    /// appropriate default.
11414    ///
11415    /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11416    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11417    pub page_size: i32,
11418
11419    /// Optional. Optional pagination token, returned earlier via
11420    /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token].
11421    ///
11422    /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11423    pub page_token: std::string::String,
11424
11425    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11426}
11427
11428impl ListRetiredResourcesRequest {
11429    /// Creates a new default instance.
11430    pub fn new() -> Self {
11431        std::default::Default::default()
11432    }
11433
11434    /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
11435    ///
11436    /// # Example
11437    /// ```ignore,no_run
11438    /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11439    /// # let project_id = "project_id";
11440    /// # let location_id = "location_id";
11441    /// let x = ListRetiredResourcesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
11442    /// ```
11443    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11444        self.parent = v.into();
11445        self
11446    }
11447
11448    /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
11449    ///
11450    /// # Example
11451    /// ```ignore,no_run
11452    /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11453    /// let x = ListRetiredResourcesRequest::new().set_page_size(42);
11454    /// ```
11455    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11456        self.page_size = v.into();
11457        self
11458    }
11459
11460    /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
11461    ///
11462    /// # Example
11463    /// ```ignore,no_run
11464    /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11465    /// let x = ListRetiredResourcesRequest::new().set_page_token("example");
11466    /// ```
11467    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11468        self.page_token = v.into();
11469        self
11470    }
11471}
11472
11473impl wkt::message::Message for ListRetiredResourcesRequest {
11474    fn typename() -> &'static str {
11475        "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesRequest"
11476    }
11477}
11478
11479/// Response message for
11480/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
11481///
11482/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
11483#[derive(Clone, Default, PartialEq)]
11484#[non_exhaustive]
11485pub struct ListKeyRingsResponse {
11486    /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
11487    ///
11488    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11489    pub key_rings: std::vec::Vec<crate::model::KeyRing>,
11490
11491    /// A token to retrieve next page of results. Pass this value in
11492    /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
11493    /// to retrieve the next page of results.
11494    ///
11495    /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
11496    pub next_page_token: std::string::String,
11497
11498    /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
11499    /// the query.
11500    ///
11501    /// This field is not populated if
11502    /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
11503    /// is applied.
11504    ///
11505    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11506    /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
11507    pub total_size: i32,
11508
11509    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11510}
11511
11512impl ListKeyRingsResponse {
11513    /// Creates a new default instance.
11514    pub fn new() -> Self {
11515        std::default::Default::default()
11516    }
11517
11518    /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
11519    ///
11520    /// # Example
11521    /// ```ignore,no_run
11522    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11523    /// use google_cloud_kms_v1::model::KeyRing;
11524    /// let x = ListKeyRingsResponse::new()
11525    ///     .set_key_rings([
11526    ///         KeyRing::default()/* use setters */,
11527    ///         KeyRing::default()/* use (different) setters */,
11528    ///     ]);
11529    /// ```
11530    pub fn set_key_rings<T, V>(mut self, v: T) -> Self
11531    where
11532        T: std::iter::IntoIterator<Item = V>,
11533        V: std::convert::Into<crate::model::KeyRing>,
11534    {
11535        use std::iter::Iterator;
11536        self.key_rings = v.into_iter().map(|i| i.into()).collect();
11537        self
11538    }
11539
11540    /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
11541    ///
11542    /// # Example
11543    /// ```ignore,no_run
11544    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11545    /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
11546    /// ```
11547    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11548        self.next_page_token = v.into();
11549        self
11550    }
11551
11552    /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
11553    ///
11554    /// # Example
11555    /// ```ignore,no_run
11556    /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11557    /// let x = ListKeyRingsResponse::new().set_total_size(42);
11558    /// ```
11559    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11560        self.total_size = v.into();
11561        self
11562    }
11563}
11564
11565impl wkt::message::Message for ListKeyRingsResponse {
11566    fn typename() -> &'static str {
11567        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
11568    }
11569}
11570
11571#[doc(hidden)]
11572impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
11573    type PageItem = crate::model::KeyRing;
11574
11575    fn items(self) -> std::vec::Vec<Self::PageItem> {
11576        self.key_rings
11577    }
11578
11579    fn next_page_token(&self) -> std::string::String {
11580        use std::clone::Clone;
11581        self.next_page_token.clone()
11582    }
11583}
11584
11585/// Response message for
11586/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11587///
11588/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11589#[derive(Clone, Default, PartialEq)]
11590#[non_exhaustive]
11591pub struct ListCryptoKeysResponse {
11592    /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11593    ///
11594    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11595    pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
11596
11597    /// A token to retrieve next page of results. Pass this value in
11598    /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
11599    /// to retrieve the next page of results.
11600    ///
11601    /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
11602    pub next_page_token: std::string::String,
11603
11604    /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
11605    /// matched the query.
11606    ///
11607    /// This field is not populated if
11608    /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
11609    /// is applied.
11610    ///
11611    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11612    /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
11613    pub total_size: i32,
11614
11615    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11616}
11617
11618impl ListCryptoKeysResponse {
11619    /// Creates a new default instance.
11620    pub fn new() -> Self {
11621        std::default::Default::default()
11622    }
11623
11624    /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
11625    ///
11626    /// # Example
11627    /// ```ignore,no_run
11628    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11629    /// use google_cloud_kms_v1::model::CryptoKey;
11630    /// let x = ListCryptoKeysResponse::new()
11631    ///     .set_crypto_keys([
11632    ///         CryptoKey::default()/* use setters */,
11633    ///         CryptoKey::default()/* use (different) setters */,
11634    ///     ]);
11635    /// ```
11636    pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
11637    where
11638        T: std::iter::IntoIterator<Item = V>,
11639        V: std::convert::Into<crate::model::CryptoKey>,
11640    {
11641        use std::iter::Iterator;
11642        self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
11643        self
11644    }
11645
11646    /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
11647    ///
11648    /// # Example
11649    /// ```ignore,no_run
11650    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11651    /// let x = ListCryptoKeysResponse::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::ListCryptoKeysResponse::total_size].
11659    ///
11660    /// # Example
11661    /// ```ignore,no_run
11662    /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11663    /// let x = ListCryptoKeysResponse::new().set_total_size(42);
11664    /// ```
11665    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11666        self.total_size = v.into();
11667        self
11668    }
11669}
11670
11671impl wkt::message::Message for ListCryptoKeysResponse {
11672    fn typename() -> &'static str {
11673        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
11674    }
11675}
11676
11677#[doc(hidden)]
11678impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
11679    type PageItem = crate::model::CryptoKey;
11680
11681    fn items(self) -> std::vec::Vec<Self::PageItem> {
11682        self.crypto_keys
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/// Response message for
11692/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11693///
11694/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11695#[derive(Clone, Default, PartialEq)]
11696#[non_exhaustive]
11697pub struct ListCryptoKeyVersionsResponse {
11698    /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11699    ///
11700    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11701    pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
11702
11703    /// A token to retrieve next page of results. Pass this value in
11704    /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
11705    /// to retrieve the next page of results.
11706    ///
11707    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
11708    pub next_page_token: std::string::String,
11709
11710    /// The total number of
11711    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
11712    /// query.
11713    ///
11714    /// This field is not populated if
11715    /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
11716    /// is applied.
11717    ///
11718    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11719    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
11720    pub total_size: i32,
11721
11722    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11723}
11724
11725impl ListCryptoKeyVersionsResponse {
11726    /// Creates a new default instance.
11727    pub fn new() -> Self {
11728        std::default::Default::default()
11729    }
11730
11731    /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
11732    ///
11733    /// # Example
11734    /// ```ignore,no_run
11735    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11736    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11737    /// let x = ListCryptoKeyVersionsResponse::new()
11738    ///     .set_crypto_key_versions([
11739    ///         CryptoKeyVersion::default()/* use setters */,
11740    ///         CryptoKeyVersion::default()/* use (different) setters */,
11741    ///     ]);
11742    /// ```
11743    pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
11744    where
11745        T: std::iter::IntoIterator<Item = V>,
11746        V: std::convert::Into<crate::model::CryptoKeyVersion>,
11747    {
11748        use std::iter::Iterator;
11749        self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
11750        self
11751    }
11752
11753    /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
11754    ///
11755    /// # Example
11756    /// ```ignore,no_run
11757    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11758    /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
11759    /// ```
11760    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11761        self.next_page_token = v.into();
11762        self
11763    }
11764
11765    /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
11766    ///
11767    /// # Example
11768    /// ```ignore,no_run
11769    /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11770    /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
11771    /// ```
11772    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11773        self.total_size = v.into();
11774        self
11775    }
11776}
11777
11778impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11779    fn typename() -> &'static str {
11780        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11781    }
11782}
11783
11784#[doc(hidden)]
11785impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11786    type PageItem = crate::model::CryptoKeyVersion;
11787
11788    fn items(self) -> std::vec::Vec<Self::PageItem> {
11789        self.crypto_key_versions
11790    }
11791
11792    fn next_page_token(&self) -> std::string::String {
11793        use std::clone::Clone;
11794        self.next_page_token.clone()
11795    }
11796}
11797
11798/// Response message for
11799/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11800///
11801/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11802#[derive(Clone, Default, PartialEq)]
11803#[non_exhaustive]
11804pub struct ListImportJobsResponse {
11805    /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11806    ///
11807    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11808    pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
11809
11810    /// A token to retrieve next page of results. Pass this value in
11811    /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
11812    /// to retrieve the next page of results.
11813    ///
11814    /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
11815    pub next_page_token: std::string::String,
11816
11817    /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
11818    /// matched the query.
11819    ///
11820    /// This field is not populated if
11821    /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
11822    /// is applied.
11823    ///
11824    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11825    /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
11826    pub total_size: i32,
11827
11828    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11829}
11830
11831impl ListImportJobsResponse {
11832    /// Creates a new default instance.
11833    pub fn new() -> Self {
11834        std::default::Default::default()
11835    }
11836
11837    /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
11838    ///
11839    /// # Example
11840    /// ```ignore,no_run
11841    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11842    /// use google_cloud_kms_v1::model::ImportJob;
11843    /// let x = ListImportJobsResponse::new()
11844    ///     .set_import_jobs([
11845    ///         ImportJob::default()/* use setters */,
11846    ///         ImportJob::default()/* use (different) setters */,
11847    ///     ]);
11848    /// ```
11849    pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
11850    where
11851        T: std::iter::IntoIterator<Item = V>,
11852        V: std::convert::Into<crate::model::ImportJob>,
11853    {
11854        use std::iter::Iterator;
11855        self.import_jobs = v.into_iter().map(|i| i.into()).collect();
11856        self
11857    }
11858
11859    /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
11860    ///
11861    /// # Example
11862    /// ```ignore,no_run
11863    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11864    /// let x = ListImportJobsResponse::new().set_next_page_token("example");
11865    /// ```
11866    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11867        self.next_page_token = v.into();
11868        self
11869    }
11870
11871    /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
11872    ///
11873    /// # Example
11874    /// ```ignore,no_run
11875    /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11876    /// let x = ListImportJobsResponse::new().set_total_size(42);
11877    /// ```
11878    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11879        self.total_size = v.into();
11880        self
11881    }
11882}
11883
11884impl wkt::message::Message for ListImportJobsResponse {
11885    fn typename() -> &'static str {
11886        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
11887    }
11888}
11889
11890#[doc(hidden)]
11891impl google_cloud_gax::paginator::internal::PageableResponse for ListImportJobsResponse {
11892    type PageItem = crate::model::ImportJob;
11893
11894    fn items(self) -> std::vec::Vec<Self::PageItem> {
11895        self.import_jobs
11896    }
11897
11898    fn next_page_token(&self) -> std::string::String {
11899        use std::clone::Clone;
11900        self.next_page_token.clone()
11901    }
11902}
11903
11904/// Response message for
11905/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11906///
11907/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11908#[derive(Clone, Default, PartialEq)]
11909#[non_exhaustive]
11910pub struct ListRetiredResourcesResponse {
11911    /// The list of [RetiredResources][google.cloud.kms.v1.RetiredResource].
11912    ///
11913    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11914    pub retired_resources: std::vec::Vec<crate::model::RetiredResource>,
11915
11916    /// A token to retrieve the next page of results. Pass this value in
11917    /// [ListRetiredResourcesRequest.page_token][google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]
11918    /// to retrieve the next page of results.
11919    ///
11920    /// [google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]: crate::model::ListRetiredResourcesRequest::page_token
11921    pub next_page_token: std::string::String,
11922
11923    /// The total number of [RetiredResources][google.cloud.kms.v1.RetiredResource]
11924    /// that matched the query.
11925    ///
11926    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11927    pub total_size: i64,
11928
11929    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11930}
11931
11932impl ListRetiredResourcesResponse {
11933    /// Creates a new default instance.
11934    pub fn new() -> Self {
11935        std::default::Default::default()
11936    }
11937
11938    /// Sets the value of [retired_resources][crate::model::ListRetiredResourcesResponse::retired_resources].
11939    ///
11940    /// # Example
11941    /// ```ignore,no_run
11942    /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11943    /// use google_cloud_kms_v1::model::RetiredResource;
11944    /// let x = ListRetiredResourcesResponse::new()
11945    ///     .set_retired_resources([
11946    ///         RetiredResource::default()/* use setters */,
11947    ///         RetiredResource::default()/* use (different) setters */,
11948    ///     ]);
11949    /// ```
11950    pub fn set_retired_resources<T, V>(mut self, v: T) -> Self
11951    where
11952        T: std::iter::IntoIterator<Item = V>,
11953        V: std::convert::Into<crate::model::RetiredResource>,
11954    {
11955        use std::iter::Iterator;
11956        self.retired_resources = v.into_iter().map(|i| i.into()).collect();
11957        self
11958    }
11959
11960    /// Sets the value of [next_page_token][crate::model::ListRetiredResourcesResponse::next_page_token].
11961    ///
11962    /// # Example
11963    /// ```ignore,no_run
11964    /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11965    /// let x = ListRetiredResourcesResponse::new().set_next_page_token("example");
11966    /// ```
11967    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11968        self.next_page_token = v.into();
11969        self
11970    }
11971
11972    /// Sets the value of [total_size][crate::model::ListRetiredResourcesResponse::total_size].
11973    ///
11974    /// # Example
11975    /// ```ignore,no_run
11976    /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11977    /// let x = ListRetiredResourcesResponse::new().set_total_size(42);
11978    /// ```
11979    pub fn set_total_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11980        self.total_size = v.into();
11981        self
11982    }
11983}
11984
11985impl wkt::message::Message for ListRetiredResourcesResponse {
11986    fn typename() -> &'static str {
11987        "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesResponse"
11988    }
11989}
11990
11991#[doc(hidden)]
11992impl google_cloud_gax::paginator::internal::PageableResponse for ListRetiredResourcesResponse {
11993    type PageItem = crate::model::RetiredResource;
11994
11995    fn items(self) -> std::vec::Vec<Self::PageItem> {
11996        self.retired_resources
11997    }
11998
11999    fn next_page_token(&self) -> std::string::String {
12000        use std::clone::Clone;
12001        self.next_page_token.clone()
12002    }
12003}
12004
12005/// Request message for
12006/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
12007///
12008/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
12009#[derive(Clone, Default, PartialEq)]
12010#[non_exhaustive]
12011pub struct GetKeyRingRequest {
12012    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
12013    /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
12014    ///
12015    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12016    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12017    pub name: std::string::String,
12018
12019    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12020}
12021
12022impl GetKeyRingRequest {
12023    /// Creates a new default instance.
12024    pub fn new() -> Self {
12025        std::default::Default::default()
12026    }
12027
12028    /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
12029    ///
12030    /// # Example
12031    /// ```ignore,no_run
12032    /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
12033    /// # let project_id = "project_id";
12034    /// # let location_id = "location_id";
12035    /// # let key_ring_id = "key_ring_id";
12036    /// let x = GetKeyRingRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
12037    /// ```
12038    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12039        self.name = v.into();
12040        self
12041    }
12042}
12043
12044impl wkt::message::Message for GetKeyRingRequest {
12045    fn typename() -> &'static str {
12046        "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
12047    }
12048}
12049
12050/// Request message for
12051/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
12052///
12053/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
12054#[derive(Clone, Default, PartialEq)]
12055#[non_exhaustive]
12056pub struct GetCryptoKeyRequest {
12057    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12058    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
12059    ///
12060    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12061    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12062    pub name: std::string::String,
12063
12064    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12065}
12066
12067impl GetCryptoKeyRequest {
12068    /// Creates a new default instance.
12069    pub fn new() -> Self {
12070        std::default::Default::default()
12071    }
12072
12073    /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
12074    ///
12075    /// # Example
12076    /// ```ignore,no_run
12077    /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
12078    /// # let project_id = "project_id";
12079    /// # let location_id = "location_id";
12080    /// # let key_ring_id = "key_ring_id";
12081    /// # let crypto_key_id = "crypto_key_id";
12082    /// let x = GetCryptoKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12083    /// ```
12084    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12085        self.name = v.into();
12086        self
12087    }
12088}
12089
12090impl wkt::message::Message for GetCryptoKeyRequest {
12091    fn typename() -> &'static str {
12092        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
12093    }
12094}
12095
12096/// Request message for
12097/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
12098///
12099/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
12100#[derive(Clone, Default, PartialEq)]
12101#[non_exhaustive]
12102pub struct GetCryptoKeyVersionRequest {
12103    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12104    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
12105    ///
12106    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12107    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12108    pub name: std::string::String,
12109
12110    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12111}
12112
12113impl GetCryptoKeyVersionRequest {
12114    /// Creates a new default instance.
12115    pub fn new() -> Self {
12116        std::default::Default::default()
12117    }
12118
12119    /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
12120    ///
12121    /// # Example
12122    /// ```ignore,no_run
12123    /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
12124    /// # let project_id = "project_id";
12125    /// # let location_id = "location_id";
12126    /// # let key_ring_id = "key_ring_id";
12127    /// # let crypto_key_id = "crypto_key_id";
12128    /// # let crypto_key_version_id = "crypto_key_version_id";
12129    /// let x = GetCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12130    /// ```
12131    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12132        self.name = v.into();
12133        self
12134    }
12135}
12136
12137impl wkt::message::Message for GetCryptoKeyVersionRequest {
12138    fn typename() -> &'static str {
12139        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
12140    }
12141}
12142
12143/// Request message for
12144/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
12145///
12146/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
12147#[derive(Clone, Default, PartialEq)]
12148#[non_exhaustive]
12149pub struct GetPublicKeyRequest {
12150    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12151    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
12152    ///
12153    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12154    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12155    pub name: std::string::String,
12156
12157    /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
12158    /// by the user. This field is required for PQC algorithms. If specified, the
12159    /// public key will be exported through the
12160    /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
12161    /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
12162    /// field will be populated for non-PQC algorithms, and an error will be
12163    /// returned for PQC algorithms.
12164    ///
12165    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
12166    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
12167    /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
12168    pub public_key_format: crate::model::public_key::PublicKeyFormat,
12169
12170    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12171}
12172
12173impl GetPublicKeyRequest {
12174    /// Creates a new default instance.
12175    pub fn new() -> Self {
12176        std::default::Default::default()
12177    }
12178
12179    /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
12180    ///
12181    /// # Example
12182    /// ```ignore,no_run
12183    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
12184    /// # let project_id = "project_id";
12185    /// # let location_id = "location_id";
12186    /// # let key_ring_id = "key_ring_id";
12187    /// # let crypto_key_id = "crypto_key_id";
12188    /// # let crypto_key_version_id = "crypto_key_version_id";
12189    /// let x = GetPublicKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12190    /// ```
12191    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12192        self.name = v.into();
12193        self
12194    }
12195
12196    /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
12197    ///
12198    /// # Example
12199    /// ```ignore,no_run
12200    /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
12201    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
12202    /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
12203    /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
12204    /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
12205    /// ```
12206    pub fn set_public_key_format<
12207        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
12208    >(
12209        mut self,
12210        v: T,
12211    ) -> Self {
12212        self.public_key_format = v.into();
12213        self
12214    }
12215}
12216
12217impl wkt::message::Message for GetPublicKeyRequest {
12218    fn typename() -> &'static str {
12219        "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
12220    }
12221}
12222
12223/// Request message for
12224/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
12225///
12226/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
12227#[derive(Clone, Default, PartialEq)]
12228#[non_exhaustive]
12229pub struct GetImportJobRequest {
12230    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12231    /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
12232    ///
12233    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12234    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12235    pub name: std::string::String,
12236
12237    /// Optional. Specifies the [WrappingPublicKey][] format.
12238    /// If not specified:
12239    ///
12240    /// * For RSA-based import methods, the wrapping key will be returned in PEM
12241    ///   format
12242    /// * For pure ML-KEM-based import methods, the wrapping key will be returned
12243    ///   in the raw bytes format specified in FIPS-203
12244    /// * For X-Wing-based import methods, the wrapping key will be returned in
12245    ///   the raw bytes format specified in
12246    ///   <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
12247    pub public_key_format: crate::model::public_key::PublicKeyFormat,
12248
12249    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12250}
12251
12252impl GetImportJobRequest {
12253    /// Creates a new default instance.
12254    pub fn new() -> Self {
12255        std::default::Default::default()
12256    }
12257
12258    /// Sets the value of [name][crate::model::GetImportJobRequest::name].
12259    ///
12260    /// # Example
12261    /// ```ignore,no_run
12262    /// # use google_cloud_kms_v1::model::GetImportJobRequest;
12263    /// # let project_id = "project_id";
12264    /// # let location_id = "location_id";
12265    /// # let key_ring_id = "key_ring_id";
12266    /// # let import_job_id = "import_job_id";
12267    /// let x = GetImportJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/importJobs/{import_job_id}"));
12268    /// ```
12269    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12270        self.name = v.into();
12271        self
12272    }
12273
12274    /// Sets the value of [public_key_format][crate::model::GetImportJobRequest::public_key_format].
12275    ///
12276    /// # Example
12277    /// ```ignore,no_run
12278    /// # use google_cloud_kms_v1::model::GetImportJobRequest;
12279    /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
12280    /// let x0 = GetImportJobRequest::new().set_public_key_format(PublicKeyFormat::Pem);
12281    /// let x1 = GetImportJobRequest::new().set_public_key_format(PublicKeyFormat::Der);
12282    /// let x2 = GetImportJobRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
12283    /// ```
12284    pub fn set_public_key_format<
12285        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
12286    >(
12287        mut self,
12288        v: T,
12289    ) -> Self {
12290        self.public_key_format = v.into();
12291        self
12292    }
12293}
12294
12295impl wkt::message::Message for GetImportJobRequest {
12296    fn typename() -> &'static str {
12297        "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
12298    }
12299}
12300
12301/// Request message for
12302/// [KeyManagementService.GetRetiredResource][google.cloud.kms.v1.KeyManagementService.GetRetiredResource].
12303///
12304/// [google.cloud.kms.v1.KeyManagementService.GetRetiredResource]: crate::client::KeyManagementService::get_retired_resource
12305#[derive(Clone, Default, PartialEq)]
12306#[non_exhaustive]
12307pub struct GetRetiredResourceRequest {
12308    /// Required. The [name][google.cloud.kms.v1.RetiredResource.name] of the
12309    /// [RetiredResource][google.cloud.kms.v1.RetiredResource] to get.
12310    ///
12311    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
12312    /// [google.cloud.kms.v1.RetiredResource.name]: crate::model::RetiredResource::name
12313    pub name: std::string::String,
12314
12315    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12316}
12317
12318impl GetRetiredResourceRequest {
12319    /// Creates a new default instance.
12320    pub fn new() -> Self {
12321        std::default::Default::default()
12322    }
12323
12324    /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
12325    ///
12326    /// # Example
12327    /// ```ignore,no_run
12328    /// # use google_cloud_kms_v1::model::GetRetiredResourceRequest;
12329    /// # let project_id = "project_id";
12330    /// # let location_id = "location_id";
12331    /// # let retired_resource_id = "retired_resource_id";
12332    /// let x = GetRetiredResourceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
12333    /// ```
12334    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12335        self.name = v.into();
12336        self
12337    }
12338}
12339
12340impl wkt::message::Message for GetRetiredResourceRequest {
12341    fn typename() -> &'static str {
12342        "type.googleapis.com/google.cloud.kms.v1.GetRetiredResourceRequest"
12343    }
12344}
12345
12346/// Request message for
12347/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
12348///
12349/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
12350#[derive(Clone, Default, PartialEq)]
12351#[non_exhaustive]
12352pub struct CreateKeyRingRequest {
12353    /// Required. The resource name of the location associated with the
12354    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
12355    /// `projects/*/locations/*`.
12356    ///
12357    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12358    pub parent: std::string::String,
12359
12360    /// Required. It must be unique within a location and match the regular
12361    /// expression `[a-zA-Z0-9_-]{1,63}`
12362    pub key_ring_id: std::string::String,
12363
12364    /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
12365    /// values.
12366    ///
12367    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12368    pub key_ring: std::option::Option<crate::model::KeyRing>,
12369
12370    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12371}
12372
12373impl CreateKeyRingRequest {
12374    /// Creates a new default instance.
12375    pub fn new() -> Self {
12376        std::default::Default::default()
12377    }
12378
12379    /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
12380    ///
12381    /// # Example
12382    /// ```ignore,no_run
12383    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12384    /// let x = CreateKeyRingRequest::new().set_parent("example");
12385    /// ```
12386    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12387        self.parent = v.into();
12388        self
12389    }
12390
12391    /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
12392    ///
12393    /// # Example
12394    /// ```ignore,no_run
12395    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12396    /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
12397    /// ```
12398    pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12399        self.key_ring_id = v.into();
12400        self
12401    }
12402
12403    /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12404    ///
12405    /// # Example
12406    /// ```ignore,no_run
12407    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12408    /// use google_cloud_kms_v1::model::KeyRing;
12409    /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
12410    /// ```
12411    pub fn set_key_ring<T>(mut self, v: T) -> Self
12412    where
12413        T: std::convert::Into<crate::model::KeyRing>,
12414    {
12415        self.key_ring = std::option::Option::Some(v.into());
12416        self
12417    }
12418
12419    /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12420    ///
12421    /// # Example
12422    /// ```ignore,no_run
12423    /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12424    /// use google_cloud_kms_v1::model::KeyRing;
12425    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
12426    /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
12427    /// ```
12428    pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
12429    where
12430        T: std::convert::Into<crate::model::KeyRing>,
12431    {
12432        self.key_ring = v.map(|x| x.into());
12433        self
12434    }
12435}
12436
12437impl wkt::message::Message for CreateKeyRingRequest {
12438    fn typename() -> &'static str {
12439        "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
12440    }
12441}
12442
12443/// Request message for
12444/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
12445///
12446/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
12447#[derive(Clone, Default, PartialEq)]
12448#[non_exhaustive]
12449pub struct CreateCryptoKeyRequest {
12450    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
12451    /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
12452    ///
12453    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12454    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12455    pub parent: std::string::String,
12456
12457    /// Required. It must be unique within a KeyRing and match the regular
12458    /// expression `[a-zA-Z0-9_-]{1,63}`
12459    pub crypto_key_id: std::string::String,
12460
12461    /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
12462    /// values.
12463    ///
12464    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12465    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12466
12467    /// If set to true, the request will create a
12468    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
12469    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
12470    /// manually call
12471    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
12472    /// or
12473    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
12474    /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
12475    ///
12476    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12477    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12478    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12479    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12480    pub skip_initial_version_creation: bool,
12481
12482    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12483}
12484
12485impl CreateCryptoKeyRequest {
12486    /// Creates a new default instance.
12487    pub fn new() -> Self {
12488        std::default::Default::default()
12489    }
12490
12491    /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
12492    ///
12493    /// # Example
12494    /// ```ignore,no_run
12495    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12496    /// # let project_id = "project_id";
12497    /// # let location_id = "location_id";
12498    /// # let key_ring_id = "key_ring_id";
12499    /// let x = CreateCryptoKeyRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
12500    /// ```
12501    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12502        self.parent = v.into();
12503        self
12504    }
12505
12506    /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
12507    ///
12508    /// # Example
12509    /// ```ignore,no_run
12510    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12511    /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
12512    /// ```
12513    pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12514        self.crypto_key_id = v.into();
12515        self
12516    }
12517
12518    /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12519    ///
12520    /// # Example
12521    /// ```ignore,no_run
12522    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12523    /// use google_cloud_kms_v1::model::CryptoKey;
12524    /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12525    /// ```
12526    pub fn set_crypto_key<T>(mut self, v: T) -> Self
12527    where
12528        T: std::convert::Into<crate::model::CryptoKey>,
12529    {
12530        self.crypto_key = std::option::Option::Some(v.into());
12531        self
12532    }
12533
12534    /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12535    ///
12536    /// # Example
12537    /// ```ignore,no_run
12538    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12539    /// use google_cloud_kms_v1::model::CryptoKey;
12540    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12541    /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12542    /// ```
12543    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12544    where
12545        T: std::convert::Into<crate::model::CryptoKey>,
12546    {
12547        self.crypto_key = v.map(|x| x.into());
12548        self
12549    }
12550
12551    /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
12552    ///
12553    /// # Example
12554    /// ```ignore,no_run
12555    /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12556    /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
12557    /// ```
12558    pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12559        self.skip_initial_version_creation = v.into();
12560        self
12561    }
12562}
12563
12564impl wkt::message::Message for CreateCryptoKeyRequest {
12565    fn typename() -> &'static str {
12566        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
12567    }
12568}
12569
12570/// Request message for
12571/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
12572///
12573/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12574#[derive(Clone, Default, PartialEq)]
12575#[non_exhaustive]
12576pub struct CreateCryptoKeyVersionRequest {
12577    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12578    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
12579    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
12580    ///
12581    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12582    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12583    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12584    pub parent: std::string::String,
12585
12586    /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12587    /// initial field values.
12588    ///
12589    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12590    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12591
12592    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12593}
12594
12595impl CreateCryptoKeyVersionRequest {
12596    /// Creates a new default instance.
12597    pub fn new() -> Self {
12598        std::default::Default::default()
12599    }
12600
12601    /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
12602    ///
12603    /// # Example
12604    /// ```ignore,no_run
12605    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12606    /// # let project_id = "project_id";
12607    /// # let location_id = "location_id";
12608    /// # let key_ring_id = "key_ring_id";
12609    /// # let crypto_key_id = "crypto_key_id";
12610    /// let x = CreateCryptoKeyVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12611    /// ```
12612    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12613        self.parent = v.into();
12614        self
12615    }
12616
12617    /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12618    ///
12619    /// # Example
12620    /// ```ignore,no_run
12621    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12622    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12623    /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12624    /// ```
12625    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12626    where
12627        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12628    {
12629        self.crypto_key_version = std::option::Option::Some(v.into());
12630        self
12631    }
12632
12633    /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12634    ///
12635    /// # Example
12636    /// ```ignore,no_run
12637    /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12638    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12639    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12640    /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12641    /// ```
12642    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12643    where
12644        T: std::convert::Into<crate::model::CryptoKeyVersion>,
12645    {
12646        self.crypto_key_version = v.map(|x| x.into());
12647        self
12648    }
12649}
12650
12651impl wkt::message::Message for CreateCryptoKeyVersionRequest {
12652    fn typename() -> &'static str {
12653        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
12654    }
12655}
12656
12657/// Request message for
12658/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey].
12659///
12660/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
12661#[derive(Clone, Default, PartialEq)]
12662#[non_exhaustive]
12663pub struct DeleteCryptoKeyRequest {
12664    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12665    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to delete.
12666    ///
12667    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12668    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12669    pub name: std::string::String,
12670
12671    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12672}
12673
12674impl DeleteCryptoKeyRequest {
12675    /// Creates a new default instance.
12676    pub fn new() -> Self {
12677        std::default::Default::default()
12678    }
12679
12680    /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
12681    ///
12682    /// # Example
12683    /// ```ignore,no_run
12684    /// # use google_cloud_kms_v1::model::DeleteCryptoKeyRequest;
12685    /// # let project_id = "project_id";
12686    /// # let location_id = "location_id";
12687    /// # let key_ring_id = "key_ring_id";
12688    /// # let crypto_key_id = "crypto_key_id";
12689    /// let x = DeleteCryptoKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12690    /// ```
12691    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12692        self.name = v.into();
12693        self
12694    }
12695}
12696
12697impl wkt::message::Message for DeleteCryptoKeyRequest {
12698    fn typename() -> &'static str {
12699        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyRequest"
12700    }
12701}
12702
12703/// Request message for
12704/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion].
12705///
12706/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
12707#[derive(Clone, Default, PartialEq)]
12708#[non_exhaustive]
12709pub struct DeleteCryptoKeyVersionRequest {
12710    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12711    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to delete.
12712    ///
12713    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12714    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12715    pub name: std::string::String,
12716
12717    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12718}
12719
12720impl DeleteCryptoKeyVersionRequest {
12721    /// Creates a new default instance.
12722    pub fn new() -> Self {
12723        std::default::Default::default()
12724    }
12725
12726    /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
12727    ///
12728    /// # Example
12729    /// ```ignore,no_run
12730    /// # use google_cloud_kms_v1::model::DeleteCryptoKeyVersionRequest;
12731    /// # let project_id = "project_id";
12732    /// # let location_id = "location_id";
12733    /// # let key_ring_id = "key_ring_id";
12734    /// # let crypto_key_id = "crypto_key_id";
12735    /// # let crypto_key_version_id = "crypto_key_version_id";
12736    /// let x = DeleteCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12737    /// ```
12738    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12739        self.name = v.into();
12740        self
12741    }
12742}
12743
12744impl wkt::message::Message for DeleteCryptoKeyVersionRequest {
12745    fn typename() -> &'static str {
12746        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionRequest"
12747    }
12748}
12749
12750/// Request message for
12751/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
12752///
12753/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12754#[derive(Clone, Default, PartialEq)]
12755#[non_exhaustive]
12756pub struct ImportCryptoKeyVersionRequest {
12757    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12758    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
12759    ///
12760    /// The create permission is only required on this key when creating a new
12761    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
12762    ///
12763    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12764    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12765    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12766    pub parent: std::string::String,
12767
12768    /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
12769    /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
12770    /// target for an import operation. If this field is not present, a new
12771    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
12772    /// supplied key material is created.
12773    ///
12774    /// If this field is present, the supplied key material is imported into
12775    /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
12776    /// import into an existing
12777    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
12778    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
12779    /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
12780    /// have been previously created via
12781    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
12782    /// and be in
12783    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
12784    /// or
12785    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
12786    /// state. The key material and algorithm must match the previous
12787    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
12788    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
12789    /// key material.
12790    ///
12791    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12792    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
12793    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
12794    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12795    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
12796    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12797    pub crypto_key_version: std::string::String,
12798
12799    /// Required. The
12800    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
12801    /// of the key being imported. This does not need to match the
12802    /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
12803    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
12804    ///
12805    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12806    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
12807    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
12808    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
12809
12810    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12811    /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
12812    /// material.
12813    ///
12814    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12815    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12816    pub import_job: std::string::String,
12817
12818    /// Optional. The wrapped key material to import.
12819    ///
12820    /// Before wrapping, key material must be formatted. If importing symmetric key
12821    /// material, the expected key material format is plain bytes. If importing
12822    /// asymmetric key material, the expected key material format is PKCS#8-encoded
12823    /// DER (the PrivateKeyInfo structure from RFC 5208).
12824    ///
12825    /// When wrapping with import methods
12826    /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
12827    /// or
12828    /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
12829    /// or
12830    /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
12831    /// or
12832    /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
12833    ///
12834    /// this field must contain the concatenation of:
12835    ///
12836    /// This format is the same as the format produced by PKCS#11 mechanism
12837    /// CKM_RSA_AES_KEY_WRAP.
12838    ///
12839    /// When wrapping with import methods
12840    /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
12841    /// or
12842    /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
12843    ///
12844    /// this field must contain the formatted key to be imported, wrapped with the
12845    /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
12846    /// with SHA-256, MGF1 with SHA-256, and an empty label.
12847    ///
12848    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
12849    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
12850    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
12851    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
12852    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
12853    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
12854    /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
12855    pub wrapped_key: ::bytes::Bytes,
12856
12857    /// This field is legacy. Use the field
12858    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12859    /// instead.
12860    ///
12861    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12862    pub wrapped_key_material:
12863        std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
12864
12865    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12866}
12867
12868impl ImportCryptoKeyVersionRequest {
12869    /// Creates a new default instance.
12870    pub fn new() -> Self {
12871        std::default::Default::default()
12872    }
12873
12874    /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
12875    ///
12876    /// # Example
12877    /// ```ignore,no_run
12878    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12879    /// # let project_id = "project_id";
12880    /// # let location_id = "location_id";
12881    /// # let key_ring_id = "key_ring_id";
12882    /// # let crypto_key_id = "crypto_key_id";
12883    /// let x = ImportCryptoKeyVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12884    /// ```
12885    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12886        self.parent = v.into();
12887        self
12888    }
12889
12890    /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
12891    ///
12892    /// # Example
12893    /// ```ignore,no_run
12894    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12895    /// # let project_id = "project_id";
12896    /// # let location_id = "location_id";
12897    /// # let key_ring_id = "key_ring_id";
12898    /// # let crypto_key_id = "crypto_key_id";
12899    /// # let crypto_key_version_id = "crypto_key_version_id";
12900    /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12901    /// ```
12902    pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
12903        mut self,
12904        v: T,
12905    ) -> Self {
12906        self.crypto_key_version = v.into();
12907        self
12908    }
12909
12910    /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
12911    ///
12912    /// # Example
12913    /// ```ignore,no_run
12914    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12915    /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
12916    /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
12917    /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
12918    /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
12919    /// ```
12920    pub fn set_algorithm<
12921        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
12922    >(
12923        mut self,
12924        v: T,
12925    ) -> Self {
12926        self.algorithm = v.into();
12927        self
12928    }
12929
12930    /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
12931    ///
12932    /// # Example
12933    /// ```ignore,no_run
12934    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12935    /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
12936    /// ```
12937    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12938        self.import_job = v.into();
12939        self
12940    }
12941
12942    /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
12943    ///
12944    /// # Example
12945    /// ```ignore,no_run
12946    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12947    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
12948    /// ```
12949    pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12950        self.wrapped_key = v.into();
12951        self
12952    }
12953
12954    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
12955    ///
12956    /// Note that all the setters affecting `wrapped_key_material` are mutually
12957    /// exclusive.
12958    ///
12959    /// # Example
12960    /// ```ignore,no_run
12961    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12962    /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
12963    /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
12964    /// ```
12965    pub fn set_wrapped_key_material<
12966        T: std::convert::Into<
12967                std::option::Option<
12968                    crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
12969                >,
12970            >,
12971    >(
12972        mut self,
12973        v: T,
12974    ) -> Self {
12975        self.wrapped_key_material = v.into();
12976        self
12977    }
12978
12979    /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12980    /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
12981    /// holds a different branch.
12982    pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
12983        #[allow(unreachable_patterns)]
12984        self.wrapped_key_material.as_ref().and_then(|v| match v {
12985            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
12986            _ => std::option::Option::None,
12987        })
12988    }
12989
12990    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12991    /// to hold a `RsaAesWrappedKey`.
12992    ///
12993    /// Note that all the setters affecting `wrapped_key_material` are
12994    /// mutually exclusive.
12995    ///
12996    /// # Example
12997    /// ```ignore,no_run
12998    /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12999    /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
13000    /// assert!(x.rsa_aes_wrapped_key().is_some());
13001    /// ```
13002    pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13003        self.wrapped_key_material = std::option::Option::Some(
13004            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
13005                v.into(),
13006            ),
13007        );
13008        self
13009    }
13010}
13011
13012impl wkt::message::Message for ImportCryptoKeyVersionRequest {
13013    fn typename() -> &'static str {
13014        "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
13015    }
13016}
13017
13018/// Defines additional types related to [ImportCryptoKeyVersionRequest].
13019pub mod import_crypto_key_version_request {
13020    #[allow(unused_imports)]
13021    use super::*;
13022
13023    /// This field is legacy. Use the field
13024    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
13025    /// instead.
13026    ///
13027    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
13028    #[derive(Clone, Debug, PartialEq)]
13029    #[non_exhaustive]
13030    pub enum WrappedKeyMaterial {
13031        /// Optional. This field has the same meaning as
13032        /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
13033        /// Prefer to use that field in new work. Either that field or this field
13034        /// (but not both) must be specified.
13035        ///
13036        /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
13037        RsaAesWrappedKey(::bytes::Bytes),
13038    }
13039}
13040
13041/// Request message for
13042/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
13043///
13044/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
13045#[derive(Clone, Default, PartialEq)]
13046#[non_exhaustive]
13047pub struct CreateImportJobRequest {
13048    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
13049    /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
13050    /// [ImportJobs][google.cloud.kms.v1.ImportJob].
13051    ///
13052    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
13053    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
13054    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
13055    pub parent: std::string::String,
13056
13057    /// Required. It must be unique within a KeyRing and match the regular
13058    /// expression `[a-zA-Z0-9_-]{1,63}`
13059    pub import_job_id: std::string::String,
13060
13061    /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
13062    /// values.
13063    ///
13064    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
13065    pub import_job: std::option::Option<crate::model::ImportJob>,
13066
13067    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13068}
13069
13070impl CreateImportJobRequest {
13071    /// Creates a new default instance.
13072    pub fn new() -> Self {
13073        std::default::Default::default()
13074    }
13075
13076    /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
13077    ///
13078    /// # Example
13079    /// ```ignore,no_run
13080    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13081    /// # let project_id = "project_id";
13082    /// # let location_id = "location_id";
13083    /// # let key_ring_id = "key_ring_id";
13084    /// let x = CreateImportJobRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
13085    /// ```
13086    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13087        self.parent = v.into();
13088        self
13089    }
13090
13091    /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
13092    ///
13093    /// # Example
13094    /// ```ignore,no_run
13095    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13096    /// let x = CreateImportJobRequest::new().set_import_job_id("example");
13097    /// ```
13098    pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13099        self.import_job_id = v.into();
13100        self
13101    }
13102
13103    /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
13104    ///
13105    /// # Example
13106    /// ```ignore,no_run
13107    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13108    /// use google_cloud_kms_v1::model::ImportJob;
13109    /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
13110    /// ```
13111    pub fn set_import_job<T>(mut self, v: T) -> Self
13112    where
13113        T: std::convert::Into<crate::model::ImportJob>,
13114    {
13115        self.import_job = std::option::Option::Some(v.into());
13116        self
13117    }
13118
13119    /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
13120    ///
13121    /// # Example
13122    /// ```ignore,no_run
13123    /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13124    /// use google_cloud_kms_v1::model::ImportJob;
13125    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
13126    /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
13127    /// ```
13128    pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
13129    where
13130        T: std::convert::Into<crate::model::ImportJob>,
13131    {
13132        self.import_job = v.map(|x| x.into());
13133        self
13134    }
13135}
13136
13137impl wkt::message::Message for CreateImportJobRequest {
13138    fn typename() -> &'static str {
13139        "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
13140    }
13141}
13142
13143/// Request message for
13144/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
13145///
13146/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
13147#[derive(Clone, Default, PartialEq)]
13148#[non_exhaustive]
13149pub struct UpdateCryptoKeyRequest {
13150    /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
13151    ///
13152    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13153    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
13154
13155    /// Required. List of fields to be updated in this request.
13156    pub update_mask: std::option::Option<wkt::FieldMask>,
13157
13158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13159}
13160
13161impl UpdateCryptoKeyRequest {
13162    /// Creates a new default instance.
13163    pub fn new() -> Self {
13164        std::default::Default::default()
13165    }
13166
13167    /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
13168    ///
13169    /// # Example
13170    /// ```ignore,no_run
13171    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13172    /// use google_cloud_kms_v1::model::CryptoKey;
13173    /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
13174    /// ```
13175    pub fn set_crypto_key<T>(mut self, v: T) -> Self
13176    where
13177        T: std::convert::Into<crate::model::CryptoKey>,
13178    {
13179        self.crypto_key = std::option::Option::Some(v.into());
13180        self
13181    }
13182
13183    /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
13184    ///
13185    /// # Example
13186    /// ```ignore,no_run
13187    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13188    /// use google_cloud_kms_v1::model::CryptoKey;
13189    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
13190    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
13191    /// ```
13192    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
13193    where
13194        T: std::convert::Into<crate::model::CryptoKey>,
13195    {
13196        self.crypto_key = v.map(|x| x.into());
13197        self
13198    }
13199
13200    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
13201    ///
13202    /// # Example
13203    /// ```ignore,no_run
13204    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13205    /// use wkt::FieldMask;
13206    /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13207    /// ```
13208    pub fn set_update_mask<T>(mut self, v: T) -> Self
13209    where
13210        T: std::convert::Into<wkt::FieldMask>,
13211    {
13212        self.update_mask = std::option::Option::Some(v.into());
13213        self
13214    }
13215
13216    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
13217    ///
13218    /// # Example
13219    /// ```ignore,no_run
13220    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13221    /// use wkt::FieldMask;
13222    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13223    /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13224    /// ```
13225    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13226    where
13227        T: std::convert::Into<wkt::FieldMask>,
13228    {
13229        self.update_mask = v.map(|x| x.into());
13230        self
13231    }
13232}
13233
13234impl wkt::message::Message for UpdateCryptoKeyRequest {
13235    fn typename() -> &'static str {
13236        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
13237    }
13238}
13239
13240/// Request message for
13241/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
13242///
13243/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
13244#[derive(Clone, Default, PartialEq)]
13245#[non_exhaustive]
13246pub struct UpdateCryptoKeyVersionRequest {
13247    /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
13248    /// updated values.
13249    ///
13250    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13251    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
13252
13253    /// Required. List of fields to be updated in this request.
13254    pub update_mask: std::option::Option<wkt::FieldMask>,
13255
13256    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13257}
13258
13259impl UpdateCryptoKeyVersionRequest {
13260    /// Creates a new default instance.
13261    pub fn new() -> Self {
13262        std::default::Default::default()
13263    }
13264
13265    /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
13266    ///
13267    /// # Example
13268    /// ```ignore,no_run
13269    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13270    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
13271    /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
13272    /// ```
13273    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
13274    where
13275        T: std::convert::Into<crate::model::CryptoKeyVersion>,
13276    {
13277        self.crypto_key_version = std::option::Option::Some(v.into());
13278        self
13279    }
13280
13281    /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
13282    ///
13283    /// # Example
13284    /// ```ignore,no_run
13285    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13286    /// use google_cloud_kms_v1::model::CryptoKeyVersion;
13287    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
13288    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
13289    /// ```
13290    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
13291    where
13292        T: std::convert::Into<crate::model::CryptoKeyVersion>,
13293    {
13294        self.crypto_key_version = v.map(|x| x.into());
13295        self
13296    }
13297
13298    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13299    ///
13300    /// # Example
13301    /// ```ignore,no_run
13302    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13303    /// use wkt::FieldMask;
13304    /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13305    /// ```
13306    pub fn set_update_mask<T>(mut self, v: T) -> Self
13307    where
13308        T: std::convert::Into<wkt::FieldMask>,
13309    {
13310        self.update_mask = std::option::Option::Some(v.into());
13311        self
13312    }
13313
13314    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13315    ///
13316    /// # Example
13317    /// ```ignore,no_run
13318    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13319    /// use wkt::FieldMask;
13320    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13321    /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13322    /// ```
13323    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13324    where
13325        T: std::convert::Into<wkt::FieldMask>,
13326    {
13327        self.update_mask = v.map(|x| x.into());
13328        self
13329    }
13330}
13331
13332impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
13333    fn typename() -> &'static str {
13334        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
13335    }
13336}
13337
13338/// Request message for
13339/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
13340///
13341/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
13342#[derive(Clone, Default, PartialEq)]
13343#[non_exhaustive]
13344pub struct UpdateCryptoKeyPrimaryVersionRequest {
13345    /// Required. The resource name of the
13346    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
13347    ///
13348    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13349    pub name: std::string::String,
13350
13351    /// Required. The id of the child
13352    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
13353    ///
13354    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13355    pub crypto_key_version_id: std::string::String,
13356
13357    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13358}
13359
13360impl UpdateCryptoKeyPrimaryVersionRequest {
13361    /// Creates a new default instance.
13362    pub fn new() -> Self {
13363        std::default::Default::default()
13364    }
13365
13366    /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
13367    ///
13368    /// # Example
13369    /// ```ignore,no_run
13370    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13371    /// # let project_id = "project_id";
13372    /// # let location_id = "location_id";
13373    /// # let key_ring_id = "key_ring_id";
13374    /// # let crypto_key_id = "crypto_key_id";
13375    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
13376    /// ```
13377    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13378        self.name = v.into();
13379        self
13380    }
13381
13382    /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
13383    ///
13384    /// # Example
13385    /// ```ignore,no_run
13386    /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13387    /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
13388    /// ```
13389    pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
13390        mut self,
13391        v: T,
13392    ) -> Self {
13393        self.crypto_key_version_id = v.into();
13394        self
13395    }
13396}
13397
13398impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
13399    fn typename() -> &'static str {
13400        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
13401    }
13402}
13403
13404/// Request message for
13405/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
13406///
13407/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
13408#[derive(Clone, Default, PartialEq)]
13409#[non_exhaustive]
13410pub struct DestroyCryptoKeyVersionRequest {
13411    /// Required. The resource name of the
13412    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
13413    ///
13414    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13415    pub name: std::string::String,
13416
13417    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13418}
13419
13420impl DestroyCryptoKeyVersionRequest {
13421    /// Creates a new default instance.
13422    pub fn new() -> Self {
13423        std::default::Default::default()
13424    }
13425
13426    /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
13427    ///
13428    /// # Example
13429    /// ```ignore,no_run
13430    /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
13431    /// # let project_id = "project_id";
13432    /// # let location_id = "location_id";
13433    /// # let key_ring_id = "key_ring_id";
13434    /// # let crypto_key_id = "crypto_key_id";
13435    /// # let crypto_key_version_id = "crypto_key_version_id";
13436    /// let x = DestroyCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
13437    /// ```
13438    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13439        self.name = v.into();
13440        self
13441    }
13442}
13443
13444impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
13445    fn typename() -> &'static str {
13446        "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
13447    }
13448}
13449
13450/// Request message for
13451/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
13452///
13453/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
13454#[derive(Clone, Default, PartialEq)]
13455#[non_exhaustive]
13456pub struct RestoreCryptoKeyVersionRequest {
13457    /// Required. The resource name of the
13458    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
13459    ///
13460    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13461    pub name: std::string::String,
13462
13463    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13464}
13465
13466impl RestoreCryptoKeyVersionRequest {
13467    /// Creates a new default instance.
13468    pub fn new() -> Self {
13469        std::default::Default::default()
13470    }
13471
13472    /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
13473    ///
13474    /// # Example
13475    /// ```ignore,no_run
13476    /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
13477    /// # let project_id = "project_id";
13478    /// # let location_id = "location_id";
13479    /// # let key_ring_id = "key_ring_id";
13480    /// # let crypto_key_id = "crypto_key_id";
13481    /// # let crypto_key_version_id = "crypto_key_version_id";
13482    /// let x = RestoreCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
13483    /// ```
13484    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13485        self.name = v.into();
13486        self
13487    }
13488}
13489
13490impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
13491    fn typename() -> &'static str {
13492        "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
13493    }
13494}
13495
13496/// Request message for
13497/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
13498///
13499/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
13500#[derive(Clone, Default, PartialEq)]
13501#[non_exhaustive]
13502pub struct EncryptRequest {
13503    /// Required. The resource name of the
13504    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
13505    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13506    /// encryption.
13507    ///
13508    /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
13509    /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
13510    ///
13511    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13512    /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
13513    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13514    pub name: std::string::String,
13515
13516    /// Required. The data to encrypt. Must be no larger than 64KiB.
13517    ///
13518    /// The maximum size depends on the key version's
13519    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13520    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13521    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13522    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
13523    /// plaintext must be no larger than 64KiB. For
13524    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13525    /// the plaintext and additional_authenticated_data fields must be no larger
13526    /// than 8KiB.
13527    ///
13528    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13529    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13530    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13531    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13532    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13533    pub plaintext: ::bytes::Bytes,
13534
13535    /// Optional. Optional data that, if specified, must also be provided during
13536    /// decryption through
13537    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13538    ///
13539    /// The maximum size depends on the key version's
13540    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13541    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13542    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13543    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
13544    /// AAD must be no larger than 64KiB. For
13545    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13546    /// the plaintext and additional_authenticated_data fields must be no larger
13547    /// than 8KiB.
13548    ///
13549    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13550    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13551    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13552    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13553    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13554    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13555    pub additional_authenticated_data: ::bytes::Bytes,
13556
13557    /// Optional. An optional CRC32C checksum of the
13558    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
13559    /// If specified,
13560    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13561    /// verify the integrity of the received
13562    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
13563    /// using this checksum.
13564    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13565    /// report an error if the checksum verification fails. If you receive a
13566    /// checksum error, your client should verify that
13567    /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
13568    /// is equal to
13569    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
13570    /// and if so, perform a limited number of retries. A persistent mismatch may
13571    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13572    /// field is defined as int64 for reasons of compatibility across different
13573    /// languages. However, it is a non-negative integer, which will never exceed
13574    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13575    /// this type.
13576    ///
13577    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
13578    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
13579    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13580    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13581
13582    /// Optional. An optional CRC32C checksum of the
13583    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13584    /// If specified,
13585    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13586    /// verify the integrity of the received
13587    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
13588    /// using this checksum.
13589    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13590    /// report an error if the checksum verification fails. If you receive a
13591    /// checksum error, your client should verify that
13592    /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
13593    /// is equal to
13594    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
13595    /// and if so, perform a limited number of retries. A persistent mismatch may
13596    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13597    /// field is defined as int64 for reasons of compatibility across different
13598    /// languages. However, it is a non-negative integer, which will never exceed
13599    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13600    /// this type.
13601    ///
13602    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13603    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
13604    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13605    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13606
13607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13608}
13609
13610impl EncryptRequest {
13611    /// Creates a new default instance.
13612    pub fn new() -> Self {
13613        std::default::Default::default()
13614    }
13615
13616    /// Sets the value of [name][crate::model::EncryptRequest::name].
13617    ///
13618    /// # Example
13619    /// ```ignore,no_run
13620    /// # use google_cloud_kms_v1::model::EncryptRequest;
13621    /// let x = EncryptRequest::new().set_name("example");
13622    /// ```
13623    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13624        self.name = v.into();
13625        self
13626    }
13627
13628    /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
13629    ///
13630    /// # Example
13631    /// ```ignore,no_run
13632    /// # use google_cloud_kms_v1::model::EncryptRequest;
13633    /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13634    /// ```
13635    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13636        self.plaintext = v.into();
13637        self
13638    }
13639
13640    /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
13641    ///
13642    /// # Example
13643    /// ```ignore,no_run
13644    /// # use google_cloud_kms_v1::model::EncryptRequest;
13645    /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13646    /// ```
13647    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13648        mut self,
13649        v: T,
13650    ) -> Self {
13651        self.additional_authenticated_data = v.into();
13652        self
13653    }
13654
13655    /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13656    ///
13657    /// # Example
13658    /// ```ignore,no_run
13659    /// # use google_cloud_kms_v1::model::EncryptRequest;
13660    /// use wkt::Int64Value;
13661    /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13662    /// ```
13663    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13664    where
13665        T: std::convert::Into<wkt::Int64Value>,
13666    {
13667        self.plaintext_crc32c = std::option::Option::Some(v.into());
13668        self
13669    }
13670
13671    /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13672    ///
13673    /// # Example
13674    /// ```ignore,no_run
13675    /// # use google_cloud_kms_v1::model::EncryptRequest;
13676    /// use wkt::Int64Value;
13677    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13678    /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13679    /// ```
13680    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13681    where
13682        T: std::convert::Into<wkt::Int64Value>,
13683    {
13684        self.plaintext_crc32c = v.map(|x| x.into());
13685        self
13686    }
13687
13688    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13689    ///
13690    /// # Example
13691    /// ```ignore,no_run
13692    /// # use google_cloud_kms_v1::model::EncryptRequest;
13693    /// use wkt::Int64Value;
13694    /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13695    /// ```
13696    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13697    where
13698        T: std::convert::Into<wkt::Int64Value>,
13699    {
13700        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13701        self
13702    }
13703
13704    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13705    ///
13706    /// # Example
13707    /// ```ignore,no_run
13708    /// # use google_cloud_kms_v1::model::EncryptRequest;
13709    /// use wkt::Int64Value;
13710    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13711    /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13712    /// ```
13713    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13714        mut self,
13715        v: std::option::Option<T>,
13716    ) -> Self
13717    where
13718        T: std::convert::Into<wkt::Int64Value>,
13719    {
13720        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13721        self
13722    }
13723}
13724
13725impl wkt::message::Message for EncryptRequest {
13726    fn typename() -> &'static str {
13727        "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
13728    }
13729}
13730
13731/// Request message for
13732/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
13733///
13734/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
13735#[derive(Clone, Default, PartialEq)]
13736#[non_exhaustive]
13737pub struct DecryptRequest {
13738    /// Required. The resource name of the
13739    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
13740    /// server will choose the appropriate version.
13741    ///
13742    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13743    pub name: std::string::String,
13744
13745    /// Required. The encrypted data originally returned in
13746    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
13747    ///
13748    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
13749    pub ciphertext: ::bytes::Bytes,
13750
13751    /// Optional. Optional data that must match the data originally supplied in
13752    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13753    ///
13754    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13755    pub additional_authenticated_data: ::bytes::Bytes,
13756
13757    /// Optional. An optional CRC32C checksum of the
13758    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
13759    /// If specified,
13760    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13761    /// verify the integrity of the received
13762    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
13763    /// using this checksum.
13764    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13765    /// report an error if the checksum verification fails. If you receive a
13766    /// checksum error, your client should verify that
13767    /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
13768    /// is equal to
13769    /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
13770    /// and if so, perform a limited number of retries. A persistent mismatch may
13771    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13772    /// field is defined as int64 for reasons of compatibility across different
13773    /// languages. However, it is a non-negative integer, which will never exceed
13774    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13775    /// this type.
13776    ///
13777    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
13778    /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
13779    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13780    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13781
13782    /// Optional. An optional CRC32C checksum of the
13783    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13784    /// If specified,
13785    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13786    /// verify the integrity of the received
13787    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
13788    /// using this checksum.
13789    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13790    /// report an error if the checksum verification fails. If you receive a
13791    /// checksum error, your client should verify that
13792    /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
13793    /// is equal to
13794    /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
13795    /// and if so, perform a limited number of retries. A persistent mismatch may
13796    /// indicate an issue in your computation of the CRC32C checksum. Note: This
13797    /// field is defined as int64 for reasons of compatibility across different
13798    /// languages. However, it is a non-negative integer, which will never exceed
13799    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13800    /// this type.
13801    ///
13802    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13803    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
13804    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13805    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13806
13807    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13808}
13809
13810impl DecryptRequest {
13811    /// Creates a new default instance.
13812    pub fn new() -> Self {
13813        std::default::Default::default()
13814    }
13815
13816    /// Sets the value of [name][crate::model::DecryptRequest::name].
13817    ///
13818    /// # Example
13819    /// ```ignore,no_run
13820    /// # use google_cloud_kms_v1::model::DecryptRequest;
13821    /// # let project_id = "project_id";
13822    /// # let location_id = "location_id";
13823    /// # let key_ring_id = "key_ring_id";
13824    /// # let crypto_key_id = "crypto_key_id";
13825    /// let x = DecryptRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
13826    /// ```
13827    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13828        self.name = v.into();
13829        self
13830    }
13831
13832    /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
13833    ///
13834    /// # Example
13835    /// ```ignore,no_run
13836    /// # use google_cloud_kms_v1::model::DecryptRequest;
13837    /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13838    /// ```
13839    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13840        self.ciphertext = v.into();
13841        self
13842    }
13843
13844    /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
13845    ///
13846    /// # Example
13847    /// ```ignore,no_run
13848    /// # use google_cloud_kms_v1::model::DecryptRequest;
13849    /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13850    /// ```
13851    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13852        mut self,
13853        v: T,
13854    ) -> Self {
13855        self.additional_authenticated_data = v.into();
13856        self
13857    }
13858
13859    /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13860    ///
13861    /// # Example
13862    /// ```ignore,no_run
13863    /// # use google_cloud_kms_v1::model::DecryptRequest;
13864    /// use wkt::Int64Value;
13865    /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13866    /// ```
13867    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13868    where
13869        T: std::convert::Into<wkt::Int64Value>,
13870    {
13871        self.ciphertext_crc32c = std::option::Option::Some(v.into());
13872        self
13873    }
13874
13875    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13876    ///
13877    /// # Example
13878    /// ```ignore,no_run
13879    /// # use google_cloud_kms_v1::model::DecryptRequest;
13880    /// use wkt::Int64Value;
13881    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13882    /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13883    /// ```
13884    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13885    where
13886        T: std::convert::Into<wkt::Int64Value>,
13887    {
13888        self.ciphertext_crc32c = v.map(|x| x.into());
13889        self
13890    }
13891
13892    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13893    ///
13894    /// # Example
13895    /// ```ignore,no_run
13896    /// # use google_cloud_kms_v1::model::DecryptRequest;
13897    /// use wkt::Int64Value;
13898    /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13899    /// ```
13900    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13901    where
13902        T: std::convert::Into<wkt::Int64Value>,
13903    {
13904        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13905        self
13906    }
13907
13908    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13909    ///
13910    /// # Example
13911    /// ```ignore,no_run
13912    /// # use google_cloud_kms_v1::model::DecryptRequest;
13913    /// use wkt::Int64Value;
13914    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13915    /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13916    /// ```
13917    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13918        mut self,
13919        v: std::option::Option<T>,
13920    ) -> Self
13921    where
13922        T: std::convert::Into<wkt::Int64Value>,
13923    {
13924        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13925        self
13926    }
13927}
13928
13929impl wkt::message::Message for DecryptRequest {
13930    fn typename() -> &'static str {
13931        "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
13932    }
13933}
13934
13935/// Request message for
13936/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
13937///
13938/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
13939#[derive(Clone, Default, PartialEq)]
13940#[non_exhaustive]
13941pub struct RawEncryptRequest {
13942    /// Required. The resource name of the
13943    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13944    /// encryption.
13945    ///
13946    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13947    pub name: std::string::String,
13948
13949    /// Required. The data to encrypt. Must be no larger than 64KiB.
13950    ///
13951    /// The maximum size depends on the key version's
13952    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13953    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13954    /// plaintext must be no larger than 64KiB. For
13955    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13956    /// the plaintext and additional_authenticated_data fields must be no larger
13957    /// than 8KiB.
13958    ///
13959    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13960    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13961    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13962    pub plaintext: ::bytes::Bytes,
13963
13964    /// Optional. Optional data that, if specified, must also be provided during
13965    /// decryption through
13966    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13967    ///
13968    /// This field may only be used in conjunction with an
13969    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
13970    /// additional authenticated data (for example, AES-GCM).
13971    ///
13972    /// The maximum size depends on the key version's
13973    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13974    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13975    /// plaintext must be no larger than 64KiB. For
13976    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13977    /// the plaintext and additional_authenticated_data fields must be no larger
13978    /// than 8KiB.
13979    ///
13980    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13981    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13982    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13983    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13984    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13985    pub additional_authenticated_data: ::bytes::Bytes,
13986
13987    /// Optional. An optional CRC32C checksum of the
13988    /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
13989    /// If specified,
13990    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13991    /// verify the integrity of the received plaintext using this checksum.
13992    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13993    /// report an error if the checksum verification fails. If you receive a
13994    /// checksum error, your client should verify that CRC32C(plaintext) is equal
13995    /// to plaintext_crc32c, and if so, perform a limited number of retries. A
13996    /// persistent mismatch may indicate an issue in your computation of the CRC32C
13997    /// checksum. Note: This field is defined as int64 for reasons of compatibility
13998    /// across different languages. However, it is a non-negative integer, which
13999    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14000    /// languages that support this type.
14001    ///
14002    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14003    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
14004    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
14005
14006    /// Optional. An optional CRC32C checksum of the
14007    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
14008    /// If specified,
14009    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14010    /// verify the integrity of the received additional_authenticated_data using
14011    /// this checksum.
14012    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14013    /// report an error if the checksum verification fails. If you receive a
14014    /// checksum error, your client should verify that
14015    /// CRC32C(additional_authenticated_data) is equal to
14016    /// additional_authenticated_data_crc32c, and if so, perform
14017    /// a limited number of retries. A persistent mismatch may indicate an issue in
14018    /// your computation of the CRC32C checksum.
14019    /// Note: This field is defined as int64 for reasons of compatibility across
14020    /// different languages. However, it is a non-negative integer, which will
14021    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14022    /// that support this type.
14023    ///
14024    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14025    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
14026    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
14027
14028    /// Optional. A customer-supplied initialization vector that will be used for
14029    /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
14030    /// generated. It will be returned in
14031    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
14032    ///
14033    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
14034    pub initialization_vector: ::bytes::Bytes,
14035
14036    /// Optional. An optional CRC32C checksum of the
14037    /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
14038    /// If specified,
14039    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14040    /// verify the integrity of the received initialization_vector using this
14041    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14042    /// will report an error if the checksum verification fails. If you receive a
14043    /// checksum error, your client should verify that
14044    /// CRC32C(initialization_vector) is equal to
14045    /// initialization_vector_crc32c, and if so, perform
14046    /// a limited number of retries. A persistent mismatch may indicate an issue in
14047    /// your computation of the CRC32C checksum.
14048    /// Note: This field is defined as int64 for reasons of compatibility across
14049    /// different languages. However, it is a non-negative integer, which will
14050    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14051    /// that support this type.
14052    ///
14053    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14054    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
14055    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
14056
14057    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14058}
14059
14060impl RawEncryptRequest {
14061    /// Creates a new default instance.
14062    pub fn new() -> Self {
14063        std::default::Default::default()
14064    }
14065
14066    /// Sets the value of [name][crate::model::RawEncryptRequest::name].
14067    ///
14068    /// # Example
14069    /// ```ignore,no_run
14070    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14071    /// let x = RawEncryptRequest::new().set_name("example");
14072    /// ```
14073    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14074        self.name = v.into();
14075        self
14076    }
14077
14078    /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
14079    ///
14080    /// # Example
14081    /// ```ignore,no_run
14082    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14083    /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
14084    /// ```
14085    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14086        self.plaintext = v.into();
14087        self
14088    }
14089
14090    /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
14091    ///
14092    /// # Example
14093    /// ```ignore,no_run
14094    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14095    /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14096    /// ```
14097    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14098        mut self,
14099        v: T,
14100    ) -> Self {
14101        self.additional_authenticated_data = v.into();
14102        self
14103    }
14104
14105    /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
14106    ///
14107    /// # Example
14108    /// ```ignore,no_run
14109    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14110    /// use wkt::Int64Value;
14111    /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
14112    /// ```
14113    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
14114    where
14115        T: std::convert::Into<wkt::Int64Value>,
14116    {
14117        self.plaintext_crc32c = std::option::Option::Some(v.into());
14118        self
14119    }
14120
14121    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
14122    ///
14123    /// # Example
14124    /// ```ignore,no_run
14125    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14126    /// use wkt::Int64Value;
14127    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
14128    /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
14129    /// ```
14130    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14131    where
14132        T: std::convert::Into<wkt::Int64Value>,
14133    {
14134        self.plaintext_crc32c = v.map(|x| x.into());
14135        self
14136    }
14137
14138    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
14139    ///
14140    /// # Example
14141    /// ```ignore,no_run
14142    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14143    /// use wkt::Int64Value;
14144    /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14145    /// ```
14146    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14147    where
14148        T: std::convert::Into<wkt::Int64Value>,
14149    {
14150        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14151        self
14152    }
14153
14154    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
14155    ///
14156    /// # Example
14157    /// ```ignore,no_run
14158    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14159    /// use wkt::Int64Value;
14160    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14161    /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14162    /// ```
14163    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14164        mut self,
14165        v: std::option::Option<T>,
14166    ) -> Self
14167    where
14168        T: std::convert::Into<wkt::Int64Value>,
14169    {
14170        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14171        self
14172    }
14173
14174    /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
14175    ///
14176    /// # Example
14177    /// ```ignore,no_run
14178    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14179    /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14180    /// ```
14181    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14182        mut self,
14183        v: T,
14184    ) -> Self {
14185        self.initialization_vector = v.into();
14186        self
14187    }
14188
14189    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
14190    ///
14191    /// # Example
14192    /// ```ignore,no_run
14193    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14194    /// use wkt::Int64Value;
14195    /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14196    /// ```
14197    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14198    where
14199        T: std::convert::Into<wkt::Int64Value>,
14200    {
14201        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14202        self
14203    }
14204
14205    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
14206    ///
14207    /// # Example
14208    /// ```ignore,no_run
14209    /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14210    /// use wkt::Int64Value;
14211    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14212    /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14213    /// ```
14214    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14215    where
14216        T: std::convert::Into<wkt::Int64Value>,
14217    {
14218        self.initialization_vector_crc32c = v.map(|x| x.into());
14219        self
14220    }
14221}
14222
14223impl wkt::message::Message for RawEncryptRequest {
14224    fn typename() -> &'static str {
14225        "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
14226    }
14227}
14228
14229/// Request message for
14230/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
14231///
14232/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
14233#[derive(Clone, Default, PartialEq)]
14234#[non_exhaustive]
14235pub struct RawDecryptRequest {
14236    /// Required. The resource name of the
14237    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14238    /// decryption.
14239    ///
14240    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14241    pub name: std::string::String,
14242
14243    /// Required. The encrypted data originally returned in
14244    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
14245    ///
14246    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
14247    pub ciphertext: ::bytes::Bytes,
14248
14249    /// Optional. Optional data that must match the data originally supplied in
14250    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
14251    ///
14252    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
14253    pub additional_authenticated_data: ::bytes::Bytes,
14254
14255    /// Required. The initialization vector (IV) used during encryption, which must
14256    /// match the data originally provided in
14257    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
14258    ///
14259    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
14260    pub initialization_vector: ::bytes::Bytes,
14261
14262    /// The length of the authentication tag that is appended to the end of
14263    /// the ciphertext. If unspecified (0), the default value for the key's
14264    /// algorithm will be used (for AES-GCM, the default value is 16).
14265    pub tag_length: i32,
14266
14267    /// Optional. An optional CRC32C checksum of the
14268    /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
14269    /// If specified,
14270    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14271    /// verify the integrity of the received ciphertext using this checksum.
14272    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14273    /// report an error if the checksum verification fails. If you receive a
14274    /// checksum error, your client should verify that CRC32C(ciphertext) is equal
14275    /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
14276    /// persistent mismatch may indicate an issue in your computation of the CRC32C
14277    /// checksum. Note: This field is defined as int64 for reasons of compatibility
14278    /// across different languages. However, it is a non-negative integer, which
14279    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14280    /// languages that support this type.
14281    ///
14282    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14283    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
14284    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14285
14286    /// Optional. An optional CRC32C checksum of the
14287    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
14288    /// If specified,
14289    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14290    /// verify the integrity of the received additional_authenticated_data using
14291    /// this checksum.
14292    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14293    /// report an error if the checksum verification fails. If you receive a
14294    /// checksum error, your client should verify that
14295    /// CRC32C(additional_authenticated_data) is equal to
14296    /// additional_authenticated_data_crc32c, and if so, perform
14297    /// a limited number of retries. A persistent mismatch may indicate an issue in
14298    /// your computation of the CRC32C checksum.
14299    /// Note: This field is defined as int64 for reasons of compatibility across
14300    /// different languages. However, it is a non-negative integer, which will
14301    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14302    /// that support this type.
14303    ///
14304    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14305    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
14306    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
14307
14308    /// Optional. An optional CRC32C checksum of the
14309    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
14310    /// If specified,
14311    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14312    /// verify the integrity of the received initialization_vector using this
14313    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14314    /// will report an error if the checksum verification fails. If you receive a
14315    /// checksum error, your client should verify that
14316    /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
14317    /// if so, perform a limited number of retries. A persistent mismatch may
14318    /// indicate an issue in your computation of the CRC32C checksum.
14319    /// Note: This field is defined as int64 for reasons of compatibility across
14320    /// different languages. However, it is a non-negative integer, which will
14321    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14322    /// that support this type.
14323    ///
14324    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14325    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
14326    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
14327
14328    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14329}
14330
14331impl RawDecryptRequest {
14332    /// Creates a new default instance.
14333    pub fn new() -> Self {
14334        std::default::Default::default()
14335    }
14336
14337    /// Sets the value of [name][crate::model::RawDecryptRequest::name].
14338    ///
14339    /// # Example
14340    /// ```ignore,no_run
14341    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14342    /// let x = RawDecryptRequest::new().set_name("example");
14343    /// ```
14344    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14345        self.name = v.into();
14346        self
14347    }
14348
14349    /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
14350    ///
14351    /// # Example
14352    /// ```ignore,no_run
14353    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14354    /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14355    /// ```
14356    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14357        self.ciphertext = v.into();
14358        self
14359    }
14360
14361    /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
14362    ///
14363    /// # Example
14364    /// ```ignore,no_run
14365    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14366    /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14367    /// ```
14368    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14369        mut self,
14370        v: T,
14371    ) -> Self {
14372        self.additional_authenticated_data = v.into();
14373        self
14374    }
14375
14376    /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
14377    ///
14378    /// # Example
14379    /// ```ignore,no_run
14380    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14381    /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14382    /// ```
14383    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14384        mut self,
14385        v: T,
14386    ) -> Self {
14387        self.initialization_vector = v.into();
14388        self
14389    }
14390
14391    /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
14392    ///
14393    /// # Example
14394    /// ```ignore,no_run
14395    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14396    /// let x = RawDecryptRequest::new().set_tag_length(42);
14397    /// ```
14398    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14399        self.tag_length = v.into();
14400        self
14401    }
14402
14403    /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14404    ///
14405    /// # Example
14406    /// ```ignore,no_run
14407    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14408    /// use wkt::Int64Value;
14409    /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14410    /// ```
14411    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14412    where
14413        T: std::convert::Into<wkt::Int64Value>,
14414    {
14415        self.ciphertext_crc32c = std::option::Option::Some(v.into());
14416        self
14417    }
14418
14419    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14420    ///
14421    /// # Example
14422    /// ```ignore,no_run
14423    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14424    /// use wkt::Int64Value;
14425    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14426    /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14427    /// ```
14428    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14429    where
14430        T: std::convert::Into<wkt::Int64Value>,
14431    {
14432        self.ciphertext_crc32c = v.map(|x| x.into());
14433        self
14434    }
14435
14436    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14437    ///
14438    /// # Example
14439    /// ```ignore,no_run
14440    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14441    /// use wkt::Int64Value;
14442    /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14443    /// ```
14444    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14445    where
14446        T: std::convert::Into<wkt::Int64Value>,
14447    {
14448        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14449        self
14450    }
14451
14452    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14453    ///
14454    /// # Example
14455    /// ```ignore,no_run
14456    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14457    /// use wkt::Int64Value;
14458    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14459    /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14460    /// ```
14461    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14462        mut self,
14463        v: std::option::Option<T>,
14464    ) -> Self
14465    where
14466        T: std::convert::Into<wkt::Int64Value>,
14467    {
14468        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14469        self
14470    }
14471
14472    /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14473    ///
14474    /// # Example
14475    /// ```ignore,no_run
14476    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14477    /// use wkt::Int64Value;
14478    /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14479    /// ```
14480    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14481    where
14482        T: std::convert::Into<wkt::Int64Value>,
14483    {
14484        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14485        self
14486    }
14487
14488    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14489    ///
14490    /// # Example
14491    /// ```ignore,no_run
14492    /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14493    /// use wkt::Int64Value;
14494    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14495    /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14496    /// ```
14497    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14498    where
14499        T: std::convert::Into<wkt::Int64Value>,
14500    {
14501        self.initialization_vector_crc32c = v.map(|x| x.into());
14502        self
14503    }
14504}
14505
14506impl wkt::message::Message for RawDecryptRequest {
14507    fn typename() -> &'static str {
14508        "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
14509    }
14510}
14511
14512/// Request message for
14513/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
14514///
14515/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
14516#[derive(Clone, Default, PartialEq)]
14517#[non_exhaustive]
14518pub struct AsymmetricSignRequest {
14519    /// Required. The resource name of the
14520    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14521    /// signing.
14522    ///
14523    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14524    pub name: std::string::String,
14525
14526    /// Optional. The digest of the data to sign. The digest must be produced with
14527    /// the same digest algorithm as specified by the key version's
14528    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
14529    ///
14530    /// This field may not be supplied if
14531    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14532    /// is supplied.
14533    ///
14534    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14535    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
14536    pub digest: std::option::Option<crate::model::Digest>,
14537
14538    /// Optional. An optional CRC32C checksum of the
14539    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
14540    /// If specified,
14541    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14542    /// verify the integrity of the received
14543    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14544    /// using this checksum.
14545    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14546    /// report an error if the checksum verification fails. If you receive a
14547    /// checksum error, your client should verify that
14548    /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
14549    /// is equal to
14550    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
14551    /// and if so, perform a limited number of retries. A persistent mismatch may
14552    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14553    /// field is defined as int64 for reasons of compatibility across different
14554    /// languages. However, it is a non-negative integer, which will never exceed
14555    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14556    /// this type.
14557    ///
14558    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14559    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
14560    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14561    pub digest_crc32c: std::option::Option<wkt::Int64Value>,
14562
14563    /// Optional. The data to sign.
14564    /// It can't be supplied if
14565    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14566    /// is supplied.
14567    ///
14568    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14569    pub data: ::bytes::Bytes,
14570
14571    /// Optional. An optional CRC32C checksum of the
14572    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
14573    /// If specified,
14574    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14575    /// verify the integrity of the received
14576    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14577    /// using this checksum.
14578    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14579    /// report an error if the checksum verification fails. If you receive a
14580    /// checksum error, your client should verify that
14581    /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
14582    /// is equal to
14583    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
14584    /// and if so, perform a limited number of retries. A persistent mismatch may
14585    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14586    /// field is defined as int64 for reasons of compatibility across different
14587    /// languages. However, it is a non-negative integer, which will never exceed
14588    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14589    /// this type.
14590    ///
14591    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14592    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
14593    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14594    pub data_crc32c: std::option::Option<wkt::Int64Value>,
14595
14596    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14597}
14598
14599impl AsymmetricSignRequest {
14600    /// Creates a new default instance.
14601    pub fn new() -> Self {
14602        std::default::Default::default()
14603    }
14604
14605    /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
14606    ///
14607    /// # Example
14608    /// ```ignore,no_run
14609    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14610    /// # let project_id = "project_id";
14611    /// # let location_id = "location_id";
14612    /// # let key_ring_id = "key_ring_id";
14613    /// # let crypto_key_id = "crypto_key_id";
14614    /// # let crypto_key_version_id = "crypto_key_version_id";
14615    /// let x = AsymmetricSignRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14616    /// ```
14617    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14618        self.name = v.into();
14619        self
14620    }
14621
14622    /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
14623    ///
14624    /// # Example
14625    /// ```ignore,no_run
14626    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14627    /// use google_cloud_kms_v1::model::Digest;
14628    /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
14629    /// ```
14630    pub fn set_digest<T>(mut self, v: T) -> Self
14631    where
14632        T: std::convert::Into<crate::model::Digest>,
14633    {
14634        self.digest = std::option::Option::Some(v.into());
14635        self
14636    }
14637
14638    /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
14639    ///
14640    /// # Example
14641    /// ```ignore,no_run
14642    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14643    /// use google_cloud_kms_v1::model::Digest;
14644    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
14645    /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
14646    /// ```
14647    pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
14648    where
14649        T: std::convert::Into<crate::model::Digest>,
14650    {
14651        self.digest = v.map(|x| x.into());
14652        self
14653    }
14654
14655    /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14656    ///
14657    /// # Example
14658    /// ```ignore,no_run
14659    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14660    /// use wkt::Int64Value;
14661    /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
14662    /// ```
14663    pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
14664    where
14665        T: std::convert::Into<wkt::Int64Value>,
14666    {
14667        self.digest_crc32c = std::option::Option::Some(v.into());
14668        self
14669    }
14670
14671    /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14672    ///
14673    /// # Example
14674    /// ```ignore,no_run
14675    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14676    /// use wkt::Int64Value;
14677    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
14678    /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
14679    /// ```
14680    pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14681    where
14682        T: std::convert::Into<wkt::Int64Value>,
14683    {
14684        self.digest_crc32c = v.map(|x| x.into());
14685        self
14686    }
14687
14688    /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
14689    ///
14690    /// # Example
14691    /// ```ignore,no_run
14692    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14693    /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14694    /// ```
14695    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14696        self.data = v.into();
14697        self
14698    }
14699
14700    /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14701    ///
14702    /// # Example
14703    /// ```ignore,no_run
14704    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14705    /// use wkt::Int64Value;
14706    /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14707    /// ```
14708    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14709    where
14710        T: std::convert::Into<wkt::Int64Value>,
14711    {
14712        self.data_crc32c = std::option::Option::Some(v.into());
14713        self
14714    }
14715
14716    /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14717    ///
14718    /// # Example
14719    /// ```ignore,no_run
14720    /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14721    /// use wkt::Int64Value;
14722    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14723    /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14724    /// ```
14725    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14726    where
14727        T: std::convert::Into<wkt::Int64Value>,
14728    {
14729        self.data_crc32c = v.map(|x| x.into());
14730        self
14731    }
14732}
14733
14734impl wkt::message::Message for AsymmetricSignRequest {
14735    fn typename() -> &'static str {
14736        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
14737    }
14738}
14739
14740/// Request message for
14741/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
14742///
14743/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
14744#[derive(Clone, Default, PartialEq)]
14745#[non_exhaustive]
14746pub struct AsymmetricDecryptRequest {
14747    /// Required. The resource name of the
14748    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14749    /// decryption.
14750    ///
14751    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14752    pub name: std::string::String,
14753
14754    /// Required. The data encrypted with the named
14755    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
14756    /// OAEP.
14757    ///
14758    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14759    pub ciphertext: ::bytes::Bytes,
14760
14761    /// Optional. An optional CRC32C checksum of the
14762    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
14763    /// If specified,
14764    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14765    /// verify the integrity of the received
14766    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
14767    /// using this checksum.
14768    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14769    /// report an error if the checksum verification fails. If you receive a
14770    /// checksum error, your client should verify that
14771    /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
14772    /// is equal to
14773    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
14774    /// and if so, perform a limited number of retries. A persistent mismatch may
14775    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14776    /// field is defined as int64 for reasons of compatibility across different
14777    /// languages. However, it is a non-negative integer, which will never exceed
14778    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14779    /// this type.
14780    ///
14781    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
14782    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
14783    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14784    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14785
14786    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14787}
14788
14789impl AsymmetricDecryptRequest {
14790    /// Creates a new default instance.
14791    pub fn new() -> Self {
14792        std::default::Default::default()
14793    }
14794
14795    /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
14796    ///
14797    /// # Example
14798    /// ```ignore,no_run
14799    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14800    /// # let project_id = "project_id";
14801    /// # let location_id = "location_id";
14802    /// # let key_ring_id = "key_ring_id";
14803    /// # let crypto_key_id = "crypto_key_id";
14804    /// # let crypto_key_version_id = "crypto_key_version_id";
14805    /// let x = AsymmetricDecryptRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14806    /// ```
14807    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14808        self.name = v.into();
14809        self
14810    }
14811
14812    /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
14813    ///
14814    /// # Example
14815    /// ```ignore,no_run
14816    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14817    /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14818    /// ```
14819    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14820        self.ciphertext = v.into();
14821        self
14822    }
14823
14824    /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14825    ///
14826    /// # Example
14827    /// ```ignore,no_run
14828    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14829    /// use wkt::Int64Value;
14830    /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14831    /// ```
14832    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14833    where
14834        T: std::convert::Into<wkt::Int64Value>,
14835    {
14836        self.ciphertext_crc32c = std::option::Option::Some(v.into());
14837        self
14838    }
14839
14840    /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14841    ///
14842    /// # Example
14843    /// ```ignore,no_run
14844    /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14845    /// use wkt::Int64Value;
14846    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14847    /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14848    /// ```
14849    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14850    where
14851        T: std::convert::Into<wkt::Int64Value>,
14852    {
14853        self.ciphertext_crc32c = v.map(|x| x.into());
14854        self
14855    }
14856}
14857
14858impl wkt::message::Message for AsymmetricDecryptRequest {
14859    fn typename() -> &'static str {
14860        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
14861    }
14862}
14863
14864/// Request message for
14865/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
14866///
14867/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
14868#[derive(Clone, Default, PartialEq)]
14869#[non_exhaustive]
14870pub struct MacSignRequest {
14871    /// Required. The resource name of the
14872    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14873    /// signing.
14874    ///
14875    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14876    pub name: std::string::String,
14877
14878    /// Required. The data to sign. The MAC tag is computed over this data field
14879    /// based on the specific algorithm.
14880    pub data: ::bytes::Bytes,
14881
14882    /// Optional. An optional CRC32C checksum of the
14883    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
14884    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14885    /// will verify the integrity of the received
14886    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
14887    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14888    /// will report an error if the checksum verification fails. If you receive a
14889    /// checksum error, your client should verify that
14890    /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
14891    /// equal to
14892    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
14893    /// and if so, perform a limited number of retries. A persistent mismatch may
14894    /// indicate an issue in your computation of the CRC32C checksum. Note: This
14895    /// field is defined as int64 for reasons of compatibility across different
14896    /// languages. However, it is a non-negative integer, which will never exceed
14897    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14898    /// this type.
14899    ///
14900    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14901    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14902    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
14903    pub data_crc32c: std::option::Option<wkt::Int64Value>,
14904
14905    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14906}
14907
14908impl MacSignRequest {
14909    /// Creates a new default instance.
14910    pub fn new() -> Self {
14911        std::default::Default::default()
14912    }
14913
14914    /// Sets the value of [name][crate::model::MacSignRequest::name].
14915    ///
14916    /// # Example
14917    /// ```ignore,no_run
14918    /// # use google_cloud_kms_v1::model::MacSignRequest;
14919    /// # let project_id = "project_id";
14920    /// # let location_id = "location_id";
14921    /// # let key_ring_id = "key_ring_id";
14922    /// # let crypto_key_id = "crypto_key_id";
14923    /// # let crypto_key_version_id = "crypto_key_version_id";
14924    /// let x = MacSignRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14925    /// ```
14926    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14927        self.name = v.into();
14928        self
14929    }
14930
14931    /// Sets the value of [data][crate::model::MacSignRequest::data].
14932    ///
14933    /// # Example
14934    /// ```ignore,no_run
14935    /// # use google_cloud_kms_v1::model::MacSignRequest;
14936    /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14937    /// ```
14938    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14939        self.data = v.into();
14940        self
14941    }
14942
14943    /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14944    ///
14945    /// # Example
14946    /// ```ignore,no_run
14947    /// # use google_cloud_kms_v1::model::MacSignRequest;
14948    /// use wkt::Int64Value;
14949    /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14950    /// ```
14951    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14952    where
14953        T: std::convert::Into<wkt::Int64Value>,
14954    {
14955        self.data_crc32c = std::option::Option::Some(v.into());
14956        self
14957    }
14958
14959    /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14960    ///
14961    /// # Example
14962    /// ```ignore,no_run
14963    /// # use google_cloud_kms_v1::model::MacSignRequest;
14964    /// use wkt::Int64Value;
14965    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14966    /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14967    /// ```
14968    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14969    where
14970        T: std::convert::Into<wkt::Int64Value>,
14971    {
14972        self.data_crc32c = v.map(|x| x.into());
14973        self
14974    }
14975}
14976
14977impl wkt::message::Message for MacSignRequest {
14978    fn typename() -> &'static str {
14979        "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
14980    }
14981}
14982
14983/// Request message for
14984/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
14985///
14986/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
14987#[derive(Clone, Default, PartialEq)]
14988#[non_exhaustive]
14989pub struct MacVerifyRequest {
14990    /// Required. The resource name of the
14991    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14992    /// verification.
14993    ///
14994    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14995    pub name: std::string::String,
14996
14997    /// Required. The data used previously as a
14998    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
14999    /// the MAC tag.
15000    ///
15001    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
15002    pub data: ::bytes::Bytes,
15003
15004    /// Optional. An optional CRC32C checksum of the
15005    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
15006    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15007    /// will verify the integrity of the received
15008    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
15009    /// this checksum.
15010    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15011    /// report an error if the checksum verification fails. If you receive a
15012    /// checksum error, your client should verify that
15013    /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
15014    /// is equal to
15015    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
15016    /// and if so, perform a limited number of retries. A persistent mismatch may
15017    /// indicate an issue in your computation of the CRC32C checksum. Note: This
15018    /// field is defined as int64 for reasons of compatibility across different
15019    /// languages. However, it is a non-negative integer, which will never exceed
15020    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15021    /// this type.
15022    ///
15023    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15024    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
15025    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
15026    pub data_crc32c: std::option::Option<wkt::Int64Value>,
15027
15028    /// Required. The signature to verify.
15029    pub mac: ::bytes::Bytes,
15030
15031    /// Optional. An optional CRC32C checksum of the
15032    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
15033    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15034    /// will verify the integrity of the received
15035    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
15036    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15037    /// will report an error if the checksum verification fails. If you receive a
15038    /// checksum error, your client should verify that
15039    /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
15040    /// equal to
15041    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
15042    /// and if so, perform a limited number of retries. A persistent mismatch may
15043    /// indicate an issue in your computation of the CRC32C checksum. Note: This
15044    /// field is defined as int64 for reasons of compatibility across different
15045    /// languages. However, it is a non-negative integer, which will never exceed
15046    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15047    /// this type.
15048    ///
15049    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15050    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
15051    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
15052    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
15053
15054    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15055}
15056
15057impl MacVerifyRequest {
15058    /// Creates a new default instance.
15059    pub fn new() -> Self {
15060        std::default::Default::default()
15061    }
15062
15063    /// Sets the value of [name][crate::model::MacVerifyRequest::name].
15064    ///
15065    /// # Example
15066    /// ```ignore,no_run
15067    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15068    /// # let project_id = "project_id";
15069    /// # let location_id = "location_id";
15070    /// # let key_ring_id = "key_ring_id";
15071    /// # let crypto_key_id = "crypto_key_id";
15072    /// # let crypto_key_version_id = "crypto_key_version_id";
15073    /// let x = MacVerifyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15074    /// ```
15075    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15076        self.name = v.into();
15077        self
15078    }
15079
15080    /// Sets the value of [data][crate::model::MacVerifyRequest::data].
15081    ///
15082    /// # Example
15083    /// ```ignore,no_run
15084    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15085    /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
15086    /// ```
15087    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15088        self.data = v.into();
15089        self
15090    }
15091
15092    /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
15093    ///
15094    /// # Example
15095    /// ```ignore,no_run
15096    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15097    /// use wkt::Int64Value;
15098    /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
15099    /// ```
15100    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
15101    where
15102        T: std::convert::Into<wkt::Int64Value>,
15103    {
15104        self.data_crc32c = std::option::Option::Some(v.into());
15105        self
15106    }
15107
15108    /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
15109    ///
15110    /// # Example
15111    /// ```ignore,no_run
15112    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15113    /// use wkt::Int64Value;
15114    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
15115    /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
15116    /// ```
15117    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15118    where
15119        T: std::convert::Into<wkt::Int64Value>,
15120    {
15121        self.data_crc32c = v.map(|x| x.into());
15122        self
15123    }
15124
15125    /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
15126    ///
15127    /// # Example
15128    /// ```ignore,no_run
15129    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15130    /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
15131    /// ```
15132    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15133        self.mac = v.into();
15134        self
15135    }
15136
15137    /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
15138    ///
15139    /// # Example
15140    /// ```ignore,no_run
15141    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15142    /// use wkt::Int64Value;
15143    /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
15144    /// ```
15145    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
15146    where
15147        T: std::convert::Into<wkt::Int64Value>,
15148    {
15149        self.mac_crc32c = std::option::Option::Some(v.into());
15150        self
15151    }
15152
15153    /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
15154    ///
15155    /// # Example
15156    /// ```ignore,no_run
15157    /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15158    /// use wkt::Int64Value;
15159    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
15160    /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
15161    /// ```
15162    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15163    where
15164        T: std::convert::Into<wkt::Int64Value>,
15165    {
15166        self.mac_crc32c = v.map(|x| x.into());
15167        self
15168    }
15169}
15170
15171impl wkt::message::Message for MacVerifyRequest {
15172    fn typename() -> &'static str {
15173        "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
15174    }
15175}
15176
15177/// Request message for
15178/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
15179///
15180/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
15181#[derive(Clone, Default, PartialEq)]
15182#[non_exhaustive]
15183pub struct DecapsulateRequest {
15184    /// Required. The resource name of the
15185    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
15186    /// decapsulation.
15187    ///
15188    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15189    pub name: std::string::String,
15190
15191    /// Required. The ciphertext produced from encapsulation with the
15192    /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
15193    /// key(s).
15194    ///
15195    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15196    pub ciphertext: ::bytes::Bytes,
15197
15198    /// Optional. A CRC32C checksum of the
15199    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
15200    /// If specified,
15201    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15202    /// verify the integrity of the received
15203    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
15204    /// using this checksum.
15205    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15206    /// report an error if the checksum verification fails. If you receive a
15207    /// checksum error, your client should verify that
15208    /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
15209    /// is equal to
15210    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
15211    /// and if so, perform a limited number of retries. A persistent mismatch may
15212    /// indicate an issue in your computation of the CRC32C checksum. Note: This
15213    /// field is defined as int64 for reasons of compatibility across different
15214    /// languages. However, it is a non-negative integer, which will never exceed
15215    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15216    /// this type.
15217    ///
15218    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
15219    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
15220    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15221    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15222
15223    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15224}
15225
15226impl DecapsulateRequest {
15227    /// Creates a new default instance.
15228    pub fn new() -> Self {
15229        std::default::Default::default()
15230    }
15231
15232    /// Sets the value of [name][crate::model::DecapsulateRequest::name].
15233    ///
15234    /// # Example
15235    /// ```ignore,no_run
15236    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15237    /// # let project_id = "project_id";
15238    /// # let location_id = "location_id";
15239    /// # let key_ring_id = "key_ring_id";
15240    /// # let crypto_key_id = "crypto_key_id";
15241    /// # let crypto_key_version_id = "crypto_key_version_id";
15242    /// let x = DecapsulateRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15243    /// ```
15244    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15245        self.name = v.into();
15246        self
15247    }
15248
15249    /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
15250    ///
15251    /// # Example
15252    /// ```ignore,no_run
15253    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15254    /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15255    /// ```
15256    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15257        self.ciphertext = v.into();
15258        self
15259    }
15260
15261    /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
15262    ///
15263    /// # Example
15264    /// ```ignore,no_run
15265    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15266    /// use wkt::Int64Value;
15267    /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15268    /// ```
15269    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15270    where
15271        T: std::convert::Into<wkt::Int64Value>,
15272    {
15273        self.ciphertext_crc32c = std::option::Option::Some(v.into());
15274        self
15275    }
15276
15277    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
15278    ///
15279    /// # Example
15280    /// ```ignore,no_run
15281    /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15282    /// use wkt::Int64Value;
15283    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15284    /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15285    /// ```
15286    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15287    where
15288        T: std::convert::Into<wkt::Int64Value>,
15289    {
15290        self.ciphertext_crc32c = v.map(|x| x.into());
15291        self
15292    }
15293}
15294
15295impl wkt::message::Message for DecapsulateRequest {
15296    fn typename() -> &'static str {
15297        "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
15298    }
15299}
15300
15301/// Request message for
15302/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
15303///
15304/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
15305#[derive(Clone, Default, PartialEq)]
15306#[non_exhaustive]
15307pub struct GenerateRandomBytesRequest {
15308    /// The project-specific location in which to generate random bytes.
15309    /// For example, "projects/my-project/locations/us-central1".
15310    pub location: std::string::String,
15311
15312    /// The length in bytes of the amount of randomness to retrieve.  Minimum 8
15313    /// bytes, maximum 1024 bytes.
15314    pub length_bytes: i32,
15315
15316    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
15317    /// generating the random data. Currently, only
15318    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
15319    /// supported.
15320    ///
15321    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15322    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
15323    pub protection_level: crate::model::ProtectionLevel,
15324
15325    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15326}
15327
15328impl GenerateRandomBytesRequest {
15329    /// Creates a new default instance.
15330    pub fn new() -> Self {
15331        std::default::Default::default()
15332    }
15333
15334    /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
15335    ///
15336    /// # Example
15337    /// ```ignore,no_run
15338    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15339    /// let x = GenerateRandomBytesRequest::new().set_location("example");
15340    /// ```
15341    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15342        self.location = v.into();
15343        self
15344    }
15345
15346    /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
15347    ///
15348    /// # Example
15349    /// ```ignore,no_run
15350    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15351    /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
15352    /// ```
15353    pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15354        self.length_bytes = v.into();
15355        self
15356    }
15357
15358    /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
15359    ///
15360    /// # Example
15361    /// ```ignore,no_run
15362    /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15363    /// use google_cloud_kms_v1::model::ProtectionLevel;
15364    /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
15365    /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
15366    /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
15367    /// ```
15368    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15369        mut self,
15370        v: T,
15371    ) -> Self {
15372        self.protection_level = v.into();
15373        self
15374    }
15375}
15376
15377impl wkt::message::Message for GenerateRandomBytesRequest {
15378    fn typename() -> &'static str {
15379        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
15380    }
15381}
15382
15383/// Response message for
15384/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
15385///
15386/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
15387#[derive(Clone, Default, PartialEq)]
15388#[non_exhaustive]
15389pub struct EncryptResponse {
15390    /// The resource name of the
15391    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15392    /// encryption. Check this field to verify that the intended resource was used
15393    /// for encryption.
15394    ///
15395    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15396    pub name: std::string::String,
15397
15398    /// The encrypted data.
15399    pub ciphertext: ::bytes::Bytes,
15400
15401    /// Integrity verification field. A CRC32C checksum of the returned
15402    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
15403    /// An integrity check of
15404    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15405    /// can be performed by computing the CRC32C checksum of
15406    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15407    /// and comparing your results to this field. Discard the response in case of
15408    /// non-matching checksum values, and perform a limited number of retries. A
15409    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15410    /// checksum. Note: This field is defined as int64 for reasons of compatibility
15411    /// across different languages. However, it is a non-negative integer, which
15412    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15413    /// languages that support this type.
15414    ///
15415    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
15416    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15417
15418    /// Integrity verification field. A flag indicating whether
15419    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15420    /// was received by
15421    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15422    /// for the integrity verification of the
15423    /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
15424    /// this field indicates either that
15425    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15426    /// was left unset or that it was not delivered to
15427    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15428    /// set
15429    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15430    /// but this field is still false, discard the response and perform a limited
15431    /// number of retries.
15432    ///
15433    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15434    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
15435    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15436    pub verified_plaintext_crc32c: bool,
15437
15438    /// Integrity verification field. A flag indicating whether
15439    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15440    /// was received by
15441    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15442    /// for the integrity verification of the
15443    /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
15444    /// false value of this field indicates either that
15445    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15446    /// was left unset or that it was not delivered to
15447    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15448    /// set
15449    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15450    /// but this field is still false, discard the response and perform a limited
15451    /// number of retries.
15452    ///
15453    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
15454    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
15455    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15456    pub verified_additional_authenticated_data_crc32c: bool,
15457
15458    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15459    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15460    /// encryption.
15461    ///
15462    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15463    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15464    pub protection_level: crate::model::ProtectionLevel,
15465
15466    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15467}
15468
15469impl EncryptResponse {
15470    /// Creates a new default instance.
15471    pub fn new() -> Self {
15472        std::default::Default::default()
15473    }
15474
15475    /// Sets the value of [name][crate::model::EncryptResponse::name].
15476    ///
15477    /// # Example
15478    /// ```ignore,no_run
15479    /// # use google_cloud_kms_v1::model::EncryptResponse;
15480    /// let x = EncryptResponse::new().set_name("example");
15481    /// ```
15482    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15483        self.name = v.into();
15484        self
15485    }
15486
15487    /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
15488    ///
15489    /// # Example
15490    /// ```ignore,no_run
15491    /// # use google_cloud_kms_v1::model::EncryptResponse;
15492    /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15493    /// ```
15494    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15495        self.ciphertext = v.into();
15496        self
15497    }
15498
15499    /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15500    ///
15501    /// # Example
15502    /// ```ignore,no_run
15503    /// # use google_cloud_kms_v1::model::EncryptResponse;
15504    /// use wkt::Int64Value;
15505    /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15506    /// ```
15507    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15508    where
15509        T: std::convert::Into<wkt::Int64Value>,
15510    {
15511        self.ciphertext_crc32c = std::option::Option::Some(v.into());
15512        self
15513    }
15514
15515    /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15516    ///
15517    /// # Example
15518    /// ```ignore,no_run
15519    /// # use google_cloud_kms_v1::model::EncryptResponse;
15520    /// use wkt::Int64Value;
15521    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15522    /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15523    /// ```
15524    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15525    where
15526        T: std::convert::Into<wkt::Int64Value>,
15527    {
15528        self.ciphertext_crc32c = v.map(|x| x.into());
15529        self
15530    }
15531
15532    /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
15533    ///
15534    /// # Example
15535    /// ```ignore,no_run
15536    /// # use google_cloud_kms_v1::model::EncryptResponse;
15537    /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
15538    /// ```
15539    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15540        self.verified_plaintext_crc32c = v.into();
15541        self
15542    }
15543
15544    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
15545    ///
15546    /// # Example
15547    /// ```ignore,no_run
15548    /// # use google_cloud_kms_v1::model::EncryptResponse;
15549    /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15550    /// ```
15551    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15552        mut self,
15553        v: T,
15554    ) -> Self {
15555        self.verified_additional_authenticated_data_crc32c = v.into();
15556        self
15557    }
15558
15559    /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
15560    ///
15561    /// # Example
15562    /// ```ignore,no_run
15563    /// # use google_cloud_kms_v1::model::EncryptResponse;
15564    /// use google_cloud_kms_v1::model::ProtectionLevel;
15565    /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15566    /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15567    /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
15568    /// ```
15569    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15570        mut self,
15571        v: T,
15572    ) -> Self {
15573        self.protection_level = v.into();
15574        self
15575    }
15576}
15577
15578impl wkt::message::Message for EncryptResponse {
15579    fn typename() -> &'static str {
15580        "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
15581    }
15582}
15583
15584/// Response message for
15585/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
15586///
15587/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
15588#[derive(Clone, Default, PartialEq)]
15589#[non_exhaustive]
15590pub struct DecryptResponse {
15591    /// The decrypted data originally supplied in
15592    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
15593    ///
15594    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15595    pub plaintext: ::bytes::Bytes,
15596
15597    /// Integrity verification field. A CRC32C checksum of the returned
15598    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
15599    /// An integrity check of
15600    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15601    /// can be performed by computing the CRC32C checksum of
15602    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15603    /// and comparing your results to this field. Discard the response in case of
15604    /// non-matching checksum values, and perform a limited number of retries. A
15605    /// persistent mismatch may indicate an issue in your computation of the CRC32C
15606    /// checksum. Note: receiving this response message indicates that
15607    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15608    /// successfully decrypt the
15609    /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
15610    /// field is defined as int64 for reasons of compatibility across different
15611    /// languages. However, it is a non-negative integer, which will never exceed
15612    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15613    /// this type.
15614    ///
15615    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
15616    /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
15617    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15618    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15619
15620    /// Whether the Decryption was performed using the primary key version.
15621    pub used_primary: bool,
15622
15623    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15624    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15625    /// decryption.
15626    ///
15627    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15628    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15629    pub protection_level: crate::model::ProtectionLevel,
15630
15631    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15632}
15633
15634impl DecryptResponse {
15635    /// Creates a new default instance.
15636    pub fn new() -> Self {
15637        std::default::Default::default()
15638    }
15639
15640    /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
15641    ///
15642    /// # Example
15643    /// ```ignore,no_run
15644    /// # use google_cloud_kms_v1::model::DecryptResponse;
15645    /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15646    /// ```
15647    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15648        self.plaintext = v.into();
15649        self
15650    }
15651
15652    /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15653    ///
15654    /// # Example
15655    /// ```ignore,no_run
15656    /// # use google_cloud_kms_v1::model::DecryptResponse;
15657    /// use wkt::Int64Value;
15658    /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15659    /// ```
15660    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15661    where
15662        T: std::convert::Into<wkt::Int64Value>,
15663    {
15664        self.plaintext_crc32c = std::option::Option::Some(v.into());
15665        self
15666    }
15667
15668    /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15669    ///
15670    /// # Example
15671    /// ```ignore,no_run
15672    /// # use google_cloud_kms_v1::model::DecryptResponse;
15673    /// use wkt::Int64Value;
15674    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15675    /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15676    /// ```
15677    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15678    where
15679        T: std::convert::Into<wkt::Int64Value>,
15680    {
15681        self.plaintext_crc32c = v.map(|x| x.into());
15682        self
15683    }
15684
15685    /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
15686    ///
15687    /// # Example
15688    /// ```ignore,no_run
15689    /// # use google_cloud_kms_v1::model::DecryptResponse;
15690    /// let x = DecryptResponse::new().set_used_primary(true);
15691    /// ```
15692    pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15693        self.used_primary = v.into();
15694        self
15695    }
15696
15697    /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
15698    ///
15699    /// # Example
15700    /// ```ignore,no_run
15701    /// # use google_cloud_kms_v1::model::DecryptResponse;
15702    /// use google_cloud_kms_v1::model::ProtectionLevel;
15703    /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15704    /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15705    /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
15706    /// ```
15707    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15708        mut self,
15709        v: T,
15710    ) -> Self {
15711        self.protection_level = v.into();
15712        self
15713    }
15714}
15715
15716impl wkt::message::Message for DecryptResponse {
15717    fn typename() -> &'static str {
15718        "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
15719    }
15720}
15721
15722/// Response message for
15723/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
15724///
15725/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
15726#[derive(Clone, Default, PartialEq)]
15727#[non_exhaustive]
15728pub struct RawEncryptResponse {
15729    /// The encrypted data. In the case of AES-GCM, the authentication tag
15730    /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
15731    /// bytes at the end of this field.
15732    ///
15733    /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
15734    pub ciphertext: ::bytes::Bytes,
15735
15736    /// The initialization vector (IV) generated by the service during
15737    /// encryption. This value must be stored and provided in
15738    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
15739    /// at decryption time.
15740    ///
15741    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
15742    pub initialization_vector: ::bytes::Bytes,
15743
15744    /// The length of the authentication tag that is appended to
15745    /// the end of the ciphertext.
15746    pub tag_length: i32,
15747
15748    /// Integrity verification field. A CRC32C checksum of the returned
15749    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
15750    /// An integrity check of ciphertext can be performed by computing the CRC32C
15751    /// checksum of ciphertext and comparing your results to this field. Discard
15752    /// the response in case of non-matching checksum values, and perform a limited
15753    /// number of retries. A persistent mismatch may indicate an issue in your
15754    /// computation of the CRC32C checksum. Note: This field is defined as int64
15755    /// for reasons of compatibility across different languages. However, it is a
15756    /// non-negative integer, which will never exceed 2^32-1, and can be safely
15757    /// downconverted to uint32 in languages that support this type.
15758    ///
15759    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
15760    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15761
15762    /// Integrity verification field. A CRC32C checksum of the returned
15763    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
15764    /// An integrity check of initialization_vector can be performed by computing
15765    /// the CRC32C checksum of initialization_vector and comparing your results to
15766    /// this field. Discard the response in case of non-matching checksum values,
15767    /// and perform a limited number of retries. A persistent mismatch may indicate
15768    /// an issue in your computation of the CRC32C checksum. Note: This field is
15769    /// defined as int64 for reasons of compatibility across different languages.
15770    /// However, it is a non-negative integer, which will never exceed 2^32-1, and
15771    /// can be safely downconverted to uint32 in languages that support this type.
15772    ///
15773    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
15774    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
15775
15776    /// Integrity verification field. A flag indicating whether
15777    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15778    /// was received by
15779    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15780    /// for the integrity verification of the plaintext. A false value of this
15781    /// field indicates either that
15782    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15783    /// was left unset or that it was not delivered to
15784    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15785    /// set
15786    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15787    /// but this field is still false, discard the response and perform a limited
15788    /// number of retries.
15789    ///
15790    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15791    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
15792    pub verified_plaintext_crc32c: bool,
15793
15794    /// Integrity verification field. A flag indicating whether
15795    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15796    /// was received by
15797    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15798    /// for the integrity verification of additional_authenticated_data. A false
15799    /// value of this field indicates either that //
15800    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15801    /// was left unset or that it was not delivered to
15802    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15803    /// set
15804    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15805    /// but this field is still false, discard the response and perform a limited
15806    /// number of retries.
15807    ///
15808    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15809    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
15810    pub verified_additional_authenticated_data_crc32c: bool,
15811
15812    /// Integrity verification field. A flag indicating whether
15813    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15814    /// was received by
15815    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15816    /// for the integrity verification of initialization_vector. A false value of
15817    /// this field indicates either that
15818    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15819    /// was left unset or that it was not delivered to
15820    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15821    /// set
15822    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15823    /// but this field is still false, discard the response and perform a limited
15824    /// number of retries.
15825    ///
15826    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15827    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
15828    pub verified_initialization_vector_crc32c: bool,
15829
15830    /// The resource name of the
15831    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15832    /// encryption. Check this field to verify that the intended resource was used
15833    /// for encryption.
15834    ///
15835    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15836    pub name: std::string::String,
15837
15838    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15839    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15840    /// encryption.
15841    ///
15842    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15843    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15844    pub protection_level: crate::model::ProtectionLevel,
15845
15846    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15847}
15848
15849impl RawEncryptResponse {
15850    /// Creates a new default instance.
15851    pub fn new() -> Self {
15852        std::default::Default::default()
15853    }
15854
15855    /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
15856    ///
15857    /// # Example
15858    /// ```ignore,no_run
15859    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15860    /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15861    /// ```
15862    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15863        self.ciphertext = v.into();
15864        self
15865    }
15866
15867    /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
15868    ///
15869    /// # Example
15870    /// ```ignore,no_run
15871    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15872    /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
15873    /// ```
15874    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
15875        mut self,
15876        v: T,
15877    ) -> Self {
15878        self.initialization_vector = v.into();
15879        self
15880    }
15881
15882    /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
15883    ///
15884    /// # Example
15885    /// ```ignore,no_run
15886    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15887    /// let x = RawEncryptResponse::new().set_tag_length(42);
15888    /// ```
15889    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15890        self.tag_length = v.into();
15891        self
15892    }
15893
15894    /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15895    ///
15896    /// # Example
15897    /// ```ignore,no_run
15898    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15899    /// use wkt::Int64Value;
15900    /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15901    /// ```
15902    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15903    where
15904        T: std::convert::Into<wkt::Int64Value>,
15905    {
15906        self.ciphertext_crc32c = std::option::Option::Some(v.into());
15907        self
15908    }
15909
15910    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15911    ///
15912    /// # Example
15913    /// ```ignore,no_run
15914    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15915    /// use wkt::Int64Value;
15916    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15917    /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15918    /// ```
15919    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15920    where
15921        T: std::convert::Into<wkt::Int64Value>,
15922    {
15923        self.ciphertext_crc32c = v.map(|x| x.into());
15924        self
15925    }
15926
15927    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15928    ///
15929    /// # Example
15930    /// ```ignore,no_run
15931    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15932    /// use wkt::Int64Value;
15933    /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
15934    /// ```
15935    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
15936    where
15937        T: std::convert::Into<wkt::Int64Value>,
15938    {
15939        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
15940        self
15941    }
15942
15943    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15944    ///
15945    /// # Example
15946    /// ```ignore,no_run
15947    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15948    /// use wkt::Int64Value;
15949    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
15950    /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
15951    /// ```
15952    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15953    where
15954        T: std::convert::Into<wkt::Int64Value>,
15955    {
15956        self.initialization_vector_crc32c = v.map(|x| x.into());
15957        self
15958    }
15959
15960    /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
15961    ///
15962    /// # Example
15963    /// ```ignore,no_run
15964    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15965    /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
15966    /// ```
15967    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15968        self.verified_plaintext_crc32c = v.into();
15969        self
15970    }
15971
15972    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
15973    ///
15974    /// # Example
15975    /// ```ignore,no_run
15976    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15977    /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15978    /// ```
15979    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15980        mut self,
15981        v: T,
15982    ) -> Self {
15983        self.verified_additional_authenticated_data_crc32c = v.into();
15984        self
15985    }
15986
15987    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
15988    ///
15989    /// # Example
15990    /// ```ignore,no_run
15991    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15992    /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
15993    /// ```
15994    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15995        mut self,
15996        v: T,
15997    ) -> Self {
15998        self.verified_initialization_vector_crc32c = v.into();
15999        self
16000    }
16001
16002    /// Sets the value of [name][crate::model::RawEncryptResponse::name].
16003    ///
16004    /// # Example
16005    /// ```ignore,no_run
16006    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16007    /// let x = RawEncryptResponse::new().set_name("example");
16008    /// ```
16009    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16010        self.name = v.into();
16011        self
16012    }
16013
16014    /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
16015    ///
16016    /// # Example
16017    /// ```ignore,no_run
16018    /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16019    /// use google_cloud_kms_v1::model::ProtectionLevel;
16020    /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
16021    /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16022    /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
16023    /// ```
16024    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16025        mut self,
16026        v: T,
16027    ) -> Self {
16028        self.protection_level = v.into();
16029        self
16030    }
16031}
16032
16033impl wkt::message::Message for RawEncryptResponse {
16034    fn typename() -> &'static str {
16035        "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
16036    }
16037}
16038
16039/// Response message for
16040/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
16041///
16042/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
16043#[derive(Clone, Default, PartialEq)]
16044#[non_exhaustive]
16045pub struct RawDecryptResponse {
16046    /// The decrypted data.
16047    pub plaintext: ::bytes::Bytes,
16048
16049    /// Integrity verification field. A CRC32C checksum of the returned
16050    /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
16051    /// An integrity check of plaintext can be performed by computing the CRC32C
16052    /// checksum of plaintext and comparing your results to this field. Discard the
16053    /// response in case of non-matching checksum values, and perform a limited
16054    /// number of retries. A persistent mismatch may indicate an issue in your
16055    /// computation of the CRC32C checksum. Note: receiving this response message
16056    /// indicates that
16057    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16058    /// successfully decrypt the
16059    /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
16060    /// Note: This field is defined as int64 for reasons of compatibility across
16061    /// different languages. However, it is a non-negative integer, which will
16062    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
16063    /// that support this type.
16064    ///
16065    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16066    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
16067    /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
16068    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16069
16070    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16071    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16072    /// decryption.
16073    ///
16074    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16075    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16076    pub protection_level: crate::model::ProtectionLevel,
16077
16078    /// Integrity verification field. A flag indicating whether
16079    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
16080    /// was received by
16081    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16082    /// for the integrity verification of the ciphertext. A false value of this
16083    /// field indicates either that
16084    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
16085    /// was left unset or that it was not delivered to
16086    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16087    /// set
16088    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
16089    /// but this field is still false, discard the response and perform a limited
16090    /// number of retries.
16091    ///
16092    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16093    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
16094    pub verified_ciphertext_crc32c: bool,
16095
16096    /// Integrity verification field. A flag indicating whether
16097    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
16098    /// was received by
16099    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16100    /// for the integrity verification of additional_authenticated_data. A false
16101    /// value of this field indicates either that //
16102    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
16103    /// was left unset or that it was not delivered to
16104    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16105    /// set
16106    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
16107    /// but this field is still false, discard the response and perform a limited
16108    /// number of retries.
16109    ///
16110    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16111    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
16112    pub verified_additional_authenticated_data_crc32c: bool,
16113
16114    /// Integrity verification field. A flag indicating whether
16115    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
16116    /// was received by
16117    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16118    /// for the integrity verification of initialization_vector. A false value of
16119    /// this field indicates either that
16120    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
16121    /// was left unset or that it was not delivered to
16122    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16123    /// set
16124    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
16125    /// but this field is still false, discard the response and perform a limited
16126    /// number of retries.
16127    ///
16128    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16129    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
16130    pub verified_initialization_vector_crc32c: bool,
16131
16132    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16133}
16134
16135impl RawDecryptResponse {
16136    /// Creates a new default instance.
16137    pub fn new() -> Self {
16138        std::default::Default::default()
16139    }
16140
16141    /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
16142    ///
16143    /// # Example
16144    /// ```ignore,no_run
16145    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16146    /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16147    /// ```
16148    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16149        self.plaintext = v.into();
16150        self
16151    }
16152
16153    /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
16154    ///
16155    /// # Example
16156    /// ```ignore,no_run
16157    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16158    /// use wkt::Int64Value;
16159    /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16160    /// ```
16161    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16162    where
16163        T: std::convert::Into<wkt::Int64Value>,
16164    {
16165        self.plaintext_crc32c = std::option::Option::Some(v.into());
16166        self
16167    }
16168
16169    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
16170    ///
16171    /// # Example
16172    /// ```ignore,no_run
16173    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16174    /// use wkt::Int64Value;
16175    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16176    /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16177    /// ```
16178    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16179    where
16180        T: std::convert::Into<wkt::Int64Value>,
16181    {
16182        self.plaintext_crc32c = v.map(|x| x.into());
16183        self
16184    }
16185
16186    /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
16187    ///
16188    /// # Example
16189    /// ```ignore,no_run
16190    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16191    /// use google_cloud_kms_v1::model::ProtectionLevel;
16192    /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16193    /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16194    /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16195    /// ```
16196    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16197        mut self,
16198        v: T,
16199    ) -> Self {
16200        self.protection_level = v.into();
16201        self
16202    }
16203
16204    /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
16205    ///
16206    /// # Example
16207    /// ```ignore,no_run
16208    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16209    /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16210    /// ```
16211    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16212        self.verified_ciphertext_crc32c = v.into();
16213        self
16214    }
16215
16216    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
16217    ///
16218    /// # Example
16219    /// ```ignore,no_run
16220    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16221    /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
16222    /// ```
16223    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
16224        mut self,
16225        v: T,
16226    ) -> Self {
16227        self.verified_additional_authenticated_data_crc32c = v.into();
16228        self
16229    }
16230
16231    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
16232    ///
16233    /// # Example
16234    /// ```ignore,no_run
16235    /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16236    /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
16237    /// ```
16238    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
16239        mut self,
16240        v: T,
16241    ) -> Self {
16242        self.verified_initialization_vector_crc32c = v.into();
16243        self
16244    }
16245}
16246
16247impl wkt::message::Message for RawDecryptResponse {
16248    fn typename() -> &'static str {
16249        "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
16250    }
16251}
16252
16253/// Response message for
16254/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
16255///
16256/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
16257#[derive(Clone, Default, PartialEq)]
16258#[non_exhaustive]
16259pub struct AsymmetricSignResponse {
16260    /// The created signature.
16261    pub signature: ::bytes::Bytes,
16262
16263    /// Integrity verification field. A CRC32C checksum of the returned
16264    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
16265    /// An integrity check of
16266    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
16267    /// can be performed by computing the CRC32C checksum of
16268    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
16269    /// and comparing your results to this field. Discard the response in case of
16270    /// non-matching checksum values, and perform a limited number of retries. A
16271    /// persistent mismatch may indicate an issue in your computation of the CRC32C
16272    /// checksum. Note: This field is defined as int64 for reasons of compatibility
16273    /// across different languages. However, it is a non-negative integer, which
16274    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16275    /// languages that support this type.
16276    ///
16277    /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
16278    pub signature_crc32c: std::option::Option<wkt::Int64Value>,
16279
16280    /// Integrity verification field. A flag indicating whether
16281    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16282    /// was received by
16283    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16284    /// for the integrity verification of the
16285    /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
16286    /// of this field indicates either that
16287    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16288    /// was left unset or that it was not delivered to
16289    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16290    /// set
16291    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16292    /// but this field is still false, discard the response and perform a limited
16293    /// number of retries.
16294    ///
16295    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
16296    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
16297    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16298    pub verified_digest_crc32c: bool,
16299
16300    /// The resource name of the
16301    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16302    /// Check this field to verify that the intended resource was used for signing.
16303    ///
16304    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16305    pub name: std::string::String,
16306
16307    /// Integrity verification field. A flag indicating whether
16308    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.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.AsymmetricSignRequest.data]. A false value of
16313    /// this field indicates either that
16314    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.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    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.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.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
16323    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
16324    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16325    pub verified_data_crc32c: bool,
16326
16327    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16328    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16329    ///
16330    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16331    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16332    pub protection_level: crate::model::ProtectionLevel,
16333
16334    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16335}
16336
16337impl AsymmetricSignResponse {
16338    /// Creates a new default instance.
16339    pub fn new() -> Self {
16340        std::default::Default::default()
16341    }
16342
16343    /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
16344    ///
16345    /// # Example
16346    /// ```ignore,no_run
16347    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16348    /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
16349    /// ```
16350    pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16351        self.signature = v.into();
16352        self
16353    }
16354
16355    /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16356    ///
16357    /// # Example
16358    /// ```ignore,no_run
16359    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16360    /// use wkt::Int64Value;
16361    /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
16362    /// ```
16363    pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
16364    where
16365        T: std::convert::Into<wkt::Int64Value>,
16366    {
16367        self.signature_crc32c = std::option::Option::Some(v.into());
16368        self
16369    }
16370
16371    /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16372    ///
16373    /// # Example
16374    /// ```ignore,no_run
16375    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16376    /// use wkt::Int64Value;
16377    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
16378    /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
16379    /// ```
16380    pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16381    where
16382        T: std::convert::Into<wkt::Int64Value>,
16383    {
16384        self.signature_crc32c = v.map(|x| x.into());
16385        self
16386    }
16387
16388    /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
16389    ///
16390    /// # Example
16391    /// ```ignore,no_run
16392    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16393    /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
16394    /// ```
16395    pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16396        self.verified_digest_crc32c = v.into();
16397        self
16398    }
16399
16400    /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
16401    ///
16402    /// # Example
16403    /// ```ignore,no_run
16404    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16405    /// let x = AsymmetricSignResponse::new().set_name("example");
16406    /// ```
16407    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16408        self.name = v.into();
16409        self
16410    }
16411
16412    /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
16413    ///
16414    /// # Example
16415    /// ```ignore,no_run
16416    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16417    /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
16418    /// ```
16419    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16420        self.verified_data_crc32c = v.into();
16421        self
16422    }
16423
16424    /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
16425    ///
16426    /// # Example
16427    /// ```ignore,no_run
16428    /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16429    /// use google_cloud_kms_v1::model::ProtectionLevel;
16430    /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
16431    /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16432    /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
16433    /// ```
16434    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16435        mut self,
16436        v: T,
16437    ) -> Self {
16438        self.protection_level = v.into();
16439        self
16440    }
16441}
16442
16443impl wkt::message::Message for AsymmetricSignResponse {
16444    fn typename() -> &'static str {
16445        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
16446    }
16447}
16448
16449/// Response message for
16450/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
16451///
16452/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
16453#[derive(Clone, Default, PartialEq)]
16454#[non_exhaustive]
16455pub struct AsymmetricDecryptResponse {
16456    /// The decrypted data originally encrypted with the matching public key.
16457    pub plaintext: ::bytes::Bytes,
16458
16459    /// Integrity verification field. A CRC32C checksum of the returned
16460    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
16461    /// An integrity check of
16462    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
16463    /// can be performed by computing the CRC32C checksum of
16464    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
16465    /// and comparing your results to this field. Discard the response in case of
16466    /// non-matching checksum values, and perform a limited number of retries. A
16467    /// persistent mismatch may indicate an issue in your computation of the CRC32C
16468    /// checksum. Note: This field is defined as int64 for reasons of compatibility
16469    /// across different languages. However, it is a non-negative integer, which
16470    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16471    /// languages that support this type.
16472    ///
16473    /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
16474    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16475
16476    /// Integrity verification field. A flag indicating whether
16477    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16478    /// was received by
16479    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16480    /// for the integrity verification of the
16481    /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
16482    /// false value of this field indicates either that
16483    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16484    /// was left unset or that it was not delivered to
16485    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16486    /// set
16487    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16488    /// but this field is still false, discard the response and perform a limited
16489    /// number of retries.
16490    ///
16491    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
16492    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
16493    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16494    pub verified_ciphertext_crc32c: bool,
16495
16496    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16497    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16498    /// decryption.
16499    ///
16500    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16501    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16502    pub protection_level: crate::model::ProtectionLevel,
16503
16504    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16505}
16506
16507impl AsymmetricDecryptResponse {
16508    /// Creates a new default instance.
16509    pub fn new() -> Self {
16510        std::default::Default::default()
16511    }
16512
16513    /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
16514    ///
16515    /// # Example
16516    /// ```ignore,no_run
16517    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16518    /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16519    /// ```
16520    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16521        self.plaintext = v.into();
16522        self
16523    }
16524
16525    /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16526    ///
16527    /// # Example
16528    /// ```ignore,no_run
16529    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16530    /// use wkt::Int64Value;
16531    /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16532    /// ```
16533    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16534    where
16535        T: std::convert::Into<wkt::Int64Value>,
16536    {
16537        self.plaintext_crc32c = std::option::Option::Some(v.into());
16538        self
16539    }
16540
16541    /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16542    ///
16543    /// # Example
16544    /// ```ignore,no_run
16545    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16546    /// use wkt::Int64Value;
16547    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16548    /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16549    /// ```
16550    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16551    where
16552        T: std::convert::Into<wkt::Int64Value>,
16553    {
16554        self.plaintext_crc32c = v.map(|x| x.into());
16555        self
16556    }
16557
16558    /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
16559    ///
16560    /// # Example
16561    /// ```ignore,no_run
16562    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16563    /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16564    /// ```
16565    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16566        self.verified_ciphertext_crc32c = v.into();
16567        self
16568    }
16569
16570    /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
16571    ///
16572    /// # Example
16573    /// ```ignore,no_run
16574    /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16575    /// use google_cloud_kms_v1::model::ProtectionLevel;
16576    /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16577    /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16578    /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16579    /// ```
16580    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16581        mut self,
16582        v: T,
16583    ) -> Self {
16584        self.protection_level = v.into();
16585        self
16586    }
16587}
16588
16589impl wkt::message::Message for AsymmetricDecryptResponse {
16590    fn typename() -> &'static str {
16591        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
16592    }
16593}
16594
16595/// Response message for
16596/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
16597///
16598/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
16599#[derive(Clone, Default, PartialEq)]
16600#[non_exhaustive]
16601pub struct MacSignResponse {
16602    /// The resource name of the
16603    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16604    /// Check this field to verify that the intended resource was used for signing.
16605    ///
16606    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16607    pub name: std::string::String,
16608
16609    /// The created signature.
16610    pub mac: ::bytes::Bytes,
16611
16612    /// Integrity verification field. A CRC32C checksum of the returned
16613    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
16614    /// integrity check of
16615    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
16616    /// performed by computing the CRC32C checksum of
16617    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
16618    /// comparing your results to this field. Discard the response in case of
16619    /// non-matching checksum values, and perform a limited number of retries. A
16620    /// persistent mismatch may indicate an issue in your computation of the CRC32C
16621    /// checksum. Note: This field is defined as int64 for reasons of compatibility
16622    /// across different languages. However, it is a non-negative integer, which
16623    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16624    /// languages that support this type.
16625    ///
16626    /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
16627    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
16628
16629    /// Integrity verification field. A flag indicating whether
16630    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16631    /// was received by
16632    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16633    /// for the integrity verification of the
16634    /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
16635    /// field indicates either that
16636    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16637    /// was left unset or that it was not delivered to
16638    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16639    /// set
16640    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16641    /// but this field is still false, discard the response and perform a limited
16642    /// number of retries.
16643    ///
16644    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16645    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
16646    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
16647    pub verified_data_crc32c: bool,
16648
16649    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16650    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16651    ///
16652    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16653    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16654    pub protection_level: crate::model::ProtectionLevel,
16655
16656    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16657}
16658
16659impl MacSignResponse {
16660    /// Creates a new default instance.
16661    pub fn new() -> Self {
16662        std::default::Default::default()
16663    }
16664
16665    /// Sets the value of [name][crate::model::MacSignResponse::name].
16666    ///
16667    /// # Example
16668    /// ```ignore,no_run
16669    /// # use google_cloud_kms_v1::model::MacSignResponse;
16670    /// let x = MacSignResponse::new().set_name("example");
16671    /// ```
16672    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16673        self.name = v.into();
16674        self
16675    }
16676
16677    /// Sets the value of [mac][crate::model::MacSignResponse::mac].
16678    ///
16679    /// # Example
16680    /// ```ignore,no_run
16681    /// # use google_cloud_kms_v1::model::MacSignResponse;
16682    /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
16683    /// ```
16684    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16685        self.mac = v.into();
16686        self
16687    }
16688
16689    /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16690    ///
16691    /// # Example
16692    /// ```ignore,no_run
16693    /// # use google_cloud_kms_v1::model::MacSignResponse;
16694    /// use wkt::Int64Value;
16695    /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
16696    /// ```
16697    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
16698    where
16699        T: std::convert::Into<wkt::Int64Value>,
16700    {
16701        self.mac_crc32c = std::option::Option::Some(v.into());
16702        self
16703    }
16704
16705    /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16706    ///
16707    /// # Example
16708    /// ```ignore,no_run
16709    /// # use google_cloud_kms_v1::model::MacSignResponse;
16710    /// use wkt::Int64Value;
16711    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
16712    /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
16713    /// ```
16714    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16715    where
16716        T: std::convert::Into<wkt::Int64Value>,
16717    {
16718        self.mac_crc32c = v.map(|x| x.into());
16719        self
16720    }
16721
16722    /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
16723    ///
16724    /// # Example
16725    /// ```ignore,no_run
16726    /// # use google_cloud_kms_v1::model::MacSignResponse;
16727    /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
16728    /// ```
16729    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16730        self.verified_data_crc32c = v.into();
16731        self
16732    }
16733
16734    /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
16735    ///
16736    /// # Example
16737    /// ```ignore,no_run
16738    /// # use google_cloud_kms_v1::model::MacSignResponse;
16739    /// use google_cloud_kms_v1::model::ProtectionLevel;
16740    /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
16741    /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16742    /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
16743    /// ```
16744    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16745        mut self,
16746        v: T,
16747    ) -> Self {
16748        self.protection_level = v.into();
16749        self
16750    }
16751}
16752
16753impl wkt::message::Message for MacSignResponse {
16754    fn typename() -> &'static str {
16755        "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
16756    }
16757}
16758
16759/// Response message for
16760/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
16761///
16762/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
16763#[derive(Clone, Default, PartialEq)]
16764#[non_exhaustive]
16765pub struct MacVerifyResponse {
16766    /// The resource name of the
16767    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16768    /// verification. Check this field to verify that the intended resource was
16769    /// used for verification.
16770    ///
16771    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16772    pub name: std::string::String,
16773
16774    /// This field indicates whether or not the verification operation for
16775    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
16776    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
16777    /// successful.
16778    ///
16779    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16780    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16781    pub success: bool,
16782
16783    /// Integrity verification field. A flag indicating whether
16784    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16785    /// was received by
16786    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16787    /// for the integrity verification of the
16788    /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
16789    /// field indicates either that
16790    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16791    /// was left unset or that it was not delivered to
16792    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16793    /// set
16794    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16795    /// but this field is still false, discard the response and perform a limited
16796    /// number of retries.
16797    ///
16798    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16799    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16800    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
16801    pub verified_data_crc32c: bool,
16802
16803    /// Integrity verification field. A flag indicating whether
16804    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16805    /// was received by
16806    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16807    /// for the integrity verification of the
16808    /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
16809    /// field indicates either that
16810    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16811    /// was left unset or that it was not delivered to
16812    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16813    /// set
16814    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16815    /// but this field is still false, discard the response and perform a limited
16816    /// number of retries.
16817    ///
16818    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16819    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16820    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
16821    pub verified_mac_crc32c: bool,
16822
16823    /// Integrity verification field. This value is used for the integrity
16824    /// verification of [MacVerifyResponse.success]. If the value of this field
16825    /// contradicts the value of [MacVerifyResponse.success], discard the response
16826    /// and perform a limited number of retries.
16827    pub verified_success_integrity: bool,
16828
16829    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16830    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16831    /// verification.
16832    ///
16833    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16834    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16835    pub protection_level: crate::model::ProtectionLevel,
16836
16837    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16838}
16839
16840impl MacVerifyResponse {
16841    /// Creates a new default instance.
16842    pub fn new() -> Self {
16843        std::default::Default::default()
16844    }
16845
16846    /// Sets the value of [name][crate::model::MacVerifyResponse::name].
16847    ///
16848    /// # Example
16849    /// ```ignore,no_run
16850    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16851    /// let x = MacVerifyResponse::new().set_name("example");
16852    /// ```
16853    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16854        self.name = v.into();
16855        self
16856    }
16857
16858    /// Sets the value of [success][crate::model::MacVerifyResponse::success].
16859    ///
16860    /// # Example
16861    /// ```ignore,no_run
16862    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16863    /// let x = MacVerifyResponse::new().set_success(true);
16864    /// ```
16865    pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16866        self.success = v.into();
16867        self
16868    }
16869
16870    /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
16871    ///
16872    /// # Example
16873    /// ```ignore,no_run
16874    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16875    /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
16876    /// ```
16877    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16878        self.verified_data_crc32c = v.into();
16879        self
16880    }
16881
16882    /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
16883    ///
16884    /// # Example
16885    /// ```ignore,no_run
16886    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16887    /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
16888    /// ```
16889    pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16890        self.verified_mac_crc32c = v.into();
16891        self
16892    }
16893
16894    /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
16895    ///
16896    /// # Example
16897    /// ```ignore,no_run
16898    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16899    /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
16900    /// ```
16901    pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16902        self.verified_success_integrity = v.into();
16903        self
16904    }
16905
16906    /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
16907    ///
16908    /// # Example
16909    /// ```ignore,no_run
16910    /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16911    /// use google_cloud_kms_v1::model::ProtectionLevel;
16912    /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
16913    /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
16914    /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
16915    /// ```
16916    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16917        mut self,
16918        v: T,
16919    ) -> Self {
16920        self.protection_level = v.into();
16921        self
16922    }
16923}
16924
16925impl wkt::message::Message for MacVerifyResponse {
16926    fn typename() -> &'static str {
16927        "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
16928    }
16929}
16930
16931/// Response message for
16932/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
16933///
16934/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
16935#[derive(Clone, Default, PartialEq)]
16936#[non_exhaustive]
16937pub struct DecapsulateResponse {
16938    /// The resource name of the
16939    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16940    /// decapsulation. Check this field to verify that the intended resource was
16941    /// used for decapsulation.
16942    ///
16943    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16944    pub name: std::string::String,
16945
16946    /// The decapsulated shared_secret originally encapsulated with the matching
16947    /// public key.
16948    pub shared_secret: ::bytes::Bytes,
16949
16950    /// Integrity verification field. A CRC32C checksum of the returned
16951    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
16952    /// An integrity check of
16953    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16954    /// can be performed by computing the CRC32C checksum of
16955    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16956    /// and comparing your results to this field. Discard the response in case of
16957    /// non-matching checksum values, and perform a limited number of retries. A
16958    /// persistent mismatch may indicate an issue in your computation of the CRC32C
16959    /// checksum. Note: receiving this response message indicates that
16960    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16961    /// successfully decrypt the
16962    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
16963    /// field is defined as int64 for reasons of compatibility across different
16964    /// languages. However, it is a non-negative integer, which will never exceed
16965    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
16966    /// this type.
16967    ///
16968    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16969    /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
16970    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16971    pub shared_secret_crc32c: std::option::Option<i64>,
16972
16973    /// Integrity verification field. A flag indicating whether
16974    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16975    /// was received by
16976    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16977    /// for the integrity verification of the
16978    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
16979    /// value of this field indicates either that
16980    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16981    /// was left unset or that it was not delivered to
16982    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16983    /// set
16984    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16985    /// but this field is still false, discard the response and perform a limited
16986    /// number of retries.
16987    ///
16988    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16989    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
16990    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16991    pub verified_ciphertext_crc32c: bool,
16992
16993    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16994    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16995    /// decapsulation.
16996    ///
16997    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16998    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16999    pub protection_level: crate::model::ProtectionLevel,
17000
17001    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17002}
17003
17004impl DecapsulateResponse {
17005    /// Creates a new default instance.
17006    pub fn new() -> Self {
17007        std::default::Default::default()
17008    }
17009
17010    /// Sets the value of [name][crate::model::DecapsulateResponse::name].
17011    ///
17012    /// # Example
17013    /// ```ignore,no_run
17014    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17015    /// let x = DecapsulateResponse::new().set_name("example");
17016    /// ```
17017    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17018        self.name = v.into();
17019        self
17020    }
17021
17022    /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
17023    ///
17024    /// # Example
17025    /// ```ignore,no_run
17026    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17027    /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
17028    /// ```
17029    pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17030        self.shared_secret = v.into();
17031        self
17032    }
17033
17034    /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
17035    ///
17036    /// # Example
17037    /// ```ignore,no_run
17038    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17039    /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
17040    /// ```
17041    pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
17042    where
17043        T: std::convert::Into<i64>,
17044    {
17045        self.shared_secret_crc32c = std::option::Option::Some(v.into());
17046        self
17047    }
17048
17049    /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
17050    ///
17051    /// # Example
17052    /// ```ignore,no_run
17053    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17054    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
17055    /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
17056    /// ```
17057    pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
17058    where
17059        T: std::convert::Into<i64>,
17060    {
17061        self.shared_secret_crc32c = v.map(|x| x.into());
17062        self
17063    }
17064
17065    /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
17066    ///
17067    /// # Example
17068    /// ```ignore,no_run
17069    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17070    /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
17071    /// ```
17072    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17073        self.verified_ciphertext_crc32c = v.into();
17074        self
17075    }
17076
17077    /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
17078    ///
17079    /// # Example
17080    /// ```ignore,no_run
17081    /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17082    /// use google_cloud_kms_v1::model::ProtectionLevel;
17083    /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
17084    /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
17085    /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
17086    /// ```
17087    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
17088        mut self,
17089        v: T,
17090    ) -> Self {
17091        self.protection_level = v.into();
17092        self
17093    }
17094}
17095
17096impl wkt::message::Message for DecapsulateResponse {
17097    fn typename() -> &'static str {
17098        "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
17099    }
17100}
17101
17102/// Response message for
17103/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
17104///
17105/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
17106#[derive(Clone, Default, PartialEq)]
17107#[non_exhaustive]
17108pub struct GenerateRandomBytesResponse {
17109    /// The generated data.
17110    pub data: ::bytes::Bytes,
17111
17112    /// Integrity verification field. A CRC32C checksum of the returned
17113    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
17114    /// An integrity check of
17115    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
17116    /// can be performed by computing the CRC32C checksum of
17117    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
17118    /// and comparing your results to this field. Discard the response in case of
17119    /// non-matching checksum values, and perform a limited number of retries. A
17120    /// persistent mismatch may indicate an issue in your computation of the CRC32C
17121    /// checksum. Note: This field is defined as int64 for reasons of compatibility
17122    /// across different languages. However, it is a non-negative integer, which
17123    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
17124    /// languages that support this type.
17125    ///
17126    /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
17127    pub data_crc32c: std::option::Option<wkt::Int64Value>,
17128
17129    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17130}
17131
17132impl GenerateRandomBytesResponse {
17133    /// Creates a new default instance.
17134    pub fn new() -> Self {
17135        std::default::Default::default()
17136    }
17137
17138    /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
17139    ///
17140    /// # Example
17141    /// ```ignore,no_run
17142    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17143    /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
17144    /// ```
17145    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17146        self.data = v.into();
17147        self
17148    }
17149
17150    /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
17151    ///
17152    /// # Example
17153    /// ```ignore,no_run
17154    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17155    /// use wkt::Int64Value;
17156    /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
17157    /// ```
17158    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
17159    where
17160        T: std::convert::Into<wkt::Int64Value>,
17161    {
17162        self.data_crc32c = std::option::Option::Some(v.into());
17163        self
17164    }
17165
17166    /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
17167    ///
17168    /// # Example
17169    /// ```ignore,no_run
17170    /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17171    /// use wkt::Int64Value;
17172    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
17173    /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
17174    /// ```
17175    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
17176    where
17177        T: std::convert::Into<wkt::Int64Value>,
17178    {
17179        self.data_crc32c = v.map(|x| x.into());
17180        self
17181    }
17182}
17183
17184impl wkt::message::Message for GenerateRandomBytesResponse {
17185    fn typename() -> &'static str {
17186        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
17187    }
17188}
17189
17190/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
17191///
17192/// [google.cloud.kms.v1.Digest]: crate::model::Digest
17193#[derive(Clone, Default, PartialEq)]
17194#[non_exhaustive]
17195pub struct Digest {
17196    /// Required. The message digest.
17197    pub digest: std::option::Option<crate::model::digest::Digest>,
17198
17199    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17200}
17201
17202impl Digest {
17203    /// Creates a new default instance.
17204    pub fn new() -> Self {
17205        std::default::Default::default()
17206    }
17207
17208    /// Sets the value of [digest][crate::model::Digest::digest].
17209    ///
17210    /// Note that all the setters affecting `digest` are mutually
17211    /// exclusive.
17212    ///
17213    /// # Example
17214    /// ```ignore,no_run
17215    /// # use google_cloud_kms_v1::model::Digest;
17216    /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
17217    /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
17218    /// ```
17219    pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
17220        mut self,
17221        v: T,
17222    ) -> Self {
17223        self.digest = v.into();
17224        self
17225    }
17226
17227    /// The value of [digest][crate::model::Digest::digest]
17228    /// if it holds a `Sha256`, `None` if the field is not set or
17229    /// holds a different branch.
17230    pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
17231        #[allow(unreachable_patterns)]
17232        self.digest.as_ref().and_then(|v| match v {
17233            crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
17234            _ => std::option::Option::None,
17235        })
17236    }
17237
17238    /// Sets the value of [digest][crate::model::Digest::digest]
17239    /// to hold a `Sha256`.
17240    ///
17241    /// Note that all the setters affecting `digest` are
17242    /// mutually exclusive.
17243    ///
17244    /// # Example
17245    /// ```ignore,no_run
17246    /// # use google_cloud_kms_v1::model::Digest;
17247    /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
17248    /// assert!(x.sha256().is_some());
17249    /// assert!(x.sha384().is_none());
17250    /// assert!(x.sha512().is_none());
17251    /// assert!(x.external_mu().is_none());
17252    /// ```
17253    pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17254        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
17255        self
17256    }
17257
17258    /// The value of [digest][crate::model::Digest::digest]
17259    /// if it holds a `Sha384`, `None` if the field is not set or
17260    /// holds a different branch.
17261    pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
17262        #[allow(unreachable_patterns)]
17263        self.digest.as_ref().and_then(|v| match v {
17264            crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
17265            _ => std::option::Option::None,
17266        })
17267    }
17268
17269    /// Sets the value of [digest][crate::model::Digest::digest]
17270    /// to hold a `Sha384`.
17271    ///
17272    /// Note that all the setters affecting `digest` are
17273    /// mutually exclusive.
17274    ///
17275    /// # Example
17276    /// ```ignore,no_run
17277    /// # use google_cloud_kms_v1::model::Digest;
17278    /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
17279    /// assert!(x.sha384().is_some());
17280    /// assert!(x.sha256().is_none());
17281    /// assert!(x.sha512().is_none());
17282    /// assert!(x.external_mu().is_none());
17283    /// ```
17284    pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17285        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
17286        self
17287    }
17288
17289    /// The value of [digest][crate::model::Digest::digest]
17290    /// if it holds a `Sha512`, `None` if the field is not set or
17291    /// holds a different branch.
17292    pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
17293        #[allow(unreachable_patterns)]
17294        self.digest.as_ref().and_then(|v| match v {
17295            crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
17296            _ => std::option::Option::None,
17297        })
17298    }
17299
17300    /// Sets the value of [digest][crate::model::Digest::digest]
17301    /// to hold a `Sha512`.
17302    ///
17303    /// Note that all the setters affecting `digest` are
17304    /// mutually exclusive.
17305    ///
17306    /// # Example
17307    /// ```ignore,no_run
17308    /// # use google_cloud_kms_v1::model::Digest;
17309    /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
17310    /// assert!(x.sha512().is_some());
17311    /// assert!(x.sha256().is_none());
17312    /// assert!(x.sha384().is_none());
17313    /// assert!(x.external_mu().is_none());
17314    /// ```
17315    pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17316        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
17317        self
17318    }
17319
17320    /// The value of [digest][crate::model::Digest::digest]
17321    /// if it holds a `ExternalMu`, `None` if the field is not set or
17322    /// holds a different branch.
17323    pub fn external_mu(&self) -> std::option::Option<&::bytes::Bytes> {
17324        #[allow(unreachable_patterns)]
17325        self.digest.as_ref().and_then(|v| match v {
17326            crate::model::digest::Digest::ExternalMu(v) => std::option::Option::Some(v),
17327            _ => std::option::Option::None,
17328        })
17329    }
17330
17331    /// Sets the value of [digest][crate::model::Digest::digest]
17332    /// to hold a `ExternalMu`.
17333    ///
17334    /// Note that all the setters affecting `digest` are
17335    /// mutually exclusive.
17336    ///
17337    /// # Example
17338    /// ```ignore,no_run
17339    /// # use google_cloud_kms_v1::model::Digest;
17340    /// let x = Digest::new().set_external_mu(bytes::Bytes::from_static(b"example"));
17341    /// assert!(x.external_mu().is_some());
17342    /// assert!(x.sha256().is_none());
17343    /// assert!(x.sha384().is_none());
17344    /// assert!(x.sha512().is_none());
17345    /// ```
17346    pub fn set_external_mu<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17347        self.digest = std::option::Option::Some(crate::model::digest::Digest::ExternalMu(v.into()));
17348        self
17349    }
17350}
17351
17352impl wkt::message::Message for Digest {
17353    fn typename() -> &'static str {
17354        "type.googleapis.com/google.cloud.kms.v1.Digest"
17355    }
17356}
17357
17358/// Defines additional types related to [Digest].
17359pub mod digest {
17360    #[allow(unused_imports)]
17361    use super::*;
17362
17363    /// Required. The message digest.
17364    #[derive(Clone, Debug, PartialEq)]
17365    #[non_exhaustive]
17366    pub enum Digest {
17367        /// A message digest produced with the SHA-256 algorithm.
17368        Sha256(::bytes::Bytes),
17369        /// A message digest produced with the SHA-384 algorithm.
17370        Sha384(::bytes::Bytes),
17371        /// A message digest produced with the SHA-512 algorithm.
17372        Sha512(::bytes::Bytes),
17373        /// A message digest produced with SHAKE-256, to be used with ML-DSA
17374        /// external-μ algorithms only. See "message representative" note in
17375        /// section 6.2, algorithm 7 of the FIPS-204 standard:
17376        /// <https://doi.org/10.6028/nist.fips.204>
17377        ExternalMu(::bytes::Bytes),
17378    }
17379}
17380
17381/// Cloud KMS metadata for the given
17382/// [google.cloud.location.Location][google.cloud.location.Location].
17383///
17384/// [google.cloud.location.Location]: google_cloud_location::model::Location
17385#[derive(Clone, Default, PartialEq)]
17386#[non_exhaustive]
17387pub struct LocationMetadata {
17388    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17389    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17390    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
17391    /// location.
17392    ///
17393    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17394    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17395    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
17396    pub hsm_available: bool,
17397
17398    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17399    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17400    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
17401    /// this location.
17402    ///
17403    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17404    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17405    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
17406    pub ekm_available: bool,
17407
17408    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17409    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17410    /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
17411    /// can be created in this location.
17412    ///
17413    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17414    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17415    /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
17416    pub hsm_single_tenant_available: bool,
17417
17418    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17419}
17420
17421impl LocationMetadata {
17422    /// Creates a new default instance.
17423    pub fn new() -> Self {
17424        std::default::Default::default()
17425    }
17426
17427    /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
17428    ///
17429    /// # Example
17430    /// ```ignore,no_run
17431    /// # use google_cloud_kms_v1::model::LocationMetadata;
17432    /// let x = LocationMetadata::new().set_hsm_available(true);
17433    /// ```
17434    pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17435        self.hsm_available = v.into();
17436        self
17437    }
17438
17439    /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
17440    ///
17441    /// # Example
17442    /// ```ignore,no_run
17443    /// # use google_cloud_kms_v1::model::LocationMetadata;
17444    /// let x = LocationMetadata::new().set_ekm_available(true);
17445    /// ```
17446    pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17447        self.ekm_available = v.into();
17448        self
17449    }
17450
17451    /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
17452    ///
17453    /// # Example
17454    /// ```ignore,no_run
17455    /// # use google_cloud_kms_v1::model::LocationMetadata;
17456    /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
17457    /// ```
17458    pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17459        self.hsm_single_tenant_available = v.into();
17460        self
17461    }
17462}
17463
17464impl wkt::message::Message for LocationMetadata {
17465    fn typename() -> &'static str {
17466        "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
17467    }
17468}
17469
17470/// Represents the metadata of the
17471/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]
17472/// long-running operation.
17473///
17474/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
17475#[derive(Clone, Default, PartialEq)]
17476#[non_exhaustive]
17477pub struct DeleteCryptoKeyMetadata {
17478    /// Output only. The resource name of the
17479    /// [RetiredResource][google.cloud.kms.v1.RetiredResource] created as a result
17480    /// of this operation, in the format
17481    /// `projects/*/locations/*/retiredResources/*`.
17482    ///
17483    /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
17484    pub retired_resource: std::string::String,
17485
17486    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17487}
17488
17489impl DeleteCryptoKeyMetadata {
17490    /// Creates a new default instance.
17491    pub fn new() -> Self {
17492        std::default::Default::default()
17493    }
17494
17495    /// Sets the value of [retired_resource][crate::model::DeleteCryptoKeyMetadata::retired_resource].
17496    ///
17497    /// # Example
17498    /// ```ignore,no_run
17499    /// # use google_cloud_kms_v1::model::DeleteCryptoKeyMetadata;
17500    /// # let project_id = "project_id";
17501    /// # let location_id = "location_id";
17502    /// # let retired_resource_id = "retired_resource_id";
17503    /// let x = DeleteCryptoKeyMetadata::new().set_retired_resource(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
17504    /// ```
17505    pub fn set_retired_resource<T: std::convert::Into<std::string::String>>(
17506        mut self,
17507        v: T,
17508    ) -> Self {
17509        self.retired_resource = v.into();
17510        self
17511    }
17512}
17513
17514impl wkt::message::Message for DeleteCryptoKeyMetadata {
17515    fn typename() -> &'static str {
17516        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyMetadata"
17517    }
17518}
17519
17520/// Represents the metadata of the
17521/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]
17522/// long-running operation.
17523///
17524/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
17525#[derive(Clone, Default, PartialEq)]
17526#[non_exhaustive]
17527pub struct DeleteCryptoKeyVersionMetadata {
17528    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17529}
17530
17531impl DeleteCryptoKeyVersionMetadata {
17532    /// Creates a new default instance.
17533    pub fn new() -> Self {
17534        std::default::Default::default()
17535    }
17536}
17537
17538impl wkt::message::Message for DeleteCryptoKeyVersionMetadata {
17539    fn typename() -> &'static str {
17540        "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionMetadata"
17541    }
17542}
17543
17544/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
17545/// cryptographic operations are performed. For more information, see [Protection
17546/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
17547///
17548/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17549///
17550/// # Working with unknown values
17551///
17552/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17553/// additional enum variants at any time. Adding new variants is not considered
17554/// a breaking change. Applications should write their code in anticipation of:
17555///
17556/// - New values appearing in future releases of the client library, **and**
17557/// - New values received dynamically, without application changes.
17558///
17559/// Please consult the [Working with enums] section in the user guide for some
17560/// guidelines.
17561///
17562/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17563#[derive(Clone, Debug, PartialEq)]
17564#[non_exhaustive]
17565pub enum ProtectionLevel {
17566    /// Not specified.
17567    Unspecified,
17568    /// Crypto operations are performed in software.
17569    Software,
17570    /// Crypto operations are performed in a Hardware Security Module.
17571    Hsm,
17572    /// Crypto operations are performed by an external key manager.
17573    External,
17574    /// Crypto operations are performed in an EKM-over-VPC backend.
17575    ExternalVpc,
17576    /// Crypto operations are performed in a single-tenant HSM.
17577    HsmSingleTenant,
17578    /// If set, the enum was initialized with an unknown value.
17579    ///
17580    /// Applications can examine the value using [ProtectionLevel::value] or
17581    /// [ProtectionLevel::name].
17582    UnknownValue(protection_level::UnknownValue),
17583}
17584
17585#[doc(hidden)]
17586pub mod protection_level {
17587    #[allow(unused_imports)]
17588    use super::*;
17589    #[derive(Clone, Debug, PartialEq)]
17590    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17591}
17592
17593impl ProtectionLevel {
17594    /// Gets the enum value.
17595    ///
17596    /// Returns `None` if the enum contains an unknown value deserialized from
17597    /// the string representation of enums.
17598    pub fn value(&self) -> std::option::Option<i32> {
17599        match self {
17600            Self::Unspecified => std::option::Option::Some(0),
17601            Self::Software => std::option::Option::Some(1),
17602            Self::Hsm => std::option::Option::Some(2),
17603            Self::External => std::option::Option::Some(3),
17604            Self::ExternalVpc => std::option::Option::Some(4),
17605            Self::HsmSingleTenant => std::option::Option::Some(5),
17606            Self::UnknownValue(u) => u.0.value(),
17607        }
17608    }
17609
17610    /// Gets the enum value as a string.
17611    ///
17612    /// Returns `None` if the enum contains an unknown value deserialized from
17613    /// the integer representation of enums.
17614    pub fn name(&self) -> std::option::Option<&str> {
17615        match self {
17616            Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
17617            Self::Software => std::option::Option::Some("SOFTWARE"),
17618            Self::Hsm => std::option::Option::Some("HSM"),
17619            Self::External => std::option::Option::Some("EXTERNAL"),
17620            Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
17621            Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
17622            Self::UnknownValue(u) => u.0.name(),
17623        }
17624    }
17625}
17626
17627impl std::default::Default for ProtectionLevel {
17628    fn default() -> Self {
17629        use std::convert::From;
17630        Self::from(0)
17631    }
17632}
17633
17634impl std::fmt::Display for ProtectionLevel {
17635    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17636        wkt::internal::display_enum(f, self.name(), self.value())
17637    }
17638}
17639
17640impl std::convert::From<i32> for ProtectionLevel {
17641    fn from(value: i32) -> Self {
17642        match value {
17643            0 => Self::Unspecified,
17644            1 => Self::Software,
17645            2 => Self::Hsm,
17646            3 => Self::External,
17647            4 => Self::ExternalVpc,
17648            5 => Self::HsmSingleTenant,
17649            _ => Self::UnknownValue(protection_level::UnknownValue(
17650                wkt::internal::UnknownEnumValue::Integer(value),
17651            )),
17652        }
17653    }
17654}
17655
17656impl std::convert::From<&str> for ProtectionLevel {
17657    fn from(value: &str) -> Self {
17658        use std::string::ToString;
17659        match value {
17660            "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
17661            "SOFTWARE" => Self::Software,
17662            "HSM" => Self::Hsm,
17663            "EXTERNAL" => Self::External,
17664            "EXTERNAL_VPC" => Self::ExternalVpc,
17665            "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
17666            _ => Self::UnknownValue(protection_level::UnknownValue(
17667                wkt::internal::UnknownEnumValue::String(value.to_string()),
17668            )),
17669        }
17670    }
17671}
17672
17673impl serde::ser::Serialize for ProtectionLevel {
17674    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17675    where
17676        S: serde::Serializer,
17677    {
17678        match self {
17679            Self::Unspecified => serializer.serialize_i32(0),
17680            Self::Software => serializer.serialize_i32(1),
17681            Self::Hsm => serializer.serialize_i32(2),
17682            Self::External => serializer.serialize_i32(3),
17683            Self::ExternalVpc => serializer.serialize_i32(4),
17684            Self::HsmSingleTenant => serializer.serialize_i32(5),
17685            Self::UnknownValue(u) => u.0.serialize(serializer),
17686        }
17687    }
17688}
17689
17690impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
17691    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17692    where
17693        D: serde::Deserializer<'de>,
17694    {
17695        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
17696            ".google.cloud.kms.v1.ProtectionLevel",
17697        ))
17698    }
17699}
17700
17701/// Describes the reason for a data access. Please refer to
17702/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
17703/// for the detailed semantic meaning of justification reason codes.
17704///
17705/// # Working with unknown values
17706///
17707/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17708/// additional enum variants at any time. Adding new variants is not considered
17709/// a breaking change. Applications should write their code in anticipation of:
17710///
17711/// - New values appearing in future releases of the client library, **and**
17712/// - New values received dynamically, without application changes.
17713///
17714/// Please consult the [Working with enums] section in the user guide for some
17715/// guidelines.
17716///
17717/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17718#[derive(Clone, Debug, PartialEq)]
17719#[non_exhaustive]
17720pub enum AccessReason {
17721    /// Unspecified access reason.
17722    ReasonUnspecified,
17723    /// Customer-initiated support.
17724    CustomerInitiatedSupport,
17725    /// Google-initiated access for system management and troubleshooting.
17726    GoogleInitiatedService,
17727    /// Google-initiated access in response to a legal request or legal process.
17728    ThirdPartyDataRequest,
17729    /// Google-initiated access for security, fraud, abuse, or compliance purposes.
17730    GoogleInitiatedReview,
17731    /// Customer uses their account to perform any access to their own data which
17732    /// their IAM policy authorizes.
17733    CustomerInitiatedAccess,
17734    /// Google systems access customer data to help optimize the structure of the
17735    /// data or quality for future uses by the customer.
17736    GoogleInitiatedSystemOperation,
17737    /// No reason is expected for this key request.
17738    ReasonNotExpected,
17739    /// Deprecated: This code is no longer generated by
17740    /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17741    /// available in both Key Access Justifications and Access Transparency logs
17742    /// provide customer-visible signals of emergency access in more precise
17743    /// contexts.
17744    ///
17745    /// Customer uses their account to perform any access to their own data which
17746    /// their IAM policy authorizes, and one of the following is true:
17747    ///
17748    /// * A Google administrator has reset the root-access account associated with
17749    ///   the user's organization within the past 7 days.
17750    /// * A Google-initiated emergency access operation has interacted with a
17751    ///   resource in the same project or folder as the currently accessed resource
17752    ///   within the past 7 days.
17753    #[deprecated]
17754    ModifiedCustomerInitiatedAccess,
17755    /// Deprecated: This code is no longer generated by
17756    /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17757    /// available in both Key Access Justifications and Access Transparency logs
17758    /// provide customer-visible signals of emergency access in more precise
17759    /// contexts.
17760    ///
17761    /// Google systems access customer data to help optimize the structure of the
17762    /// data or quality for future uses by the customer, and one of the following
17763    /// is true:
17764    ///
17765    /// * A Google administrator has reset the root-access account associated with
17766    ///   the user's organization within the past 7 days.
17767    /// * A Google-initiated emergency access operation has interacted with a
17768    ///   resource in the same project or folder as the currently accessed resource
17769    ///   within the past 7 days.
17770    #[deprecated]
17771    ModifiedGoogleInitiatedSystemOperation,
17772    /// Google-initiated access to maintain system reliability.
17773    GoogleResponseToProductionAlert,
17774    /// One of the following operations is being executed while simultaneously
17775    /// encountering an internal technical issue which prevented a more precise
17776    /// justification code from being generated:
17777    ///
17778    /// * Your account has been used to perform any access to your own data which
17779    ///   your IAM policy authorizes.
17780    /// * An automated Google system operates on encrypted customer data which your
17781    ///   IAM policy authorizes.
17782    /// * Customer-initiated Google support access.
17783    /// * Google-initiated support access to protect system reliability.
17784    CustomerAuthorizedWorkflowServicing,
17785    /// If set, the enum was initialized with an unknown value.
17786    ///
17787    /// Applications can examine the value using [AccessReason::value] or
17788    /// [AccessReason::name].
17789    UnknownValue(access_reason::UnknownValue),
17790}
17791
17792#[doc(hidden)]
17793pub mod access_reason {
17794    #[allow(unused_imports)]
17795    use super::*;
17796    #[derive(Clone, Debug, PartialEq)]
17797    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17798}
17799
17800impl AccessReason {
17801    /// Gets the enum value.
17802    ///
17803    /// Returns `None` if the enum contains an unknown value deserialized from
17804    /// the string representation of enums.
17805    pub fn value(&self) -> std::option::Option<i32> {
17806        match self {
17807            Self::ReasonUnspecified => std::option::Option::Some(0),
17808            Self::CustomerInitiatedSupport => std::option::Option::Some(1),
17809            Self::GoogleInitiatedService => std::option::Option::Some(2),
17810            Self::ThirdPartyDataRequest => std::option::Option::Some(3),
17811            Self::GoogleInitiatedReview => std::option::Option::Some(4),
17812            Self::CustomerInitiatedAccess => std::option::Option::Some(5),
17813            Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
17814            Self::ReasonNotExpected => std::option::Option::Some(7),
17815            Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
17816            Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
17817            Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
17818            Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
17819            Self::UnknownValue(u) => u.0.value(),
17820        }
17821    }
17822
17823    /// Gets the enum value as a string.
17824    ///
17825    /// Returns `None` if the enum contains an unknown value deserialized from
17826    /// the integer representation of enums.
17827    pub fn name(&self) -> std::option::Option<&str> {
17828        match self {
17829            Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
17830            Self::CustomerInitiatedSupport => {
17831                std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
17832            }
17833            Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
17834            Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
17835            Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
17836            Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
17837            Self::GoogleInitiatedSystemOperation => {
17838                std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
17839            }
17840            Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
17841            Self::ModifiedCustomerInitiatedAccess => {
17842                std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
17843            }
17844            Self::ModifiedGoogleInitiatedSystemOperation => {
17845                std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
17846            }
17847            Self::GoogleResponseToProductionAlert => {
17848                std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
17849            }
17850            Self::CustomerAuthorizedWorkflowServicing => {
17851                std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
17852            }
17853            Self::UnknownValue(u) => u.0.name(),
17854        }
17855    }
17856}
17857
17858impl std::default::Default for AccessReason {
17859    fn default() -> Self {
17860        use std::convert::From;
17861        Self::from(0)
17862    }
17863}
17864
17865impl std::fmt::Display for AccessReason {
17866    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17867        wkt::internal::display_enum(f, self.name(), self.value())
17868    }
17869}
17870
17871impl std::convert::From<i32> for AccessReason {
17872    fn from(value: i32) -> Self {
17873        match value {
17874            0 => Self::ReasonUnspecified,
17875            1 => Self::CustomerInitiatedSupport,
17876            2 => Self::GoogleInitiatedService,
17877            3 => Self::ThirdPartyDataRequest,
17878            4 => Self::GoogleInitiatedReview,
17879            5 => Self::CustomerInitiatedAccess,
17880            6 => Self::GoogleInitiatedSystemOperation,
17881            7 => Self::ReasonNotExpected,
17882            8 => Self::ModifiedCustomerInitiatedAccess,
17883            9 => Self::ModifiedGoogleInitiatedSystemOperation,
17884            10 => Self::GoogleResponseToProductionAlert,
17885            11 => Self::CustomerAuthorizedWorkflowServicing,
17886            _ => Self::UnknownValue(access_reason::UnknownValue(
17887                wkt::internal::UnknownEnumValue::Integer(value),
17888            )),
17889        }
17890    }
17891}
17892
17893impl std::convert::From<&str> for AccessReason {
17894    fn from(value: &str) -> Self {
17895        use std::string::ToString;
17896        match value {
17897            "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
17898            "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
17899            "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
17900            "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
17901            "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
17902            "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
17903            "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
17904            "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
17905            "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
17906            "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
17907                Self::ModifiedGoogleInitiatedSystemOperation
17908            }
17909            "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
17910            "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
17911            _ => Self::UnknownValue(access_reason::UnknownValue(
17912                wkt::internal::UnknownEnumValue::String(value.to_string()),
17913            )),
17914        }
17915    }
17916}
17917
17918impl serde::ser::Serialize for AccessReason {
17919    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17920    where
17921        S: serde::Serializer,
17922    {
17923        match self {
17924            Self::ReasonUnspecified => serializer.serialize_i32(0),
17925            Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
17926            Self::GoogleInitiatedService => serializer.serialize_i32(2),
17927            Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
17928            Self::GoogleInitiatedReview => serializer.serialize_i32(4),
17929            Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
17930            Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
17931            Self::ReasonNotExpected => serializer.serialize_i32(7),
17932            Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
17933            Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
17934            Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
17935            Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
17936            Self::UnknownValue(u) => u.0.serialize(serializer),
17937        }
17938    }
17939}
17940
17941impl<'de> serde::de::Deserialize<'de> for AccessReason {
17942    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17943    where
17944        D: serde::Deserializer<'de>,
17945    {
17946        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
17947            ".google.cloud.kms.v1.AccessReason",
17948        ))
17949    }
17950}