google_cloud_kms_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gax;
23extern crate gaxi;
24extern crate iam_v1;
25extern crate lazy_static;
26extern crate location;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request message for
42/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
43///
44/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct CreateKeyHandleRequest {
48    /// Required. Name of the resource project and location to create the
49    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
50    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
51    ///
52    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
53    pub parent: std::string::String,
54
55    /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
56    /// unique to the resource project and location. If not provided by the caller,
57    /// a new UUID is used.
58    ///
59    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
60    pub key_handle_id: std::string::String,
61
62    /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
63    ///
64    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
65    pub key_handle: std::option::Option<crate::model::KeyHandle>,
66
67    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
68}
69
70impl CreateKeyHandleRequest {
71    pub fn new() -> Self {
72        std::default::Default::default()
73    }
74
75    /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
76    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
77        self.parent = v.into();
78        self
79    }
80
81    /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
82    pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
83        self.key_handle_id = v.into();
84        self
85    }
86
87    /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
88    pub fn set_key_handle<T>(mut self, v: T) -> Self
89    where
90        T: std::convert::Into<crate::model::KeyHandle>,
91    {
92        self.key_handle = std::option::Option::Some(v.into());
93        self
94    }
95
96    /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
97    pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
98    where
99        T: std::convert::Into<crate::model::KeyHandle>,
100    {
101        self.key_handle = v.map(|x| x.into());
102        self
103    }
104}
105
106impl wkt::message::Message for CreateKeyHandleRequest {
107    fn typename() -> &'static str {
108        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
109    }
110}
111
112/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
113///
114/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
115#[derive(Clone, Default, PartialEq)]
116#[non_exhaustive]
117pub struct GetKeyHandleRequest {
118    /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
119    /// e.g.
120    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
121    ///
122    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
123    pub name: std::string::String,
124
125    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
126}
127
128impl GetKeyHandleRequest {
129    pub fn new() -> Self {
130        std::default::Default::default()
131    }
132
133    /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
134    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
135        self.name = v.into();
136        self
137    }
138}
139
140impl wkt::message::Message for GetKeyHandleRequest {
141    fn typename() -> &'static str {
142        "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
143    }
144}
145
146/// Resource-oriented representation of a request to Cloud KMS Autokey and the
147/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
148///
149/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
150#[derive(Clone, Default, PartialEq)]
151#[non_exhaustive]
152pub struct KeyHandle {
153    /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
154    /// resource, e.g.
155    /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
156    ///
157    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
158    pub name: std::string::String,
159
160    /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
161    /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
162    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
163    /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
164    /// project will reflect the value configured in the
165    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
166    /// project's ancestor folder at the time of the
167    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
168    /// ancestor folder has a configured
169    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
170    /// configurations is used.
171    ///
172    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
173    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
174    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
175    pub kms_key: std::string::String,
176
177    /// Required. Indicates the resource type that the resulting
178    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
179    /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
180    /// types.
181    ///
182    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
183    pub resource_type_selector: std::string::String,
184
185    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
186}
187
188impl KeyHandle {
189    pub fn new() -> Self {
190        std::default::Default::default()
191    }
192
193    /// Sets the value of [name][crate::model::KeyHandle::name].
194    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
195        self.name = v.into();
196        self
197    }
198
199    /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
200    pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
201        self.kms_key = v.into();
202        self
203    }
204
205    /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
206    pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
207        mut self,
208        v: T,
209    ) -> Self {
210        self.resource_type_selector = v.into();
211        self
212    }
213}
214
215impl wkt::message::Message for KeyHandle {
216    fn typename() -> &'static str {
217        "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
218    }
219}
220
221/// Metadata message for
222/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
223/// operation response.
224///
225/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
226#[derive(Clone, Default, PartialEq)]
227#[non_exhaustive]
228pub struct CreateKeyHandleMetadata {
229    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
230}
231
232impl CreateKeyHandleMetadata {
233    pub fn new() -> Self {
234        std::default::Default::default()
235    }
236}
237
238impl wkt::message::Message for CreateKeyHandleMetadata {
239    fn typename() -> &'static str {
240        "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
241    }
242}
243
244/// Request message for
245/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
246///
247/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
248#[derive(Clone, Default, PartialEq)]
249#[non_exhaustive]
250pub struct ListKeyHandlesRequest {
251    /// Required. Name of the resource project and location from which to list
252    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
253    /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
254    ///
255    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
256    pub parent: std::string::String,
257
258    /// Optional. Optional limit on the number of
259    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
260    /// service may return fewer than this value. Further
261    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
262    /// including the
263    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
264    /// in a subsequent request.  If unspecified, at most 100
265    /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
266    ///
267    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
268    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
269    pub page_size: i32,
270
271    /// Optional. Optional pagination token, returned earlier via
272    /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
273    ///
274    /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
275    pub page_token: std::string::String,
276
277    /// Optional. Filter to apply when listing
278    /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
279    /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
280    ///
281    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
282    pub filter: std::string::String,
283
284    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
285}
286
287impl ListKeyHandlesRequest {
288    pub fn new() -> Self {
289        std::default::Default::default()
290    }
291
292    /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
293    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
294        self.parent = v.into();
295        self
296    }
297
298    /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
299    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
300        self.page_size = v.into();
301        self
302    }
303
304    /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
305    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
306        self.page_token = v.into();
307        self
308    }
309
310    /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
311    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
312        self.filter = v.into();
313        self
314    }
315}
316
317impl wkt::message::Message for ListKeyHandlesRequest {
318    fn typename() -> &'static str {
319        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
320    }
321}
322
323/// Response message for
324/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
325///
326/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
327#[derive(Clone, Default, PartialEq)]
328#[non_exhaustive]
329pub struct ListKeyHandlesResponse {
330    /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
331    ///
332    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
333    pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
334
335    /// A token to retrieve next page of results. Pass this value in
336    /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
337    /// to retrieve the next page of results.
338    ///
339    /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
340    pub next_page_token: std::string::String,
341
342    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
343}
344
345impl ListKeyHandlesResponse {
346    pub fn new() -> Self {
347        std::default::Default::default()
348    }
349
350    /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
351    pub fn set_key_handles<T, V>(mut self, v: T) -> Self
352    where
353        T: std::iter::IntoIterator<Item = V>,
354        V: std::convert::Into<crate::model::KeyHandle>,
355    {
356        use std::iter::Iterator;
357        self.key_handles = v.into_iter().map(|i| i.into()).collect();
358        self
359    }
360
361    /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
362    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
363        self.next_page_token = v.into();
364        self
365    }
366}
367
368impl wkt::message::Message for ListKeyHandlesResponse {
369    fn typename() -> &'static str {
370        "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
371    }
372}
373
374#[doc(hidden)]
375impl gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
376    type PageItem = crate::model::KeyHandle;
377
378    fn items(self) -> std::vec::Vec<Self::PageItem> {
379        self.key_handles
380    }
381
382    fn next_page_token(&self) -> std::string::String {
383        use std::clone::Clone;
384        self.next_page_token.clone()
385    }
386}
387
388/// Request message for
389/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
390///
391/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
392#[derive(Clone, Default, PartialEq)]
393#[non_exhaustive]
394pub struct UpdateAutokeyConfigRequest {
395    /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
396    /// update.
397    ///
398    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
399    pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
400
401    /// Required. Masks which fields of the
402    /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
403    /// `keyProject`.
404    ///
405    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
406    pub update_mask: std::option::Option<wkt::FieldMask>,
407
408    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
409}
410
411impl UpdateAutokeyConfigRequest {
412    pub fn new() -> Self {
413        std::default::Default::default()
414    }
415
416    /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
417    pub fn set_autokey_config<T>(mut self, v: T) -> Self
418    where
419        T: std::convert::Into<crate::model::AutokeyConfig>,
420    {
421        self.autokey_config = std::option::Option::Some(v.into());
422        self
423    }
424
425    /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
426    pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
427    where
428        T: std::convert::Into<crate::model::AutokeyConfig>,
429    {
430        self.autokey_config = v.map(|x| x.into());
431        self
432    }
433
434    /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
435    pub fn set_update_mask<T>(mut self, v: T) -> Self
436    where
437        T: std::convert::Into<wkt::FieldMask>,
438    {
439        self.update_mask = std::option::Option::Some(v.into());
440        self
441    }
442
443    /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
444    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
445    where
446        T: std::convert::Into<wkt::FieldMask>,
447    {
448        self.update_mask = v.map(|x| x.into());
449        self
450    }
451}
452
453impl wkt::message::Message for UpdateAutokeyConfigRequest {
454    fn typename() -> &'static str {
455        "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
456    }
457}
458
459/// Request message for
460/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
461///
462/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
463#[derive(Clone, Default, PartialEq)]
464#[non_exhaustive]
465pub struct GetAutokeyConfigRequest {
466    /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
467    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
468    ///
469    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
470    pub name: std::string::String,
471
472    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
473}
474
475impl GetAutokeyConfigRequest {
476    pub fn new() -> Self {
477        std::default::Default::default()
478    }
479
480    /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
481    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
482        self.name = v.into();
483        self
484    }
485}
486
487impl wkt::message::Message for GetAutokeyConfigRequest {
488    fn typename() -> &'static str {
489        "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
490    }
491}
492
493/// Cloud KMS Autokey configuration for a folder.
494#[derive(Clone, Default, PartialEq)]
495#[non_exhaustive]
496pub struct AutokeyConfig {
497    /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
498    /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
499    ///
500    /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
501    pub name: std::string::String,
502
503    /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
504    /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
505    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
506    /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
507    /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
508    /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
509    /// this key project. Once configured, for Cloud KMS Autokey to function
510    /// properly, this key project must have the Cloud KMS API activated and the
511    /// Cloud KMS Service Agent for this key project must be granted the
512    /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
513    /// key project field will clear the configuration.
514    ///
515    /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
516    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
517    /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
518    pub key_project: std::string::String,
519
520    /// Output only. The state for the AutokeyConfig.
521    pub state: crate::model::autokey_config::State,
522
523    /// Optional. A checksum computed by the server based on the value of other
524    /// fields. This may be sent on update requests to ensure that the client has
525    /// an up-to-date value before proceeding. The request will be rejected with an
526    /// ABORTED error on a mismatched etag.
527    pub etag: std::string::String,
528
529    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
530}
531
532impl AutokeyConfig {
533    pub fn new() -> Self {
534        std::default::Default::default()
535    }
536
537    /// Sets the value of [name][crate::model::AutokeyConfig::name].
538    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
539        self.name = v.into();
540        self
541    }
542
543    /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
544    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
545        self.key_project = v.into();
546        self
547    }
548
549    /// Sets the value of [state][crate::model::AutokeyConfig::state].
550    pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
551        mut self,
552        v: T,
553    ) -> Self {
554        self.state = v.into();
555        self
556    }
557
558    /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
559    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
560        self.etag = v.into();
561        self
562    }
563}
564
565impl wkt::message::Message for AutokeyConfig {
566    fn typename() -> &'static str {
567        "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
568    }
569}
570
571/// Defines additional types related to [AutokeyConfig].
572pub mod autokey_config {
573    #[allow(unused_imports)]
574    use super::*;
575
576    /// The states AutokeyConfig can be in.
577    ///
578    /// # Working with unknown values
579    ///
580    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
581    /// additional enum variants at any time. Adding new variants is not considered
582    /// a breaking change. Applications should write their code in anticipation of:
583    ///
584    /// - New values appearing in future releases of the client library, **and**
585    /// - New values received dynamically, without application changes.
586    ///
587    /// Please consult the [Working with enums] section in the user guide for some
588    /// guidelines.
589    ///
590    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
591    #[derive(Clone, Debug, PartialEq)]
592    #[non_exhaustive]
593    pub enum State {
594        /// The state of the AutokeyConfig is unspecified.
595        Unspecified,
596        /// The AutokeyConfig is currently active.
597        Active,
598        /// A previously configured key project has been deleted and the current
599        /// AutokeyConfig is unusable.
600        KeyProjectDeleted,
601        /// The AutokeyConfig is not yet initialized or has been reset to its default
602        /// uninitialized state.
603        Uninitialized,
604        /// If set, the enum was initialized with an unknown value.
605        ///
606        /// Applications can examine the value using [State::value] or
607        /// [State::name].
608        UnknownValue(state::UnknownValue),
609    }
610
611    #[doc(hidden)]
612    pub mod state {
613        #[allow(unused_imports)]
614        use super::*;
615        #[derive(Clone, Debug, PartialEq)]
616        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
617    }
618
619    impl State {
620        /// Gets the enum value.
621        ///
622        /// Returns `None` if the enum contains an unknown value deserialized from
623        /// the string representation of enums.
624        pub fn value(&self) -> std::option::Option<i32> {
625            match self {
626                Self::Unspecified => std::option::Option::Some(0),
627                Self::Active => std::option::Option::Some(1),
628                Self::KeyProjectDeleted => std::option::Option::Some(2),
629                Self::Uninitialized => std::option::Option::Some(3),
630                Self::UnknownValue(u) => u.0.value(),
631            }
632        }
633
634        /// Gets the enum value as a string.
635        ///
636        /// Returns `None` if the enum contains an unknown value deserialized from
637        /// the integer representation of enums.
638        pub fn name(&self) -> std::option::Option<&str> {
639            match self {
640                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
641                Self::Active => std::option::Option::Some("ACTIVE"),
642                Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
643                Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
644                Self::UnknownValue(u) => u.0.name(),
645            }
646        }
647    }
648
649    impl std::default::Default for State {
650        fn default() -> Self {
651            use std::convert::From;
652            Self::from(0)
653        }
654    }
655
656    impl std::fmt::Display for State {
657        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
658            wkt::internal::display_enum(f, self.name(), self.value())
659        }
660    }
661
662    impl std::convert::From<i32> for State {
663        fn from(value: i32) -> Self {
664            match value {
665                0 => Self::Unspecified,
666                1 => Self::Active,
667                2 => Self::KeyProjectDeleted,
668                3 => Self::Uninitialized,
669                _ => Self::UnknownValue(state::UnknownValue(
670                    wkt::internal::UnknownEnumValue::Integer(value),
671                )),
672            }
673        }
674    }
675
676    impl std::convert::From<&str> for State {
677        fn from(value: &str) -> Self {
678            use std::string::ToString;
679            match value {
680                "STATE_UNSPECIFIED" => Self::Unspecified,
681                "ACTIVE" => Self::Active,
682                "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
683                "UNINITIALIZED" => Self::Uninitialized,
684                _ => Self::UnknownValue(state::UnknownValue(
685                    wkt::internal::UnknownEnumValue::String(value.to_string()),
686                )),
687            }
688        }
689    }
690
691    impl serde::ser::Serialize for State {
692        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
693        where
694            S: serde::Serializer,
695        {
696            match self {
697                Self::Unspecified => serializer.serialize_i32(0),
698                Self::Active => serializer.serialize_i32(1),
699                Self::KeyProjectDeleted => serializer.serialize_i32(2),
700                Self::Uninitialized => serializer.serialize_i32(3),
701                Self::UnknownValue(u) => u.0.serialize(serializer),
702            }
703        }
704    }
705
706    impl<'de> serde::de::Deserialize<'de> for State {
707        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
708        where
709            D: serde::Deserializer<'de>,
710        {
711            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
712                ".google.cloud.kms.v1.AutokeyConfig.State",
713            ))
714        }
715    }
716}
717
718/// Request message for
719/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
720///
721/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
722#[derive(Clone, Default, PartialEq)]
723#[non_exhaustive]
724pub struct ShowEffectiveAutokeyConfigRequest {
725    /// Required. Name of the resource project to the show effective Cloud KMS
726    /// Autokey configuration for. This may be helpful for interrogating the effect
727    /// of nested folder configurations on a given resource project.
728    pub parent: std::string::String,
729
730    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
731}
732
733impl ShowEffectiveAutokeyConfigRequest {
734    pub fn new() -> Self {
735        std::default::Default::default()
736    }
737
738    /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
739    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
740        self.parent = v.into();
741        self
742    }
743}
744
745impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
746    fn typename() -> &'static str {
747        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
748    }
749}
750
751/// Response message for
752/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
753///
754/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
755#[derive(Clone, Default, PartialEq)]
756#[non_exhaustive]
757pub struct ShowEffectiveAutokeyConfigResponse {
758    /// Name of the key project configured in the resource project's folder
759    /// ancestry.
760    pub key_project: std::string::String,
761
762    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
763}
764
765impl ShowEffectiveAutokeyConfigResponse {
766    pub fn new() -> Self {
767        std::default::Default::default()
768    }
769
770    /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
771    pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
772        self.key_project = v.into();
773        self
774    }
775}
776
777impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
778    fn typename() -> &'static str {
779        "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
780    }
781}
782
783/// Request message for
784/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
785///
786/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
787#[derive(Clone, Default, PartialEq)]
788#[non_exhaustive]
789pub struct ListEkmConnectionsRequest {
790    /// Required. The resource name of the location associated with the
791    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
792    /// `projects/*/locations/*`.
793    ///
794    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
795    pub parent: std::string::String,
796
797    /// Optional. Optional limit on the number of
798    /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
799    /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
800    /// subsequently be obtained by including the
801    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
802    /// in a subsequent request. If unspecified, the server will pick an
803    /// appropriate default.
804    ///
805    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
806    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
807    pub page_size: i32,
808
809    /// Optional. Optional pagination token, returned earlier via
810    /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
811    ///
812    /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
813    pub page_token: std::string::String,
814
815    /// Optional. Only include resources that match the filter in the response. For
816    /// more information, see
817    /// [Sorting and filtering list
818    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
819    pub filter: std::string::String,
820
821    /// Optional. Specify how the results should be sorted. If not specified, the
822    /// results will be sorted in the default order.  For more information, see
823    /// [Sorting and filtering list
824    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
825    pub order_by: std::string::String,
826
827    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
828}
829
830impl ListEkmConnectionsRequest {
831    pub fn new() -> Self {
832        std::default::Default::default()
833    }
834
835    /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
836    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
837        self.parent = v.into();
838        self
839    }
840
841    /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
842    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
843        self.page_size = v.into();
844        self
845    }
846
847    /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
848    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
849        self.page_token = v.into();
850        self
851    }
852
853    /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
854    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
855        self.filter = v.into();
856        self
857    }
858
859    /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
860    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
861        self.order_by = v.into();
862        self
863    }
864}
865
866impl wkt::message::Message for ListEkmConnectionsRequest {
867    fn typename() -> &'static str {
868        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
869    }
870}
871
872/// Response message for
873/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
874///
875/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
876#[derive(Clone, Default, PartialEq)]
877#[non_exhaustive]
878pub struct ListEkmConnectionsResponse {
879    /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
880    ///
881    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
882    pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
883
884    /// A token to retrieve next page of results. Pass this value in
885    /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
886    /// to retrieve the next page of results.
887    ///
888    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
889    pub next_page_token: std::string::String,
890
891    /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
892    /// that matched the query.
893    ///
894    /// This field is not populated if
895    /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
896    /// is applied.
897    ///
898    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
899    /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
900    pub total_size: i32,
901
902    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
903}
904
905impl ListEkmConnectionsResponse {
906    pub fn new() -> Self {
907        std::default::Default::default()
908    }
909
910    /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
911    pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
912    where
913        T: std::iter::IntoIterator<Item = V>,
914        V: std::convert::Into<crate::model::EkmConnection>,
915    {
916        use std::iter::Iterator;
917        self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
918        self
919    }
920
921    /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
922    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
923        self.next_page_token = v.into();
924        self
925    }
926
927    /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
928    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
929        self.total_size = v.into();
930        self
931    }
932}
933
934impl wkt::message::Message for ListEkmConnectionsResponse {
935    fn typename() -> &'static str {
936        "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
937    }
938}
939
940#[doc(hidden)]
941impl gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
942    type PageItem = crate::model::EkmConnection;
943
944    fn items(self) -> std::vec::Vec<Self::PageItem> {
945        self.ekm_connections
946    }
947
948    fn next_page_token(&self) -> std::string::String {
949        use std::clone::Clone;
950        self.next_page_token.clone()
951    }
952}
953
954/// Request message for
955/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
956///
957/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
958#[derive(Clone, Default, PartialEq)]
959#[non_exhaustive]
960pub struct GetEkmConnectionRequest {
961    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
962    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
963    ///
964    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
965    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
966    pub name: std::string::String,
967
968    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
969}
970
971impl GetEkmConnectionRequest {
972    pub fn new() -> Self {
973        std::default::Default::default()
974    }
975
976    /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
977    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
978        self.name = v.into();
979        self
980    }
981}
982
983impl wkt::message::Message for GetEkmConnectionRequest {
984    fn typename() -> &'static str {
985        "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
986    }
987}
988
989/// Request message for
990/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
991///
992/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
993#[derive(Clone, Default, PartialEq)]
994#[non_exhaustive]
995pub struct CreateEkmConnectionRequest {
996    /// Required. The resource name of the location associated with the
997    /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
998    /// `projects/*/locations/*`.
999    ///
1000    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1001    pub parent: std::string::String,
1002
1003    /// Required. It must be unique within a location and match the regular
1004    /// expression `[a-zA-Z0-9_-]{1,63}`.
1005    pub ekm_connection_id: std::string::String,
1006
1007    /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1008    /// initial field values.
1009    ///
1010    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1011    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1012
1013    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1014}
1015
1016impl CreateEkmConnectionRequest {
1017    pub fn new() -> Self {
1018        std::default::Default::default()
1019    }
1020
1021    /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1022    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1023        self.parent = v.into();
1024        self
1025    }
1026
1027    /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1028    pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1029        mut self,
1030        v: T,
1031    ) -> Self {
1032        self.ekm_connection_id = v.into();
1033        self
1034    }
1035
1036    /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1037    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1038    where
1039        T: std::convert::Into<crate::model::EkmConnection>,
1040    {
1041        self.ekm_connection = std::option::Option::Some(v.into());
1042        self
1043    }
1044
1045    /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1046    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1047    where
1048        T: std::convert::Into<crate::model::EkmConnection>,
1049    {
1050        self.ekm_connection = v.map(|x| x.into());
1051        self
1052    }
1053}
1054
1055impl wkt::message::Message for CreateEkmConnectionRequest {
1056    fn typename() -> &'static str {
1057        "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1058    }
1059}
1060
1061/// Request message for
1062/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1063///
1064/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1065#[derive(Clone, Default, PartialEq)]
1066#[non_exhaustive]
1067pub struct UpdateEkmConnectionRequest {
1068    /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1069    /// values.
1070    ///
1071    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1072    pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1073
1074    /// Required. List of fields to be updated in this request.
1075    pub update_mask: std::option::Option<wkt::FieldMask>,
1076
1077    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1078}
1079
1080impl UpdateEkmConnectionRequest {
1081    pub fn new() -> Self {
1082        std::default::Default::default()
1083    }
1084
1085    /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1086    pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1087    where
1088        T: std::convert::Into<crate::model::EkmConnection>,
1089    {
1090        self.ekm_connection = std::option::Option::Some(v.into());
1091        self
1092    }
1093
1094    /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1095    pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1096    where
1097        T: std::convert::Into<crate::model::EkmConnection>,
1098    {
1099        self.ekm_connection = v.map(|x| x.into());
1100        self
1101    }
1102
1103    /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1104    pub fn set_update_mask<T>(mut self, v: T) -> Self
1105    where
1106        T: std::convert::Into<wkt::FieldMask>,
1107    {
1108        self.update_mask = std::option::Option::Some(v.into());
1109        self
1110    }
1111
1112    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1113    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1114    where
1115        T: std::convert::Into<wkt::FieldMask>,
1116    {
1117        self.update_mask = v.map(|x| x.into());
1118        self
1119    }
1120}
1121
1122impl wkt::message::Message for UpdateEkmConnectionRequest {
1123    fn typename() -> &'static str {
1124        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1125    }
1126}
1127
1128/// Request message for
1129/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1130///
1131/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1132#[derive(Clone, Default, PartialEq)]
1133#[non_exhaustive]
1134pub struct GetEkmConfigRequest {
1135    /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1136    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1137    ///
1138    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1139    /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1140    pub name: std::string::String,
1141
1142    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1143}
1144
1145impl GetEkmConfigRequest {
1146    pub fn new() -> Self {
1147        std::default::Default::default()
1148    }
1149
1150    /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1151    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1152        self.name = v.into();
1153        self
1154    }
1155}
1156
1157impl wkt::message::Message for GetEkmConfigRequest {
1158    fn typename() -> &'static str {
1159        "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1160    }
1161}
1162
1163/// Request message for
1164/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1165///
1166/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1167#[derive(Clone, Default, PartialEq)]
1168#[non_exhaustive]
1169pub struct UpdateEkmConfigRequest {
1170    /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1171    ///
1172    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1173    pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1174
1175    /// Required. List of fields to be updated in this request.
1176    pub update_mask: std::option::Option<wkt::FieldMask>,
1177
1178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1179}
1180
1181impl UpdateEkmConfigRequest {
1182    pub fn new() -> Self {
1183        std::default::Default::default()
1184    }
1185
1186    /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1187    pub fn set_ekm_config<T>(mut self, v: T) -> Self
1188    where
1189        T: std::convert::Into<crate::model::EkmConfig>,
1190    {
1191        self.ekm_config = std::option::Option::Some(v.into());
1192        self
1193    }
1194
1195    /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1196    pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1197    where
1198        T: std::convert::Into<crate::model::EkmConfig>,
1199    {
1200        self.ekm_config = v.map(|x| x.into());
1201        self
1202    }
1203
1204    /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1205    pub fn set_update_mask<T>(mut self, v: T) -> Self
1206    where
1207        T: std::convert::Into<wkt::FieldMask>,
1208    {
1209        self.update_mask = std::option::Option::Some(v.into());
1210        self
1211    }
1212
1213    /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1214    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1215    where
1216        T: std::convert::Into<wkt::FieldMask>,
1217    {
1218        self.update_mask = v.map(|x| x.into());
1219        self
1220    }
1221}
1222
1223impl wkt::message::Message for UpdateEkmConfigRequest {
1224    fn typename() -> &'static str {
1225        "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1226    }
1227}
1228
1229/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1230/// certificate used to authenticate HTTPS connections to EKM replicas.
1231///
1232/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1233#[derive(Clone, Default, PartialEq)]
1234#[non_exhaustive]
1235pub struct Certificate {
1236    /// Required. The raw certificate bytes in DER format.
1237    pub raw_der: ::bytes::Bytes,
1238
1239    /// Output only. True if the certificate was parsed successfully.
1240    pub parsed: bool,
1241
1242    /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1243    /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1244    ///
1245    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1246    pub issuer: std::string::String,
1247
1248    /// Output only. The subject distinguished name in RFC 2253 format. Only
1249    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1250    ///
1251    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1252    pub subject: std::string::String,
1253
1254    /// Output only. The subject Alternative DNS names. Only present if
1255    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1256    ///
1257    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1258    pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1259
1260    /// Output only. The certificate is not valid before this time. Only present if
1261    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1262    ///
1263    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1264    pub not_before_time: std::option::Option<wkt::Timestamp>,
1265
1266    /// Output only. The certificate is not valid after this time. Only present if
1267    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1268    ///
1269    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1270    pub not_after_time: std::option::Option<wkt::Timestamp>,
1271
1272    /// Output only. The certificate serial number as a hex string. Only present if
1273    /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1274    ///
1275    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1276    pub serial_number: std::string::String,
1277
1278    /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1279    /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1280    ///
1281    /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1282    pub sha256_fingerprint: std::string::String,
1283
1284    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1285}
1286
1287impl Certificate {
1288    pub fn new() -> Self {
1289        std::default::Default::default()
1290    }
1291
1292    /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1293    pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1294        self.raw_der = v.into();
1295        self
1296    }
1297
1298    /// Sets the value of [parsed][crate::model::Certificate::parsed].
1299    pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1300        self.parsed = v.into();
1301        self
1302    }
1303
1304    /// Sets the value of [issuer][crate::model::Certificate::issuer].
1305    pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1306        self.issuer = v.into();
1307        self
1308    }
1309
1310    /// Sets the value of [subject][crate::model::Certificate::subject].
1311    pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1312        self.subject = v.into();
1313        self
1314    }
1315
1316    /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1317    pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1318    where
1319        T: std::iter::IntoIterator<Item = V>,
1320        V: std::convert::Into<std::string::String>,
1321    {
1322        use std::iter::Iterator;
1323        self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1324        self
1325    }
1326
1327    /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1328    pub fn set_not_before_time<T>(mut self, v: T) -> Self
1329    where
1330        T: std::convert::Into<wkt::Timestamp>,
1331    {
1332        self.not_before_time = std::option::Option::Some(v.into());
1333        self
1334    }
1335
1336    /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1337    pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1338    where
1339        T: std::convert::Into<wkt::Timestamp>,
1340    {
1341        self.not_before_time = v.map(|x| x.into());
1342        self
1343    }
1344
1345    /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1346    pub fn set_not_after_time<T>(mut self, v: T) -> Self
1347    where
1348        T: std::convert::Into<wkt::Timestamp>,
1349    {
1350        self.not_after_time = std::option::Option::Some(v.into());
1351        self
1352    }
1353
1354    /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1355    pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1356    where
1357        T: std::convert::Into<wkt::Timestamp>,
1358    {
1359        self.not_after_time = v.map(|x| x.into());
1360        self
1361    }
1362
1363    /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1364    pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1365        self.serial_number = v.into();
1366        self
1367    }
1368
1369    /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1370    pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1371        mut self,
1372        v: T,
1373    ) -> Self {
1374        self.sha256_fingerprint = v.into();
1375        self
1376    }
1377}
1378
1379impl wkt::message::Message for Certificate {
1380    fn typename() -> &'static str {
1381        "type.googleapis.com/google.cloud.kms.v1.Certificate"
1382    }
1383}
1384
1385/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
1386/// individual EKM connection. It can be used for creating
1387/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
1388/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
1389/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
1390/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
1391/// performing cryptographic operations using keys created within the
1392/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1393///
1394/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1395/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1396/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1397/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
1398/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
1399#[derive(Clone, Default, PartialEq)]
1400#[non_exhaustive]
1401pub struct EkmConnection {
1402    /// Output only. The resource name for the
1403    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
1404    /// `projects/*/locations/*/ekmConnections/*`.
1405    ///
1406    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1407    pub name: std::string::String,
1408
1409    /// Output only. The time at which the
1410    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
1411    ///
1412    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1413    pub create_time: std::option::Option<wkt::Timestamp>,
1414
1415    /// Optional. A list of
1416    /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
1417    /// the EKM can be reached. There should be one ServiceResolver per EKM
1418    /// replica. Currently, only a single
1419    /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
1420    /// supported.
1421    ///
1422    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
1423    pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
1424
1425    /// Optional. Etag of the currently stored
1426    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1427    ///
1428    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1429    pub etag: std::string::String,
1430
1431    /// Optional. Describes who can perform control plane operations on the EKM. If
1432    /// unset, this defaults to
1433    /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
1434    ///
1435    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
1436    pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
1437
1438    /// Optional. Identifies the EKM Crypto Space that this
1439    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
1440    /// field is required if
1441    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
1442    /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
1443    ///
1444    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1445    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
1446    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
1447    pub crypto_space_path: std::string::String,
1448
1449    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1450}
1451
1452impl EkmConnection {
1453    pub fn new() -> Self {
1454        std::default::Default::default()
1455    }
1456
1457    /// Sets the value of [name][crate::model::EkmConnection::name].
1458    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1459        self.name = v.into();
1460        self
1461    }
1462
1463    /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
1464    pub fn set_create_time<T>(mut self, v: T) -> Self
1465    where
1466        T: std::convert::Into<wkt::Timestamp>,
1467    {
1468        self.create_time = std::option::Option::Some(v.into());
1469        self
1470    }
1471
1472    /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
1473    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1474    where
1475        T: std::convert::Into<wkt::Timestamp>,
1476    {
1477        self.create_time = v.map(|x| x.into());
1478        self
1479    }
1480
1481    /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
1482    pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
1483    where
1484        T: std::iter::IntoIterator<Item = V>,
1485        V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
1486    {
1487        use std::iter::Iterator;
1488        self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
1489        self
1490    }
1491
1492    /// Sets the value of [etag][crate::model::EkmConnection::etag].
1493    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1494        self.etag = v.into();
1495        self
1496    }
1497
1498    /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
1499    pub fn set_key_management_mode<
1500        T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
1501    >(
1502        mut self,
1503        v: T,
1504    ) -> Self {
1505        self.key_management_mode = v.into();
1506        self
1507    }
1508
1509    /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
1510    pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
1511        mut self,
1512        v: T,
1513    ) -> Self {
1514        self.crypto_space_path = v.into();
1515        self
1516    }
1517}
1518
1519impl wkt::message::Message for EkmConnection {
1520    fn typename() -> &'static str {
1521        "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
1522    }
1523}
1524
1525/// Defines additional types related to [EkmConnection].
1526pub mod ekm_connection {
1527    #[allow(unused_imports)]
1528    use super::*;
1529
1530    /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
1531    /// represents an EKM replica that can be reached within an
1532    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1533    ///
1534    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1535    /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
1536    #[derive(Clone, Default, PartialEq)]
1537    #[non_exhaustive]
1538    pub struct ServiceResolver {
1539        /// Required. The resource name of the Service Directory service pointing to
1540        /// an EKM replica, in the format
1541        /// `projects/*/locations/*/namespaces/*/services/*`.
1542        pub service_directory_service: std::string::String,
1543
1544        /// Optional. The filter applied to the endpoints of the resolved service. If
1545        /// no filter is specified, all endpoints will be considered. An endpoint
1546        /// will be chosen arbitrarily from the filtered list for each request.
1547        ///
1548        /// For endpoint filter syntax and examples, see
1549        /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
1550        pub endpoint_filter: std::string::String,
1551
1552        /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
1553        pub hostname: std::string::String,
1554
1555        /// Required. A list of leaf server certificates used to authenticate HTTPS
1556        /// connections to the EKM replica. Currently, a maximum of 10
1557        /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
1558        ///
1559        /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1560        pub server_certificates: std::vec::Vec<crate::model::Certificate>,
1561
1562        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1563    }
1564
1565    impl ServiceResolver {
1566        pub fn new() -> Self {
1567            std::default::Default::default()
1568        }
1569
1570        /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
1571        pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
1572            mut self,
1573            v: T,
1574        ) -> Self {
1575            self.service_directory_service = v.into();
1576            self
1577        }
1578
1579        /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
1580        pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
1581            mut self,
1582            v: T,
1583        ) -> Self {
1584            self.endpoint_filter = v.into();
1585            self
1586        }
1587
1588        /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
1589        pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1590            self.hostname = v.into();
1591            self
1592        }
1593
1594        /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
1595        pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
1596        where
1597            T: std::iter::IntoIterator<Item = V>,
1598            V: std::convert::Into<crate::model::Certificate>,
1599        {
1600            use std::iter::Iterator;
1601            self.server_certificates = v.into_iter().map(|i| i.into()).collect();
1602            self
1603        }
1604    }
1605
1606    impl wkt::message::Message for ServiceResolver {
1607        fn typename() -> &'static str {
1608            "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
1609        }
1610    }
1611
1612    /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
1613    /// describes who can perform control plane cryptographic operations using this
1614    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1615    ///
1616    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1617    /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
1618    ///
1619    /// # Working with unknown values
1620    ///
1621    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1622    /// additional enum variants at any time. Adding new variants is not considered
1623    /// a breaking change. Applications should write their code in anticipation of:
1624    ///
1625    /// - New values appearing in future releases of the client library, **and**
1626    /// - New values received dynamically, without application changes.
1627    ///
1628    /// Please consult the [Working with enums] section in the user guide for some
1629    /// guidelines.
1630    ///
1631    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1632    #[derive(Clone, Debug, PartialEq)]
1633    #[non_exhaustive]
1634    pub enum KeyManagementMode {
1635        /// Not specified.
1636        Unspecified,
1637        /// EKM-side key management operations on
1638        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
1639        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
1640        /// the EKM directly and cannot be performed from Cloud KMS. This means that:
1641        ///
1642        /// * When creating a
1643        ///   [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
1644        ///   this
1645        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
1646        ///   supply the key path of pre-existing external key material that will be
1647        ///   linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
1648        /// * Destruction of external key material cannot be requested via the
1649        ///   Cloud KMS API and must be performed directly in the EKM.
1650        /// * Automatic rotation of key material is not supported.
1651        ///
1652        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1653        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1654        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1655        Manual,
1656        /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
1657        /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
1658        /// management operations initiated from Cloud KMS. This means that:
1659        ///
1660        /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
1661        ///   associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
1662        ///   is
1663        ///   created, the EKM automatically generates new key material and a new
1664        ///   key path. The caller cannot supply the key path of pre-existing
1665        ///   external key material.
1666        /// * Destruction of external key material associated with this
1667        ///   [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
1668        ///   calling
1669        ///   [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
1670        /// * Automatic rotation of key material is supported.
1671        ///
1672        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1673        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1674        /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1675        /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
1676        CloudKms,
1677        /// If set, the enum was initialized with an unknown value.
1678        ///
1679        /// Applications can examine the value using [KeyManagementMode::value] or
1680        /// [KeyManagementMode::name].
1681        UnknownValue(key_management_mode::UnknownValue),
1682    }
1683
1684    #[doc(hidden)]
1685    pub mod key_management_mode {
1686        #[allow(unused_imports)]
1687        use super::*;
1688        #[derive(Clone, Debug, PartialEq)]
1689        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1690    }
1691
1692    impl KeyManagementMode {
1693        /// Gets the enum value.
1694        ///
1695        /// Returns `None` if the enum contains an unknown value deserialized from
1696        /// the string representation of enums.
1697        pub fn value(&self) -> std::option::Option<i32> {
1698            match self {
1699                Self::Unspecified => std::option::Option::Some(0),
1700                Self::Manual => std::option::Option::Some(1),
1701                Self::CloudKms => std::option::Option::Some(2),
1702                Self::UnknownValue(u) => u.0.value(),
1703            }
1704        }
1705
1706        /// Gets the enum value as a string.
1707        ///
1708        /// Returns `None` if the enum contains an unknown value deserialized from
1709        /// the integer representation of enums.
1710        pub fn name(&self) -> std::option::Option<&str> {
1711            match self {
1712                Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
1713                Self::Manual => std::option::Option::Some("MANUAL"),
1714                Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
1715                Self::UnknownValue(u) => u.0.name(),
1716            }
1717        }
1718    }
1719
1720    impl std::default::Default for KeyManagementMode {
1721        fn default() -> Self {
1722            use std::convert::From;
1723            Self::from(0)
1724        }
1725    }
1726
1727    impl std::fmt::Display for KeyManagementMode {
1728        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1729            wkt::internal::display_enum(f, self.name(), self.value())
1730        }
1731    }
1732
1733    impl std::convert::From<i32> for KeyManagementMode {
1734        fn from(value: i32) -> Self {
1735            match value {
1736                0 => Self::Unspecified,
1737                1 => Self::Manual,
1738                2 => Self::CloudKms,
1739                _ => Self::UnknownValue(key_management_mode::UnknownValue(
1740                    wkt::internal::UnknownEnumValue::Integer(value),
1741                )),
1742            }
1743        }
1744    }
1745
1746    impl std::convert::From<&str> for KeyManagementMode {
1747        fn from(value: &str) -> Self {
1748            use std::string::ToString;
1749            match value {
1750                "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
1751                "MANUAL" => Self::Manual,
1752                "CLOUD_KMS" => Self::CloudKms,
1753                _ => Self::UnknownValue(key_management_mode::UnknownValue(
1754                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1755                )),
1756            }
1757        }
1758    }
1759
1760    impl serde::ser::Serialize for KeyManagementMode {
1761        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1762        where
1763            S: serde::Serializer,
1764        {
1765            match self {
1766                Self::Unspecified => serializer.serialize_i32(0),
1767                Self::Manual => serializer.serialize_i32(1),
1768                Self::CloudKms => serializer.serialize_i32(2),
1769                Self::UnknownValue(u) => u.0.serialize(serializer),
1770            }
1771        }
1772    }
1773
1774    impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
1775        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1776        where
1777            D: serde::Deserializer<'de>,
1778        {
1779            deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
1780                ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
1781            ))
1782        }
1783    }
1784}
1785
1786/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
1787/// represents configuration parameters that apply to all
1788/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
1789/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
1790/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
1791/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
1792/// project and location.
1793///
1794/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1795/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1796/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1797/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
1798/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
1799#[derive(Clone, Default, PartialEq)]
1800#[non_exhaustive]
1801pub struct EkmConfig {
1802    /// Output only. The resource name for the
1803    /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
1804    /// `projects/*/locations/*/ekmConfig`.
1805    ///
1806    /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1807    pub name: std::string::String,
1808
1809    /// Optional. Resource name of the default
1810    /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
1811    /// the empty string removes the default.
1812    ///
1813    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1814    pub default_ekm_connection: std::string::String,
1815
1816    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1817}
1818
1819impl EkmConfig {
1820    pub fn new() -> Self {
1821        std::default::Default::default()
1822    }
1823
1824    /// Sets the value of [name][crate::model::EkmConfig::name].
1825    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1826        self.name = v.into();
1827        self
1828    }
1829
1830    /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
1831    pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
1832        mut self,
1833        v: T,
1834    ) -> Self {
1835        self.default_ekm_connection = v.into();
1836        self
1837    }
1838}
1839
1840impl wkt::message::Message for EkmConfig {
1841    fn typename() -> &'static str {
1842        "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
1843    }
1844}
1845
1846/// Request message for
1847/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
1848///
1849/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
1850#[derive(Clone, Default, PartialEq)]
1851#[non_exhaustive]
1852pub struct VerifyConnectivityRequest {
1853    /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1854    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
1855    ///
1856    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1857    /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1858    pub name: std::string::String,
1859
1860    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1861}
1862
1863impl VerifyConnectivityRequest {
1864    pub fn new() -> Self {
1865        std::default::Default::default()
1866    }
1867
1868    /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
1869    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1870        self.name = v.into();
1871        self
1872    }
1873}
1874
1875impl wkt::message::Message for VerifyConnectivityRequest {
1876    fn typename() -> &'static str {
1877        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
1878    }
1879}
1880
1881/// Response message for
1882/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
1883///
1884/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
1885#[derive(Clone, Default, PartialEq)]
1886#[non_exhaustive]
1887pub struct VerifyConnectivityResponse {
1888    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1889}
1890
1891impl VerifyConnectivityResponse {
1892    pub fn new() -> Self {
1893        std::default::Default::default()
1894    }
1895}
1896
1897impl wkt::message::Message for VerifyConnectivityResponse {
1898    fn typename() -> &'static str {
1899        "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
1900    }
1901}
1902
1903/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
1904/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
1905///
1906/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1907/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
1908#[derive(Clone, Default, PartialEq)]
1909#[non_exhaustive]
1910pub struct KeyRing {
1911    /// Output only. The resource name for the
1912    /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
1913    /// `projects/*/locations/*/keyRings/*`.
1914    ///
1915    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
1916    pub name: std::string::String,
1917
1918    /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
1919    /// was created.
1920    ///
1921    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
1922    pub create_time: std::option::Option<wkt::Timestamp>,
1923
1924    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1925}
1926
1927impl KeyRing {
1928    pub fn new() -> Self {
1929        std::default::Default::default()
1930    }
1931
1932    /// Sets the value of [name][crate::model::KeyRing::name].
1933    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1934        self.name = v.into();
1935        self
1936    }
1937
1938    /// Sets the value of [create_time][crate::model::KeyRing::create_time].
1939    pub fn set_create_time<T>(mut self, v: T) -> Self
1940    where
1941        T: std::convert::Into<wkt::Timestamp>,
1942    {
1943        self.create_time = std::option::Option::Some(v.into());
1944        self
1945    }
1946
1947    /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
1948    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1949    where
1950        T: std::convert::Into<wkt::Timestamp>,
1951    {
1952        self.create_time = v.map(|x| x.into());
1953        self
1954    }
1955}
1956
1957impl wkt::message::Message for KeyRing {
1958    fn typename() -> &'static str {
1959        "type.googleapis.com/google.cloud.kms.v1.KeyRing"
1960    }
1961}
1962
1963/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
1964/// can be used for cryptographic operations.
1965///
1966/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
1967/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
1968/// key material used in cryptographic operations.
1969///
1970/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1971/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1972#[derive(Clone, Default, PartialEq)]
1973#[non_exhaustive]
1974pub struct CryptoKey {
1975    /// Output only. The resource name for this
1976    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
1977    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
1978    ///
1979    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1980    pub name: std::string::String,
1981
1982    /// Output only. A copy of the "primary"
1983    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
1984    /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
1985    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
1986    /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
1987    ///
1988    /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
1989    /// updated via
1990    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
1991    ///
1992    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
1993    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
1994    /// may have a primary. For other keys, this field will be omitted.
1995    ///
1996    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1997    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
1998    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
1999    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2000    /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
2001    /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
2002    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
2003    pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
2004
2005    /// Immutable. The immutable purpose of this
2006    /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
2007    ///
2008    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2009    pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
2010
2011    /// Output only. The time at which this
2012    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
2013    ///
2014    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2015    pub create_time: std::option::Option<wkt::Timestamp>,
2016
2017    /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
2018    /// the Key Management Service will automatically:
2019    ///
2020    /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
2021    /// 1. Mark the new version as primary.
2022    ///
2023    /// Key rotations performed manually via
2024    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
2025    /// and
2026    /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
2027    /// do not affect
2028    /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
2029    ///
2030    /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
2031    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
2032    /// support automatic rotation. For other keys, this field must be omitted.
2033    ///
2034    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2035    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
2036    /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
2037    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
2038    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
2039    /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
2040    pub next_rotation_time: std::option::Option<wkt::Timestamp>,
2041
2042    /// A template describing settings for new
2043    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
2044    /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2045    /// instances created by either
2046    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
2047    /// or auto-rotation are controlled by this template.
2048    ///
2049    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2050    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
2051    pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
2052
2053    /// Labels with user-defined metadata. For more information, see
2054    /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
2055    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2056
2057    /// Immutable. Whether this key may contain imported versions only.
2058    pub import_only: bool,
2059
2060    /// Immutable. The period of time that versions of this key spend in the
2061    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
2062    /// state before transitioning to
2063    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
2064    /// If not specified at creation time, the default duration is 30 days.
2065    ///
2066    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
2067    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
2068    pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
2069
2070    /// Immutable. The resource name of the backend environment where the key
2071    /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
2072    /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
2073    /// where all related cryptographic operations are performed. Only applicable
2074    /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
2075    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2076    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
2077    /// resource name in the format `projects/*/locations/*/ekmConnections/*`.
2078    /// Note, this list is non-exhaustive and may apply to additional
2079    /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
2080    ///
2081    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2082    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2083    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2084    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2085    pub crypto_key_backend: std::string::String,
2086
2087    /// Optional. The policy used for Key Access Justifications Policy Enforcement.
2088    /// If this field is present and this key is enrolled in Key Access
2089    /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
2090    /// decrypt, and sign operations, and the operation will fail if rejected by
2091    /// the policy. The policy is defined by specifying zero or more allowed
2092    /// justification codes.
2093    /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
2094    /// By default, this field is absent, and all justification codes are allowed.
2095    pub key_access_justifications_policy:
2096        std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
2097
2098    /// Controls the rate of automatic rotation.
2099    pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
2100
2101    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2102}
2103
2104impl CryptoKey {
2105    pub fn new() -> Self {
2106        std::default::Default::default()
2107    }
2108
2109    /// Sets the value of [name][crate::model::CryptoKey::name].
2110    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2111        self.name = v.into();
2112        self
2113    }
2114
2115    /// Sets the value of [primary][crate::model::CryptoKey::primary].
2116    pub fn set_primary<T>(mut self, v: T) -> Self
2117    where
2118        T: std::convert::Into<crate::model::CryptoKeyVersion>,
2119    {
2120        self.primary = std::option::Option::Some(v.into());
2121        self
2122    }
2123
2124    /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
2125    pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
2126    where
2127        T: std::convert::Into<crate::model::CryptoKeyVersion>,
2128    {
2129        self.primary = v.map(|x| x.into());
2130        self
2131    }
2132
2133    /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
2134    pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
2135        mut self,
2136        v: T,
2137    ) -> Self {
2138        self.purpose = v.into();
2139        self
2140    }
2141
2142    /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
2143    pub fn set_create_time<T>(mut self, v: T) -> Self
2144    where
2145        T: std::convert::Into<wkt::Timestamp>,
2146    {
2147        self.create_time = std::option::Option::Some(v.into());
2148        self
2149    }
2150
2151    /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
2152    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2153    where
2154        T: std::convert::Into<wkt::Timestamp>,
2155    {
2156        self.create_time = v.map(|x| x.into());
2157        self
2158    }
2159
2160    /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
2161    pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
2162    where
2163        T: std::convert::Into<wkt::Timestamp>,
2164    {
2165        self.next_rotation_time = std::option::Option::Some(v.into());
2166        self
2167    }
2168
2169    /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
2170    pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
2171    where
2172        T: std::convert::Into<wkt::Timestamp>,
2173    {
2174        self.next_rotation_time = v.map(|x| x.into());
2175        self
2176    }
2177
2178    /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
2179    pub fn set_version_template<T>(mut self, v: T) -> Self
2180    where
2181        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
2182    {
2183        self.version_template = std::option::Option::Some(v.into());
2184        self
2185    }
2186
2187    /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
2188    pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
2189    where
2190        T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
2191    {
2192        self.version_template = v.map(|x| x.into());
2193        self
2194    }
2195
2196    /// Sets the value of [labels][crate::model::CryptoKey::labels].
2197    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2198    where
2199        T: std::iter::IntoIterator<Item = (K, V)>,
2200        K: std::convert::Into<std::string::String>,
2201        V: std::convert::Into<std::string::String>,
2202    {
2203        use std::iter::Iterator;
2204        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2205        self
2206    }
2207
2208    /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
2209    pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2210        self.import_only = v.into();
2211        self
2212    }
2213
2214    /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
2215    pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
2216    where
2217        T: std::convert::Into<wkt::Duration>,
2218    {
2219        self.destroy_scheduled_duration = std::option::Option::Some(v.into());
2220        self
2221    }
2222
2223    /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
2224    pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
2225    where
2226        T: std::convert::Into<wkt::Duration>,
2227    {
2228        self.destroy_scheduled_duration = v.map(|x| x.into());
2229        self
2230    }
2231
2232    /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
2233    pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
2234        mut self,
2235        v: T,
2236    ) -> Self {
2237        self.crypto_key_backend = v.into();
2238        self
2239    }
2240
2241    /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
2242    pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
2243    where
2244        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
2245    {
2246        self.key_access_justifications_policy = std::option::Option::Some(v.into());
2247        self
2248    }
2249
2250    /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
2251    pub fn set_or_clear_key_access_justifications_policy<T>(
2252        mut self,
2253        v: std::option::Option<T>,
2254    ) -> Self
2255    where
2256        T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
2257    {
2258        self.key_access_justifications_policy = v.map(|x| x.into());
2259        self
2260    }
2261
2262    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
2263    ///
2264    /// Note that all the setters affecting `rotation_schedule` are mutually
2265    /// exclusive.
2266    pub fn set_rotation_schedule<
2267        T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
2268    >(
2269        mut self,
2270        v: T,
2271    ) -> Self {
2272        self.rotation_schedule = v.into();
2273        self
2274    }
2275
2276    /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
2277    /// if it holds a `RotationPeriod`, `None` if the field is not set or
2278    /// holds a different branch.
2279    pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
2280        #[allow(unreachable_patterns)]
2281        self.rotation_schedule.as_ref().and_then(|v| match v {
2282            crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
2283                std::option::Option::Some(v)
2284            }
2285            _ => std::option::Option::None,
2286        })
2287    }
2288
2289    /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
2290    /// to hold a `RotationPeriod`.
2291    ///
2292    /// Note that all the setters affecting `rotation_schedule` are
2293    /// mutually exclusive.
2294    pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
2295        mut self,
2296        v: T,
2297    ) -> Self {
2298        self.rotation_schedule = std::option::Option::Some(
2299            crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
2300        );
2301        self
2302    }
2303}
2304
2305impl wkt::message::Message for CryptoKey {
2306    fn typename() -> &'static str {
2307        "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
2308    }
2309}
2310
2311/// Defines additional types related to [CryptoKey].
2312pub mod crypto_key {
2313    #[allow(unused_imports)]
2314    use super::*;
2315
2316    /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
2317    /// describes the cryptographic capabilities of a
2318    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
2319    /// for the operations allowed by its purpose. For more information, see [Key
2320    /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
2321    ///
2322    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2323    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
2324    ///
2325    /// # Working with unknown values
2326    ///
2327    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2328    /// additional enum variants at any time. Adding new variants is not considered
2329    /// a breaking change. Applications should write their code in anticipation of:
2330    ///
2331    /// - New values appearing in future releases of the client library, **and**
2332    /// - New values received dynamically, without application changes.
2333    ///
2334    /// Please consult the [Working with enums] section in the user guide for some
2335    /// guidelines.
2336    ///
2337    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2338    #[derive(Clone, Debug, PartialEq)]
2339    #[non_exhaustive]
2340    pub enum CryptoKeyPurpose {
2341        /// Not specified.
2342        Unspecified,
2343        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
2344        /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
2345        /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
2346        ///
2347        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2348        /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
2349        /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
2350        EncryptDecrypt,
2351        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
2352        /// with
2353        /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
2354        /// and
2355        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
2356        ///
2357        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2358        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
2359        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
2360        AsymmetricSign,
2361        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
2362        /// with
2363        /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
2364        /// and
2365        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
2366        ///
2367        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2368        /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
2369        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
2370        AsymmetricDecrypt,
2371        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
2372        /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
2373        /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
2374        /// This purpose is meant to be used for interoperable symmetric
2375        /// encryption and does not support automatic CryptoKey rotation.
2376        ///
2377        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2378        /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
2379        /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
2380        RawEncryptDecrypt,
2381        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
2382        /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
2383        ///
2384        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2385        /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
2386        Mac,
2387        /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
2388        /// with
2389        /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
2390        /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
2391        ///
2392        /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2393        /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
2394        /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
2395        KeyEncapsulation,
2396        /// If set, the enum was initialized with an unknown value.
2397        ///
2398        /// Applications can examine the value using [CryptoKeyPurpose::value] or
2399        /// [CryptoKeyPurpose::name].
2400        UnknownValue(crypto_key_purpose::UnknownValue),
2401    }
2402
2403    #[doc(hidden)]
2404    pub mod crypto_key_purpose {
2405        #[allow(unused_imports)]
2406        use super::*;
2407        #[derive(Clone, Debug, PartialEq)]
2408        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2409    }
2410
2411    impl CryptoKeyPurpose {
2412        /// Gets the enum value.
2413        ///
2414        /// Returns `None` if the enum contains an unknown value deserialized from
2415        /// the string representation of enums.
2416        pub fn value(&self) -> std::option::Option<i32> {
2417            match self {
2418                Self::Unspecified => std::option::Option::Some(0),
2419                Self::EncryptDecrypt => std::option::Option::Some(1),
2420                Self::AsymmetricSign => std::option::Option::Some(5),
2421                Self::AsymmetricDecrypt => std::option::Option::Some(6),
2422                Self::RawEncryptDecrypt => std::option::Option::Some(7),
2423                Self::Mac => std::option::Option::Some(9),
2424                Self::KeyEncapsulation => std::option::Option::Some(10),
2425                Self::UnknownValue(u) => u.0.value(),
2426            }
2427        }
2428
2429        /// Gets the enum value as a string.
2430        ///
2431        /// Returns `None` if the enum contains an unknown value deserialized from
2432        /// the integer representation of enums.
2433        pub fn name(&self) -> std::option::Option<&str> {
2434            match self {
2435                Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
2436                Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
2437                Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
2438                Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
2439                Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
2440                Self::Mac => std::option::Option::Some("MAC"),
2441                Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
2442                Self::UnknownValue(u) => u.0.name(),
2443            }
2444        }
2445    }
2446
2447    impl std::default::Default for CryptoKeyPurpose {
2448        fn default() -> Self {
2449            use std::convert::From;
2450            Self::from(0)
2451        }
2452    }
2453
2454    impl std::fmt::Display for CryptoKeyPurpose {
2455        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2456            wkt::internal::display_enum(f, self.name(), self.value())
2457        }
2458    }
2459
2460    impl std::convert::From<i32> for CryptoKeyPurpose {
2461        fn from(value: i32) -> Self {
2462            match value {
2463                0 => Self::Unspecified,
2464                1 => Self::EncryptDecrypt,
2465                5 => Self::AsymmetricSign,
2466                6 => Self::AsymmetricDecrypt,
2467                7 => Self::RawEncryptDecrypt,
2468                9 => Self::Mac,
2469                10 => Self::KeyEncapsulation,
2470                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
2471                    wkt::internal::UnknownEnumValue::Integer(value),
2472                )),
2473            }
2474        }
2475    }
2476
2477    impl std::convert::From<&str> for CryptoKeyPurpose {
2478        fn from(value: &str) -> Self {
2479            use std::string::ToString;
2480            match value {
2481                "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
2482                "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
2483                "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
2484                "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
2485                "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
2486                "MAC" => Self::Mac,
2487                "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
2488                _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
2489                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2490                )),
2491            }
2492        }
2493    }
2494
2495    impl serde::ser::Serialize for CryptoKeyPurpose {
2496        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2497        where
2498            S: serde::Serializer,
2499        {
2500            match self {
2501                Self::Unspecified => serializer.serialize_i32(0),
2502                Self::EncryptDecrypt => serializer.serialize_i32(1),
2503                Self::AsymmetricSign => serializer.serialize_i32(5),
2504                Self::AsymmetricDecrypt => serializer.serialize_i32(6),
2505                Self::RawEncryptDecrypt => serializer.serialize_i32(7),
2506                Self::Mac => serializer.serialize_i32(9),
2507                Self::KeyEncapsulation => serializer.serialize_i32(10),
2508                Self::UnknownValue(u) => u.0.serialize(serializer),
2509            }
2510        }
2511    }
2512
2513    impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
2514        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2515        where
2516            D: serde::Deserializer<'de>,
2517        {
2518            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
2519                ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
2520            ))
2521        }
2522    }
2523
2524    /// Controls the rate of automatic rotation.
2525    #[derive(Clone, Debug, PartialEq)]
2526    #[non_exhaustive]
2527    pub enum RotationSchedule {
2528        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
2529        /// will be advanced by this period when the service automatically rotates a
2530        /// key. Must be at least 24 hours and at most 876,000 hours.
2531        ///
2532        /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
2533        /// set,
2534        /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
2535        /// must also be set.
2536        ///
2537        /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
2538        /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
2539        /// support automatic rotation. For other keys, this field must be omitted.
2540        ///
2541        /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
2542        /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
2543        /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
2544        /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
2545        RotationPeriod(std::boxed::Box<wkt::Duration>),
2546    }
2547}
2548
2549/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
2550/// specifies the properties to use when creating a new
2551/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
2552/// with
2553/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
2554/// or automatically as a result of auto-rotation.
2555///
2556/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2557/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
2558/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
2559#[derive(Clone, Default, PartialEq)]
2560#[non_exhaustive]
2561pub struct CryptoKeyVersionTemplate {
2562    /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
2563    /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
2564    /// template. Immutable. Defaults to
2565    /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
2566    ///
2567    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2568    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2569    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
2570    pub protection_level: crate::model::ProtectionLevel,
2571
2572    /// Required.
2573    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
2574    /// to use when creating a
2575    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
2576    /// template.
2577    ///
2578    /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
2579    /// this field is omitted and
2580    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
2581    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
2582    ///
2583    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
2584    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
2585    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2586    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
2587    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
2588
2589    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2590}
2591
2592impl CryptoKeyVersionTemplate {
2593    pub fn new() -> Self {
2594        std::default::Default::default()
2595    }
2596
2597    /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
2598    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
2599        mut self,
2600        v: T,
2601    ) -> Self {
2602        self.protection_level = v.into();
2603        self
2604    }
2605
2606    /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
2607    pub fn set_algorithm<
2608        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
2609    >(
2610        mut self,
2611        v: T,
2612    ) -> Self {
2613        self.algorithm = v.into();
2614        self
2615    }
2616}
2617
2618impl wkt::message::Message for CryptoKeyVersionTemplate {
2619    fn typename() -> &'static str {
2620        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
2621    }
2622}
2623
2624/// Contains an HSM-generated attestation about a key operation. For more
2625/// information, see [Verifying attestations]
2626/// (<https://cloud.google.com/kms/docs/attest-key>).
2627#[derive(Clone, Default, PartialEq)]
2628#[non_exhaustive]
2629pub struct KeyOperationAttestation {
2630    /// Output only. The format of the attestation data.
2631    pub format: crate::model::key_operation_attestation::AttestationFormat,
2632
2633    /// Output only. The attestation data provided by the HSM when the key
2634    /// operation was performed.
2635    pub content: ::bytes::Bytes,
2636
2637    /// Output only. The certificate chains needed to validate the attestation
2638    pub cert_chains:
2639        std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
2640
2641    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2642}
2643
2644impl KeyOperationAttestation {
2645    pub fn new() -> Self {
2646        std::default::Default::default()
2647    }
2648
2649    /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
2650    pub fn set_format<
2651        T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
2652    >(
2653        mut self,
2654        v: T,
2655    ) -> Self {
2656        self.format = v.into();
2657        self
2658    }
2659
2660    /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
2661    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
2662        self.content = v.into();
2663        self
2664    }
2665
2666    /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
2667    pub fn set_cert_chains<T>(mut self, v: T) -> Self
2668    where
2669        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
2670    {
2671        self.cert_chains = std::option::Option::Some(v.into());
2672        self
2673    }
2674
2675    /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
2676    pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
2677    where
2678        T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
2679    {
2680        self.cert_chains = v.map(|x| x.into());
2681        self
2682    }
2683}
2684
2685impl wkt::message::Message for KeyOperationAttestation {
2686    fn typename() -> &'static str {
2687        "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
2688    }
2689}
2690
2691/// Defines additional types related to [KeyOperationAttestation].
2692pub mod key_operation_attestation {
2693    #[allow(unused_imports)]
2694    use super::*;
2695
2696    /// Certificate chains needed to verify the attestation.
2697    /// Certificates in chains are PEM-encoded and are ordered based on
2698    /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
2699    #[derive(Clone, Default, PartialEq)]
2700    #[non_exhaustive]
2701    pub struct CertificateChains {
2702        /// Cavium certificate chain corresponding to the attestation.
2703        pub cavium_certs: std::vec::Vec<std::string::String>,
2704
2705        /// Google card certificate chain corresponding to the attestation.
2706        pub google_card_certs: std::vec::Vec<std::string::String>,
2707
2708        /// Google partition certificate chain corresponding to the attestation.
2709        pub google_partition_certs: std::vec::Vec<std::string::String>,
2710
2711        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2712    }
2713
2714    impl CertificateChains {
2715        pub fn new() -> Self {
2716            std::default::Default::default()
2717        }
2718
2719        /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
2720        pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
2721        where
2722            T: std::iter::IntoIterator<Item = V>,
2723            V: std::convert::Into<std::string::String>,
2724        {
2725            use std::iter::Iterator;
2726            self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
2727            self
2728        }
2729
2730        /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
2731        pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
2732        where
2733            T: std::iter::IntoIterator<Item = V>,
2734            V: std::convert::Into<std::string::String>,
2735        {
2736            use std::iter::Iterator;
2737            self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
2738            self
2739        }
2740
2741        /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
2742        pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
2743        where
2744            T: std::iter::IntoIterator<Item = V>,
2745            V: std::convert::Into<std::string::String>,
2746        {
2747            use std::iter::Iterator;
2748            self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
2749            self
2750        }
2751    }
2752
2753    impl wkt::message::Message for CertificateChains {
2754        fn typename() -> &'static str {
2755            "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
2756        }
2757    }
2758
2759    /// Attestation formats provided by the HSM.
2760    ///
2761    /// # Working with unknown values
2762    ///
2763    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2764    /// additional enum variants at any time. Adding new variants is not considered
2765    /// a breaking change. Applications should write their code in anticipation of:
2766    ///
2767    /// - New values appearing in future releases of the client library, **and**
2768    /// - New values received dynamically, without application changes.
2769    ///
2770    /// Please consult the [Working with enums] section in the user guide for some
2771    /// guidelines.
2772    ///
2773    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2774    #[derive(Clone, Debug, PartialEq)]
2775    #[non_exhaustive]
2776    pub enum AttestationFormat {
2777        /// Not specified.
2778        Unspecified,
2779        /// Cavium HSM attestation compressed with gzip. Note that this format is
2780        /// defined by Cavium and subject to change at any time.
2781        ///
2782        /// See
2783        /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
2784        CaviumV1Compressed,
2785        /// Cavium HSM attestation V2 compressed with gzip. This is a new format
2786        /// introduced in Cavium's version 3.2-08.
2787        CaviumV2Compressed,
2788        /// If set, the enum was initialized with an unknown value.
2789        ///
2790        /// Applications can examine the value using [AttestationFormat::value] or
2791        /// [AttestationFormat::name].
2792        UnknownValue(attestation_format::UnknownValue),
2793    }
2794
2795    #[doc(hidden)]
2796    pub mod attestation_format {
2797        #[allow(unused_imports)]
2798        use super::*;
2799        #[derive(Clone, Debug, PartialEq)]
2800        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2801    }
2802
2803    impl AttestationFormat {
2804        /// Gets the enum value.
2805        ///
2806        /// Returns `None` if the enum contains an unknown value deserialized from
2807        /// the string representation of enums.
2808        pub fn value(&self) -> std::option::Option<i32> {
2809            match self {
2810                Self::Unspecified => std::option::Option::Some(0),
2811                Self::CaviumV1Compressed => std::option::Option::Some(3),
2812                Self::CaviumV2Compressed => std::option::Option::Some(4),
2813                Self::UnknownValue(u) => u.0.value(),
2814            }
2815        }
2816
2817        /// Gets the enum value as a string.
2818        ///
2819        /// Returns `None` if the enum contains an unknown value deserialized from
2820        /// the integer representation of enums.
2821        pub fn name(&self) -> std::option::Option<&str> {
2822            match self {
2823                Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
2824                Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
2825                Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
2826                Self::UnknownValue(u) => u.0.name(),
2827            }
2828        }
2829    }
2830
2831    impl std::default::Default for AttestationFormat {
2832        fn default() -> Self {
2833            use std::convert::From;
2834            Self::from(0)
2835        }
2836    }
2837
2838    impl std::fmt::Display for AttestationFormat {
2839        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2840            wkt::internal::display_enum(f, self.name(), self.value())
2841        }
2842    }
2843
2844    impl std::convert::From<i32> for AttestationFormat {
2845        fn from(value: i32) -> Self {
2846            match value {
2847                0 => Self::Unspecified,
2848                3 => Self::CaviumV1Compressed,
2849                4 => Self::CaviumV2Compressed,
2850                _ => Self::UnknownValue(attestation_format::UnknownValue(
2851                    wkt::internal::UnknownEnumValue::Integer(value),
2852                )),
2853            }
2854        }
2855    }
2856
2857    impl std::convert::From<&str> for AttestationFormat {
2858        fn from(value: &str) -> Self {
2859            use std::string::ToString;
2860            match value {
2861                "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
2862                "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
2863                "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
2864                _ => Self::UnknownValue(attestation_format::UnknownValue(
2865                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2866                )),
2867            }
2868        }
2869    }
2870
2871    impl serde::ser::Serialize for AttestationFormat {
2872        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2873        where
2874            S: serde::Serializer,
2875        {
2876            match self {
2877                Self::Unspecified => serializer.serialize_i32(0),
2878                Self::CaviumV1Compressed => serializer.serialize_i32(3),
2879                Self::CaviumV2Compressed => serializer.serialize_i32(4),
2880                Self::UnknownValue(u) => u.0.serialize(serializer),
2881            }
2882        }
2883    }
2884
2885    impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
2886        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2887        where
2888            D: serde::Deserializer<'de>,
2889        {
2890            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
2891                ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
2892            ))
2893        }
2894    }
2895}
2896
2897/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
2898/// individual cryptographic key, and the associated key material.
2899///
2900/// An
2901/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
2902/// version can be used for cryptographic operations.
2903///
2904/// For security reasons, the raw cryptographic key material represented by a
2905/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
2906/// or exported. It can only be used to encrypt, decrypt, or sign data when an
2907/// authorized user or application invokes Cloud KMS.
2908///
2909/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2910/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
2911#[derive(Clone, Default, PartialEq)]
2912#[non_exhaustive]
2913pub struct CryptoKeyVersion {
2914    /// Output only. The resource name for this
2915    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
2916    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
2917    ///
2918    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2919    pub name: std::string::String,
2920
2921    /// The current state of the
2922    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2923    ///
2924    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2925    pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
2926
2927    /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
2928    /// describing how crypto operations are performed with this
2929    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2930    ///
2931    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2932    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2933    pub protection_level: crate::model::ProtectionLevel,
2934
2935    /// Output only. The
2936    /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
2937    /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2938    /// supports.
2939    ///
2940    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2941    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
2942    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
2943
2944    /// Output only. Statement that was generated and signed by the HSM at key
2945    /// creation time. Use this statement to verify attributes of the key as stored
2946    /// on the HSM, independently of Google. Only provided for key versions with
2947    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
2948    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
2949    ///
2950    /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
2951    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
2952    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
2953
2954    /// Output only. The time at which this
2955    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
2956    ///
2957    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2958    pub create_time: std::option::Option<wkt::Timestamp>,
2959
2960    /// Output only. The time this
2961    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
2962    /// generated.
2963    ///
2964    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2965    pub generate_time: std::option::Option<wkt::Timestamp>,
2966
2967    /// Output only. The time this
2968    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
2969    /// scheduled for destruction. Only present if
2970    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
2971    /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
2972    ///
2973    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2974    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
2975    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
2976    pub destroy_time: std::option::Option<wkt::Timestamp>,
2977
2978    /// Output only. The time this CryptoKeyVersion's key material was
2979    /// destroyed. Only present if
2980    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
2981    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
2982    ///
2983    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
2984    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
2985    pub destroy_event_time: std::option::Option<wkt::Timestamp>,
2986
2987    /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
2988    /// used in the most recent import of this
2989    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
2990    /// the underlying key material was imported.
2991    ///
2992    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2993    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
2994    pub import_job: std::string::String,
2995
2996    /// Output only. The time at which this
2997    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
2998    /// most recently imported.
2999    ///
3000    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3001    pub import_time: std::option::Option<wkt::Timestamp>,
3002
3003    /// Output only. The root cause of the most recent import failure. Only present
3004    /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3005    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
3006    ///
3007    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
3008    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3009    pub import_failure_reason: std::string::String,
3010
3011    /// Output only. The root cause of the most recent generation failure. Only
3012    /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3013    /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
3014    ///
3015    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
3016    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3017    pub generation_failure_reason: std::string::String,
3018
3019    /// Output only. The root cause of the most recent external destruction
3020    /// failure. Only present if
3021    /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
3022    /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
3023    ///
3024    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
3025    /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
3026    pub external_destruction_failure_reason: std::string::String,
3027
3028    /// ExternalProtectionLevelOptions stores a group of additional fields for
3029    /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
3030    /// are specific to the
3031    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
3032    /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
3033    /// protection levels.
3034    ///
3035    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3036    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
3037    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
3038    pub external_protection_level_options:
3039        std::option::Option<crate::model::ExternalProtectionLevelOptions>,
3040
3041    /// Output only. Whether or not this key version is eligible for reimport, by
3042    /// being specified as a target in
3043    /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
3044    ///
3045    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
3046    pub reimport_eligible: bool,
3047
3048    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3049}
3050
3051impl CryptoKeyVersion {
3052    pub fn new() -> Self {
3053        std::default::Default::default()
3054    }
3055
3056    /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
3057    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3058        self.name = v.into();
3059        self
3060    }
3061
3062    /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
3063    pub fn set_state<
3064        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
3065    >(
3066        mut self,
3067        v: T,
3068    ) -> Self {
3069        self.state = v.into();
3070        self
3071    }
3072
3073    /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
3074    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
3075        mut self,
3076        v: T,
3077    ) -> Self {
3078        self.protection_level = v.into();
3079        self
3080    }
3081
3082    /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
3083    pub fn set_algorithm<
3084        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
3085    >(
3086        mut self,
3087        v: T,
3088    ) -> Self {
3089        self.algorithm = v.into();
3090        self
3091    }
3092
3093    /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
3094    pub fn set_attestation<T>(mut self, v: T) -> Self
3095    where
3096        T: std::convert::Into<crate::model::KeyOperationAttestation>,
3097    {
3098        self.attestation = std::option::Option::Some(v.into());
3099        self
3100    }
3101
3102    /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
3103    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
3104    where
3105        T: std::convert::Into<crate::model::KeyOperationAttestation>,
3106    {
3107        self.attestation = v.map(|x| x.into());
3108        self
3109    }
3110
3111    /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
3112    pub fn set_create_time<T>(mut self, v: T) -> Self
3113    where
3114        T: std::convert::Into<wkt::Timestamp>,
3115    {
3116        self.create_time = std::option::Option::Some(v.into());
3117        self
3118    }
3119
3120    /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
3121    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3122    where
3123        T: std::convert::Into<wkt::Timestamp>,
3124    {
3125        self.create_time = v.map(|x| x.into());
3126        self
3127    }
3128
3129    /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
3130    pub fn set_generate_time<T>(mut self, v: T) -> Self
3131    where
3132        T: std::convert::Into<wkt::Timestamp>,
3133    {
3134        self.generate_time = std::option::Option::Some(v.into());
3135        self
3136    }
3137
3138    /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
3139    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
3140    where
3141        T: std::convert::Into<wkt::Timestamp>,
3142    {
3143        self.generate_time = v.map(|x| x.into());
3144        self
3145    }
3146
3147    /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
3148    pub fn set_destroy_time<T>(mut self, v: T) -> Self
3149    where
3150        T: std::convert::Into<wkt::Timestamp>,
3151    {
3152        self.destroy_time = std::option::Option::Some(v.into());
3153        self
3154    }
3155
3156    /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
3157    pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
3158    where
3159        T: std::convert::Into<wkt::Timestamp>,
3160    {
3161        self.destroy_time = v.map(|x| x.into());
3162        self
3163    }
3164
3165    /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
3166    pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
3167    where
3168        T: std::convert::Into<wkt::Timestamp>,
3169    {
3170        self.destroy_event_time = std::option::Option::Some(v.into());
3171        self
3172    }
3173
3174    /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
3175    pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
3176    where
3177        T: std::convert::Into<wkt::Timestamp>,
3178    {
3179        self.destroy_event_time = v.map(|x| x.into());
3180        self
3181    }
3182
3183    /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
3184    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3185        self.import_job = v.into();
3186        self
3187    }
3188
3189    /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
3190    pub fn set_import_time<T>(mut self, v: T) -> Self
3191    where
3192        T: std::convert::Into<wkt::Timestamp>,
3193    {
3194        self.import_time = std::option::Option::Some(v.into());
3195        self
3196    }
3197
3198    /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
3199    pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
3200    where
3201        T: std::convert::Into<wkt::Timestamp>,
3202    {
3203        self.import_time = v.map(|x| x.into());
3204        self
3205    }
3206
3207    /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
3208    pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
3209        mut self,
3210        v: T,
3211    ) -> Self {
3212        self.import_failure_reason = v.into();
3213        self
3214    }
3215
3216    /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
3217    pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
3218        mut self,
3219        v: T,
3220    ) -> Self {
3221        self.generation_failure_reason = v.into();
3222        self
3223    }
3224
3225    /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
3226    pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
3227        mut self,
3228        v: T,
3229    ) -> Self {
3230        self.external_destruction_failure_reason = v.into();
3231        self
3232    }
3233
3234    /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
3235    pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
3236    where
3237        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
3238    {
3239        self.external_protection_level_options = std::option::Option::Some(v.into());
3240        self
3241    }
3242
3243    /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
3244    pub fn set_or_clear_external_protection_level_options<T>(
3245        mut self,
3246        v: std::option::Option<T>,
3247    ) -> Self
3248    where
3249        T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
3250    {
3251        self.external_protection_level_options = v.map(|x| x.into());
3252        self
3253    }
3254
3255    /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
3256    pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3257        self.reimport_eligible = v.into();
3258        self
3259    }
3260}
3261
3262impl wkt::message::Message for CryptoKeyVersion {
3263    fn typename() -> &'static str {
3264        "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
3265    }
3266}
3267
3268/// Defines additional types related to [CryptoKeyVersion].
3269pub mod crypto_key_version {
3270    #[allow(unused_imports)]
3271    use super::*;
3272
3273    /// The algorithm of the
3274    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
3275    /// parameters must be used for each cryptographic operation.
3276    ///
3277    /// The
3278    /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
3279    /// algorithm is usable with
3280    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
3281    /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
3282    ///
3283    /// Algorithms beginning with `RSA_SIGN_` are usable with
3284    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
3285    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
3286    ///
3287    /// The fields in the name after `RSA_SIGN_` correspond to the following
3288    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
3289    ///
3290    /// For PSS, the salt length used is equal to the length of digest
3291    /// algorithm. For example,
3292    /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
3293    /// will use PSS with a salt length of 256 bits or 32 bytes.
3294    ///
3295    /// Algorithms beginning with `RSA_DECRYPT_` are usable with
3296    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
3297    /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
3298    ///
3299    /// The fields in the name after `RSA_DECRYPT_` correspond to the following
3300    /// parameters: padding algorithm, modulus bit length, and digest algorithm.
3301    ///
3302    /// Algorithms beginning with `EC_SIGN_` are usable with
3303    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
3304    /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
3305    ///
3306    /// The fields in the name after `EC_SIGN_` correspond to the following
3307    /// parameters: elliptic curve, digest algorithm.
3308    ///
3309    /// Algorithms beginning with `HMAC_` are usable with
3310    /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
3311    /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
3312    ///
3313    /// The suffix following `HMAC_` corresponds to the hash algorithm being used
3314    /// (eg. SHA256).
3315    ///
3316    /// Algorithms beginning with `PQ_` are post-quantum.
3317    ///
3318    /// For more information, see [Key purposes and algorithms]
3319    /// (<https://cloud.google.com/kms/docs/algorithms>).
3320    ///
3321    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
3322    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
3323    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
3324    /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
3325    /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
3326    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3327    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
3328    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
3329    ///
3330    /// # Working with unknown values
3331    ///
3332    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3333    /// additional enum variants at any time. Adding new variants is not considered
3334    /// a breaking change. Applications should write their code in anticipation of:
3335    ///
3336    /// - New values appearing in future releases of the client library, **and**
3337    /// - New values received dynamically, without application changes.
3338    ///
3339    /// Please consult the [Working with enums] section in the user guide for some
3340    /// guidelines.
3341    ///
3342    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3343    #[derive(Clone, Debug, PartialEq)]
3344    #[non_exhaustive]
3345    pub enum CryptoKeyVersionAlgorithm {
3346        /// Not specified.
3347        Unspecified,
3348        /// Creates symmetric encryption keys.
3349        GoogleSymmetricEncryption,
3350        /// AES-GCM (Galois Counter Mode) using 128-bit keys.
3351        Aes128Gcm,
3352        /// AES-GCM (Galois Counter Mode) using 256-bit keys.
3353        Aes256Gcm,
3354        /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
3355        Aes128Cbc,
3356        /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
3357        Aes256Cbc,
3358        /// AES-CTR (Counter Mode) using 128-bit keys.
3359        Aes128Ctr,
3360        /// AES-CTR (Counter Mode) using 256-bit keys.
3361        Aes256Ctr,
3362        /// RSASSA-PSS 2048 bit key with a SHA256 digest.
3363        RsaSignPss2048Sha256,
3364        /// RSASSA-PSS 3072 bit key with a SHA256 digest.
3365        RsaSignPss3072Sha256,
3366        /// RSASSA-PSS 4096 bit key with a SHA256 digest.
3367        RsaSignPss4096Sha256,
3368        /// RSASSA-PSS 4096 bit key with a SHA512 digest.
3369        RsaSignPss4096Sha512,
3370        /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
3371        RsaSignPkcs12048Sha256,
3372        /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
3373        RsaSignPkcs13072Sha256,
3374        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
3375        RsaSignPkcs14096Sha256,
3376        /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
3377        RsaSignPkcs14096Sha512,
3378        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
3379        RsaSignRawPkcs12048,
3380        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
3381        RsaSignRawPkcs13072,
3382        /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
3383        RsaSignRawPkcs14096,
3384        /// RSAES-OAEP 2048 bit key with a SHA256 digest.
3385        RsaDecryptOaep2048Sha256,
3386        /// RSAES-OAEP 3072 bit key with a SHA256 digest.
3387        RsaDecryptOaep3072Sha256,
3388        /// RSAES-OAEP 4096 bit key with a SHA256 digest.
3389        RsaDecryptOaep4096Sha256,
3390        /// RSAES-OAEP 4096 bit key with a SHA512 digest.
3391        RsaDecryptOaep4096Sha512,
3392        /// RSAES-OAEP 2048 bit key with a SHA1 digest.
3393        RsaDecryptOaep2048Sha1,
3394        /// RSAES-OAEP 3072 bit key with a SHA1 digest.
3395        RsaDecryptOaep3072Sha1,
3396        /// RSAES-OAEP 4096 bit key with a SHA1 digest.
3397        RsaDecryptOaep4096Sha1,
3398        /// ECDSA on the NIST P-256 curve with a SHA256 digest.
3399        /// Other hash functions can also be used:
3400        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
3401        EcSignP256Sha256,
3402        /// ECDSA on the NIST P-384 curve with a SHA384 digest.
3403        /// Other hash functions can also be used:
3404        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
3405        EcSignP384Sha384,
3406        /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
3407        /// HSM protection level.
3408        /// Other hash functions can also be used:
3409        /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
3410        EcSignSecp256K1Sha256,
3411        /// EdDSA on the Curve25519 in pure mode (taking data as input).
3412        EcSignEd25519,
3413        /// HMAC-SHA256 signing with a 256 bit key.
3414        HmacSha256,
3415        /// HMAC-SHA1 signing with a 160 bit key.
3416        HmacSha1,
3417        /// HMAC-SHA384 signing with a 384 bit key.
3418        HmacSha384,
3419        /// HMAC-SHA512 signing with a 512 bit key.
3420        HmacSha512,
3421        /// HMAC-SHA224 signing with a 224 bit key.
3422        HmacSha224,
3423        /// Algorithm representing symmetric encryption by an external key manager.
3424        ExternalSymmetricEncryption,
3425        /// ML-KEM-768 (FIPS 203)
3426        MlKem768,
3427        /// ML-KEM-1024 (FIPS 203)
3428        MlKem1024,
3429        /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
3430        /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
3431        KemXwing,
3432        /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
3433        /// security level 3. Randomized version.
3434        PqSignMlDsa65,
3435        /// The post-quantum stateless hash-based digital signature algorithm, at
3436        /// security level 1. Randomized version.
3437        PqSignSlhDsaSha2128S,
3438        /// If set, the enum was initialized with an unknown value.
3439        ///
3440        /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
3441        /// [CryptoKeyVersionAlgorithm::name].
3442        UnknownValue(crypto_key_version_algorithm::UnknownValue),
3443    }
3444
3445    #[doc(hidden)]
3446    pub mod crypto_key_version_algorithm {
3447        #[allow(unused_imports)]
3448        use super::*;
3449        #[derive(Clone, Debug, PartialEq)]
3450        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3451    }
3452
3453    impl CryptoKeyVersionAlgorithm {
3454        /// Gets the enum value.
3455        ///
3456        /// Returns `None` if the enum contains an unknown value deserialized from
3457        /// the string representation of enums.
3458        pub fn value(&self) -> std::option::Option<i32> {
3459            match self {
3460                Self::Unspecified => std::option::Option::Some(0),
3461                Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
3462                Self::Aes128Gcm => std::option::Option::Some(41),
3463                Self::Aes256Gcm => std::option::Option::Some(19),
3464                Self::Aes128Cbc => std::option::Option::Some(42),
3465                Self::Aes256Cbc => std::option::Option::Some(43),
3466                Self::Aes128Ctr => std::option::Option::Some(44),
3467                Self::Aes256Ctr => std::option::Option::Some(45),
3468                Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
3469                Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
3470                Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
3471                Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
3472                Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
3473                Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
3474                Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
3475                Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
3476                Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
3477                Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
3478                Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
3479                Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
3480                Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
3481                Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
3482                Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
3483                Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
3484                Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
3485                Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
3486                Self::EcSignP256Sha256 => std::option::Option::Some(12),
3487                Self::EcSignP384Sha384 => std::option::Option::Some(13),
3488                Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
3489                Self::EcSignEd25519 => std::option::Option::Some(40),
3490                Self::HmacSha256 => std::option::Option::Some(32),
3491                Self::HmacSha1 => std::option::Option::Some(33),
3492                Self::HmacSha384 => std::option::Option::Some(34),
3493                Self::HmacSha512 => std::option::Option::Some(35),
3494                Self::HmacSha224 => std::option::Option::Some(36),
3495                Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
3496                Self::MlKem768 => std::option::Option::Some(47),
3497                Self::MlKem1024 => std::option::Option::Some(48),
3498                Self::KemXwing => std::option::Option::Some(63),
3499                Self::PqSignMlDsa65 => std::option::Option::Some(56),
3500                Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
3501                Self::UnknownValue(u) => u.0.value(),
3502            }
3503        }
3504
3505        /// Gets the enum value as a string.
3506        ///
3507        /// Returns `None` if the enum contains an unknown value deserialized from
3508        /// the integer representation of enums.
3509        pub fn name(&self) -> std::option::Option<&str> {
3510            match self {
3511                Self::Unspecified => {
3512                    std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
3513                }
3514                Self::GoogleSymmetricEncryption => {
3515                    std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
3516                }
3517                Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
3518                Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
3519                Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
3520                Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
3521                Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
3522                Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
3523                Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
3524                Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
3525                Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
3526                Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
3527                Self::RsaSignPkcs12048Sha256 => {
3528                    std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
3529                }
3530                Self::RsaSignPkcs13072Sha256 => {
3531                    std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
3532                }
3533                Self::RsaSignPkcs14096Sha256 => {
3534                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
3535                }
3536                Self::RsaSignPkcs14096Sha512 => {
3537                    std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
3538                }
3539                Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
3540                Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
3541                Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
3542                Self::RsaDecryptOaep2048Sha256 => {
3543                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
3544                }
3545                Self::RsaDecryptOaep3072Sha256 => {
3546                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
3547                }
3548                Self::RsaDecryptOaep4096Sha256 => {
3549                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
3550                }
3551                Self::RsaDecryptOaep4096Sha512 => {
3552                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
3553                }
3554                Self::RsaDecryptOaep2048Sha1 => {
3555                    std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
3556                }
3557                Self::RsaDecryptOaep3072Sha1 => {
3558                    std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
3559                }
3560                Self::RsaDecryptOaep4096Sha1 => {
3561                    std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
3562                }
3563                Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
3564                Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
3565                Self::EcSignSecp256K1Sha256 => {
3566                    std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
3567                }
3568                Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
3569                Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
3570                Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
3571                Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
3572                Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
3573                Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
3574                Self::ExternalSymmetricEncryption => {
3575                    std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
3576                }
3577                Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
3578                Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
3579                Self::KemXwing => std::option::Option::Some("KEM_XWING"),
3580                Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
3581                Self::PqSignSlhDsaSha2128S => {
3582                    std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
3583                }
3584                Self::UnknownValue(u) => u.0.name(),
3585            }
3586        }
3587    }
3588
3589    impl std::default::Default for CryptoKeyVersionAlgorithm {
3590        fn default() -> Self {
3591            use std::convert::From;
3592            Self::from(0)
3593        }
3594    }
3595
3596    impl std::fmt::Display for CryptoKeyVersionAlgorithm {
3597        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3598            wkt::internal::display_enum(f, self.name(), self.value())
3599        }
3600    }
3601
3602    impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
3603        fn from(value: i32) -> Self {
3604            match value {
3605                0 => Self::Unspecified,
3606                1 => Self::GoogleSymmetricEncryption,
3607                2 => Self::RsaSignPss2048Sha256,
3608                3 => Self::RsaSignPss3072Sha256,
3609                4 => Self::RsaSignPss4096Sha256,
3610                5 => Self::RsaSignPkcs12048Sha256,
3611                6 => Self::RsaSignPkcs13072Sha256,
3612                7 => Self::RsaSignPkcs14096Sha256,
3613                8 => Self::RsaDecryptOaep2048Sha256,
3614                9 => Self::RsaDecryptOaep3072Sha256,
3615                10 => Self::RsaDecryptOaep4096Sha256,
3616                12 => Self::EcSignP256Sha256,
3617                13 => Self::EcSignP384Sha384,
3618                15 => Self::RsaSignPss4096Sha512,
3619                16 => Self::RsaSignPkcs14096Sha512,
3620                17 => Self::RsaDecryptOaep4096Sha512,
3621                18 => Self::ExternalSymmetricEncryption,
3622                19 => Self::Aes256Gcm,
3623                28 => Self::RsaSignRawPkcs12048,
3624                29 => Self::RsaSignRawPkcs13072,
3625                30 => Self::RsaSignRawPkcs14096,
3626                31 => Self::EcSignSecp256K1Sha256,
3627                32 => Self::HmacSha256,
3628                33 => Self::HmacSha1,
3629                34 => Self::HmacSha384,
3630                35 => Self::HmacSha512,
3631                36 => Self::HmacSha224,
3632                37 => Self::RsaDecryptOaep2048Sha1,
3633                38 => Self::RsaDecryptOaep3072Sha1,
3634                39 => Self::RsaDecryptOaep4096Sha1,
3635                40 => Self::EcSignEd25519,
3636                41 => Self::Aes128Gcm,
3637                42 => Self::Aes128Cbc,
3638                43 => Self::Aes256Cbc,
3639                44 => Self::Aes128Ctr,
3640                45 => Self::Aes256Ctr,
3641                47 => Self::MlKem768,
3642                48 => Self::MlKem1024,
3643                56 => Self::PqSignMlDsa65,
3644                57 => Self::PqSignSlhDsaSha2128S,
3645                63 => Self::KemXwing,
3646                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
3647                    wkt::internal::UnknownEnumValue::Integer(value),
3648                )),
3649            }
3650        }
3651    }
3652
3653    impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
3654        fn from(value: &str) -> Self {
3655            use std::string::ToString;
3656            match value {
3657                "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
3658                "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
3659                "AES_128_GCM" => Self::Aes128Gcm,
3660                "AES_256_GCM" => Self::Aes256Gcm,
3661                "AES_128_CBC" => Self::Aes128Cbc,
3662                "AES_256_CBC" => Self::Aes256Cbc,
3663                "AES_128_CTR" => Self::Aes128Ctr,
3664                "AES_256_CTR" => Self::Aes256Ctr,
3665                "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
3666                "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
3667                "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
3668                "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
3669                "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
3670                "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
3671                "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
3672                "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
3673                "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
3674                "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
3675                "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
3676                "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
3677                "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
3678                "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
3679                "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
3680                "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
3681                "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
3682                "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
3683                "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
3684                "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
3685                "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
3686                "EC_SIGN_ED25519" => Self::EcSignEd25519,
3687                "HMAC_SHA256" => Self::HmacSha256,
3688                "HMAC_SHA1" => Self::HmacSha1,
3689                "HMAC_SHA384" => Self::HmacSha384,
3690                "HMAC_SHA512" => Self::HmacSha512,
3691                "HMAC_SHA224" => Self::HmacSha224,
3692                "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
3693                "ML_KEM_768" => Self::MlKem768,
3694                "ML_KEM_1024" => Self::MlKem1024,
3695                "KEM_XWING" => Self::KemXwing,
3696                "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
3697                "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
3698                _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
3699                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3700                )),
3701            }
3702        }
3703    }
3704
3705    impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
3706        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3707        where
3708            S: serde::Serializer,
3709        {
3710            match self {
3711                Self::Unspecified => serializer.serialize_i32(0),
3712                Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
3713                Self::Aes128Gcm => serializer.serialize_i32(41),
3714                Self::Aes256Gcm => serializer.serialize_i32(19),
3715                Self::Aes128Cbc => serializer.serialize_i32(42),
3716                Self::Aes256Cbc => serializer.serialize_i32(43),
3717                Self::Aes128Ctr => serializer.serialize_i32(44),
3718                Self::Aes256Ctr => serializer.serialize_i32(45),
3719                Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
3720                Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
3721                Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
3722                Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
3723                Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
3724                Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
3725                Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
3726                Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
3727                Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
3728                Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
3729                Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
3730                Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
3731                Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
3732                Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
3733                Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
3734                Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
3735                Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
3736                Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
3737                Self::EcSignP256Sha256 => serializer.serialize_i32(12),
3738                Self::EcSignP384Sha384 => serializer.serialize_i32(13),
3739                Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
3740                Self::EcSignEd25519 => serializer.serialize_i32(40),
3741                Self::HmacSha256 => serializer.serialize_i32(32),
3742                Self::HmacSha1 => serializer.serialize_i32(33),
3743                Self::HmacSha384 => serializer.serialize_i32(34),
3744                Self::HmacSha512 => serializer.serialize_i32(35),
3745                Self::HmacSha224 => serializer.serialize_i32(36),
3746                Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
3747                Self::MlKem768 => serializer.serialize_i32(47),
3748                Self::MlKem1024 => serializer.serialize_i32(48),
3749                Self::KemXwing => serializer.serialize_i32(63),
3750                Self::PqSignMlDsa65 => serializer.serialize_i32(56),
3751                Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
3752                Self::UnknownValue(u) => u.0.serialize(serializer),
3753            }
3754        }
3755    }
3756
3757    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
3758        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3759        where
3760            D: serde::Deserializer<'de>,
3761        {
3762            deserializer.deserialize_any(
3763                wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
3764                    ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
3765                ),
3766            )
3767        }
3768    }
3769
3770    /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
3771    /// indicating if it can be used.
3772    ///
3773    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
3774    ///
3775    /// # Working with unknown values
3776    ///
3777    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3778    /// additional enum variants at any time. Adding new variants is not considered
3779    /// a breaking change. Applications should write their code in anticipation of:
3780    ///
3781    /// - New values appearing in future releases of the client library, **and**
3782    /// - New values received dynamically, without application changes.
3783    ///
3784    /// Please consult the [Working with enums] section in the user guide for some
3785    /// guidelines.
3786    ///
3787    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3788    #[derive(Clone, Debug, PartialEq)]
3789    #[non_exhaustive]
3790    pub enum CryptoKeyVersionState {
3791        /// Not specified.
3792        Unspecified,
3793        /// This version is still being generated. It may not be used, enabled,
3794        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
3795        /// version
3796        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
3797        /// as soon as the version is ready.
3798        ///
3799        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
3800        PendingGeneration,
3801        /// This version may be used for cryptographic operations.
3802        Enabled,
3803        /// This version may not be used, but the key material is still available,
3804        /// and the version can be placed back into the
3805        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
3806        /// state.
3807        ///
3808        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
3809        Disabled,
3810        /// The key material of this version is destroyed and no longer stored.
3811        /// This version may only become
3812        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
3813        /// again if this version is
3814        /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
3815        /// and the original key material is reimported with a call to
3816        /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
3817        ///
3818        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
3819        /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
3820        /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
3821        Destroyed,
3822        /// This version is scheduled for destruction, and will be destroyed soon.
3823        /// Call
3824        /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
3825        /// to put it back into the
3826        /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
3827        /// state.
3828        ///
3829        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
3830        /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
3831        DestroyScheduled,
3832        /// This version is still being imported. It may not be used, enabled,
3833        /// disabled, or destroyed yet. Cloud KMS will automatically mark this
3834        /// version
3835        /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
3836        /// as soon as the version is ready.
3837        ///
3838        /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
3839        PendingImport,
3840        /// This version was not imported successfully. It may not be used, enabled,
3841        /// disabled, or destroyed. The submitted key material has been discarded.
3842        /// Additional details can be found in
3843        /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
3844        ///
3845        /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
3846        ImportFailed,
3847        /// This version was not generated successfully. It may not be used, enabled,
3848        /// disabled, or destroyed. Additional details can be found in
3849        /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
3850        ///
3851        /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
3852        GenerationFailed,
3853        /// This version was destroyed, and it may not be used or enabled again.
3854        /// Cloud KMS is waiting for the corresponding key material residing in an
3855        /// external key manager to be destroyed.
3856        PendingExternalDestruction,
3857        /// This version was destroyed, and it may not be used or enabled again.
3858        /// However, Cloud KMS could not confirm that the corresponding key material
3859        /// residing in an external key manager was destroyed. Additional details can
3860        /// be found in
3861        /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
3862        ///
3863        /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
3864        ExternalDestructionFailed,
3865        /// If set, the enum was initialized with an unknown value.
3866        ///
3867        /// Applications can examine the value using [CryptoKeyVersionState::value] or
3868        /// [CryptoKeyVersionState::name].
3869        UnknownValue(crypto_key_version_state::UnknownValue),
3870    }
3871
3872    #[doc(hidden)]
3873    pub mod crypto_key_version_state {
3874        #[allow(unused_imports)]
3875        use super::*;
3876        #[derive(Clone, Debug, PartialEq)]
3877        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3878    }
3879
3880    impl CryptoKeyVersionState {
3881        /// Gets the enum value.
3882        ///
3883        /// Returns `None` if the enum contains an unknown value deserialized from
3884        /// the string representation of enums.
3885        pub fn value(&self) -> std::option::Option<i32> {
3886            match self {
3887                Self::Unspecified => std::option::Option::Some(0),
3888                Self::PendingGeneration => std::option::Option::Some(5),
3889                Self::Enabled => std::option::Option::Some(1),
3890                Self::Disabled => std::option::Option::Some(2),
3891                Self::Destroyed => std::option::Option::Some(3),
3892                Self::DestroyScheduled => std::option::Option::Some(4),
3893                Self::PendingImport => std::option::Option::Some(6),
3894                Self::ImportFailed => std::option::Option::Some(7),
3895                Self::GenerationFailed => std::option::Option::Some(8),
3896                Self::PendingExternalDestruction => std::option::Option::Some(9),
3897                Self::ExternalDestructionFailed => std::option::Option::Some(10),
3898                Self::UnknownValue(u) => u.0.value(),
3899            }
3900        }
3901
3902        /// Gets the enum value as a string.
3903        ///
3904        /// Returns `None` if the enum contains an unknown value deserialized from
3905        /// the integer representation of enums.
3906        pub fn name(&self) -> std::option::Option<&str> {
3907            match self {
3908                Self::Unspecified => {
3909                    std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
3910                }
3911                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
3912                Self::Enabled => std::option::Option::Some("ENABLED"),
3913                Self::Disabled => std::option::Option::Some("DISABLED"),
3914                Self::Destroyed => std::option::Option::Some("DESTROYED"),
3915                Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
3916                Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
3917                Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
3918                Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
3919                Self::PendingExternalDestruction => {
3920                    std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
3921                }
3922                Self::ExternalDestructionFailed => {
3923                    std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
3924                }
3925                Self::UnknownValue(u) => u.0.name(),
3926            }
3927        }
3928    }
3929
3930    impl std::default::Default for CryptoKeyVersionState {
3931        fn default() -> Self {
3932            use std::convert::From;
3933            Self::from(0)
3934        }
3935    }
3936
3937    impl std::fmt::Display for CryptoKeyVersionState {
3938        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3939            wkt::internal::display_enum(f, self.name(), self.value())
3940        }
3941    }
3942
3943    impl std::convert::From<i32> for CryptoKeyVersionState {
3944        fn from(value: i32) -> Self {
3945            match value {
3946                0 => Self::Unspecified,
3947                1 => Self::Enabled,
3948                2 => Self::Disabled,
3949                3 => Self::Destroyed,
3950                4 => Self::DestroyScheduled,
3951                5 => Self::PendingGeneration,
3952                6 => Self::PendingImport,
3953                7 => Self::ImportFailed,
3954                8 => Self::GenerationFailed,
3955                9 => Self::PendingExternalDestruction,
3956                10 => Self::ExternalDestructionFailed,
3957                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
3958                    wkt::internal::UnknownEnumValue::Integer(value),
3959                )),
3960            }
3961        }
3962    }
3963
3964    impl std::convert::From<&str> for CryptoKeyVersionState {
3965        fn from(value: &str) -> Self {
3966            use std::string::ToString;
3967            match value {
3968                "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
3969                "PENDING_GENERATION" => Self::PendingGeneration,
3970                "ENABLED" => Self::Enabled,
3971                "DISABLED" => Self::Disabled,
3972                "DESTROYED" => Self::Destroyed,
3973                "DESTROY_SCHEDULED" => Self::DestroyScheduled,
3974                "PENDING_IMPORT" => Self::PendingImport,
3975                "IMPORT_FAILED" => Self::ImportFailed,
3976                "GENERATION_FAILED" => Self::GenerationFailed,
3977                "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
3978                "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
3979                _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
3980                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3981                )),
3982            }
3983        }
3984    }
3985
3986    impl serde::ser::Serialize for CryptoKeyVersionState {
3987        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3988        where
3989            S: serde::Serializer,
3990        {
3991            match self {
3992                Self::Unspecified => serializer.serialize_i32(0),
3993                Self::PendingGeneration => serializer.serialize_i32(5),
3994                Self::Enabled => serializer.serialize_i32(1),
3995                Self::Disabled => serializer.serialize_i32(2),
3996                Self::Destroyed => serializer.serialize_i32(3),
3997                Self::DestroyScheduled => serializer.serialize_i32(4),
3998                Self::PendingImport => serializer.serialize_i32(6),
3999                Self::ImportFailed => serializer.serialize_i32(7),
4000                Self::GenerationFailed => serializer.serialize_i32(8),
4001                Self::PendingExternalDestruction => serializer.serialize_i32(9),
4002                Self::ExternalDestructionFailed => serializer.serialize_i32(10),
4003                Self::UnknownValue(u) => u.0.serialize(serializer),
4004            }
4005        }
4006    }
4007
4008    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
4009        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4010        where
4011            D: serde::Deserializer<'de>,
4012        {
4013            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
4014                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
4015            ))
4016        }
4017    }
4018
4019    /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
4020    /// Controls the level of detail returned for
4021    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
4022    /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
4023    /// and
4024    /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
4025    ///
4026    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4027    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
4028    /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
4029    ///
4030    /// # Working with unknown values
4031    ///
4032    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4033    /// additional enum variants at any time. Adding new variants is not considered
4034    /// a breaking change. Applications should write their code in anticipation of:
4035    ///
4036    /// - New values appearing in future releases of the client library, **and**
4037    /// - New values received dynamically, without application changes.
4038    ///
4039    /// Please consult the [Working with enums] section in the user guide for some
4040    /// guidelines.
4041    ///
4042    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4043    #[derive(Clone, Debug, PartialEq)]
4044    #[non_exhaustive]
4045    pub enum CryptoKeyVersionView {
4046        /// Default view for each
4047        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
4048        /// include the
4049        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
4050        ///
4051        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4052        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
4053        Unspecified,
4054        /// Provides all fields in each
4055        /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
4056        /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
4057        ///
4058        /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4059        /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
4060        Full,
4061        /// If set, the enum was initialized with an unknown value.
4062        ///
4063        /// Applications can examine the value using [CryptoKeyVersionView::value] or
4064        /// [CryptoKeyVersionView::name].
4065        UnknownValue(crypto_key_version_view::UnknownValue),
4066    }
4067
4068    #[doc(hidden)]
4069    pub mod crypto_key_version_view {
4070        #[allow(unused_imports)]
4071        use super::*;
4072        #[derive(Clone, Debug, PartialEq)]
4073        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4074    }
4075
4076    impl CryptoKeyVersionView {
4077        /// Gets the enum value.
4078        ///
4079        /// Returns `None` if the enum contains an unknown value deserialized from
4080        /// the string representation of enums.
4081        pub fn value(&self) -> std::option::Option<i32> {
4082            match self {
4083                Self::Unspecified => std::option::Option::Some(0),
4084                Self::Full => std::option::Option::Some(1),
4085                Self::UnknownValue(u) => u.0.value(),
4086            }
4087        }
4088
4089        /// Gets the enum value as a string.
4090        ///
4091        /// Returns `None` if the enum contains an unknown value deserialized from
4092        /// the integer representation of enums.
4093        pub fn name(&self) -> std::option::Option<&str> {
4094            match self {
4095                Self::Unspecified => {
4096                    std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
4097                }
4098                Self::Full => std::option::Option::Some("FULL"),
4099                Self::UnknownValue(u) => u.0.name(),
4100            }
4101        }
4102    }
4103
4104    impl std::default::Default for CryptoKeyVersionView {
4105        fn default() -> Self {
4106            use std::convert::From;
4107            Self::from(0)
4108        }
4109    }
4110
4111    impl std::fmt::Display for CryptoKeyVersionView {
4112        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4113            wkt::internal::display_enum(f, self.name(), self.value())
4114        }
4115    }
4116
4117    impl std::convert::From<i32> for CryptoKeyVersionView {
4118        fn from(value: i32) -> Self {
4119            match value {
4120                0 => Self::Unspecified,
4121                1 => Self::Full,
4122                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
4123                    wkt::internal::UnknownEnumValue::Integer(value),
4124                )),
4125            }
4126        }
4127    }
4128
4129    impl std::convert::From<&str> for CryptoKeyVersionView {
4130        fn from(value: &str) -> Self {
4131            use std::string::ToString;
4132            match value {
4133                "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
4134                "FULL" => Self::Full,
4135                _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
4136                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4137                )),
4138            }
4139        }
4140    }
4141
4142    impl serde::ser::Serialize for CryptoKeyVersionView {
4143        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4144        where
4145            S: serde::Serializer,
4146        {
4147            match self {
4148                Self::Unspecified => serializer.serialize_i32(0),
4149                Self::Full => serializer.serialize_i32(1),
4150                Self::UnknownValue(u) => u.0.serialize(serializer),
4151            }
4152        }
4153    }
4154
4155    impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
4156        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4157        where
4158            D: serde::Deserializer<'de>,
4159        {
4160            deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
4161                ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
4162            ))
4163        }
4164    }
4165}
4166
4167/// Data with integrity verification field.
4168#[derive(Clone, Default, PartialEq)]
4169#[non_exhaustive]
4170pub struct ChecksummedData {
4171    /// Raw Data.
4172    pub data: ::bytes::Bytes,
4173
4174    /// Integrity verification field. A CRC32C
4175    /// checksum of the returned
4176    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
4177    /// integrity check of
4178    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
4179    /// performed by computing the CRC32C checksum of
4180    /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
4181    /// comparing your results to this field. Discard the response in case of
4182    /// non-matching checksum values, and perform a limited number of retries. A
4183    /// persistent mismatch may indicate an issue in your computation of the CRC32C
4184    /// checksum. Note: This field is defined as int64 for reasons of compatibility
4185    /// across different languages. However, it is a non-negative integer, which
4186    /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
4187    /// languages that support this type.
4188    ///
4189    /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
4190    pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
4191
4192    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4193}
4194
4195impl ChecksummedData {
4196    pub fn new() -> Self {
4197        std::default::Default::default()
4198    }
4199
4200    /// Sets the value of [data][crate::model::ChecksummedData::data].
4201    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4202        self.data = v.into();
4203        self
4204    }
4205
4206    /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
4207    pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
4208    where
4209        T: std::convert::Into<wkt::Int64Value>,
4210    {
4211        self.crc32c_checksum = std::option::Option::Some(v.into());
4212        self
4213    }
4214
4215    /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
4216    pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
4217    where
4218        T: std::convert::Into<wkt::Int64Value>,
4219    {
4220        self.crc32c_checksum = v.map(|x| x.into());
4221        self
4222    }
4223}
4224
4225impl wkt::message::Message for ChecksummedData {
4226    fn typename() -> &'static str {
4227        "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
4228    }
4229}
4230
4231/// The public keys for a given
4232/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
4233/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
4234///
4235/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4236/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
4237#[derive(Clone, Default, PartialEq)]
4238#[non_exhaustive]
4239pub struct PublicKey {
4240    /// The public key, encoded in PEM format. For more information, see the
4241    /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
4242    /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
4243    /// [Textual Encoding of Subject Public Key Info]
4244    /// (<https://tools.ietf.org/html/rfc7468#section-13>).
4245    pub pem: std::string::String,
4246
4247    /// The
4248    /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
4249    /// associated with this key.
4250    ///
4251    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
4252    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
4253
4254    /// Integrity verification field. A CRC32C checksum of the returned
4255    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
4256    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
4257    /// computing the CRC32C checksum of
4258    /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
4259    /// results to this field. Discard the response in case of non-matching
4260    /// checksum values, and perform a limited number of retries. A persistent
4261    /// mismatch may indicate an issue in your computation of the CRC32C checksum.
4262    /// Note: This field is defined as int64 for reasons of compatibility across
4263    /// different languages. However, it is a non-negative integer, which will
4264    /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
4265    /// languages that support this type.
4266    ///
4267    /// NOTE: This field is in Beta.
4268    ///
4269    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
4270    pub pem_crc32c: std::option::Option<wkt::Int64Value>,
4271
4272    /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
4273    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
4274    /// Provided here for verification.
4275    ///
4276    /// NOTE: This field is in Beta.
4277    ///
4278    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4279    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
4280    pub name: std::string::String,
4281
4282    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
4283    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
4284    ///
4285    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4286    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
4287    pub protection_level: crate::model::ProtectionLevel,
4288
4289    /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
4290    /// customer through the
4291    /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
4292    /// field.
4293    ///
4294    /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
4295    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
4296    pub public_key_format: crate::model::public_key::PublicKeyFormat,
4297
4298    /// This field contains the public key (with integrity verification), formatted
4299    /// according to the
4300    /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
4301    ///
4302    /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
4303    pub public_key: std::option::Option<crate::model::ChecksummedData>,
4304
4305    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4306}
4307
4308impl PublicKey {
4309    pub fn new() -> Self {
4310        std::default::Default::default()
4311    }
4312
4313    /// Sets the value of [pem][crate::model::PublicKey::pem].
4314    pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4315        self.pem = v.into();
4316        self
4317    }
4318
4319    /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
4320    pub fn set_algorithm<
4321        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
4322    >(
4323        mut self,
4324        v: T,
4325    ) -> Self {
4326        self.algorithm = v.into();
4327        self
4328    }
4329
4330    /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
4331    pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
4332    where
4333        T: std::convert::Into<wkt::Int64Value>,
4334    {
4335        self.pem_crc32c = std::option::Option::Some(v.into());
4336        self
4337    }
4338
4339    /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
4340    pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
4341    where
4342        T: std::convert::Into<wkt::Int64Value>,
4343    {
4344        self.pem_crc32c = v.map(|x| x.into());
4345        self
4346    }
4347
4348    /// Sets the value of [name][crate::model::PublicKey::name].
4349    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4350        self.name = v.into();
4351        self
4352    }
4353
4354    /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
4355    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
4356        mut self,
4357        v: T,
4358    ) -> Self {
4359        self.protection_level = v.into();
4360        self
4361    }
4362
4363    /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
4364    pub fn set_public_key_format<
4365        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
4366    >(
4367        mut self,
4368        v: T,
4369    ) -> Self {
4370        self.public_key_format = v.into();
4371        self
4372    }
4373
4374    /// Sets the value of [public_key][crate::model::PublicKey::public_key].
4375    pub fn set_public_key<T>(mut self, v: T) -> Self
4376    where
4377        T: std::convert::Into<crate::model::ChecksummedData>,
4378    {
4379        self.public_key = std::option::Option::Some(v.into());
4380        self
4381    }
4382
4383    /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
4384    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
4385    where
4386        T: std::convert::Into<crate::model::ChecksummedData>,
4387    {
4388        self.public_key = v.map(|x| x.into());
4389        self
4390    }
4391}
4392
4393impl wkt::message::Message for PublicKey {
4394    fn typename() -> &'static str {
4395        "type.googleapis.com/google.cloud.kms.v1.PublicKey"
4396    }
4397}
4398
4399/// Defines additional types related to [PublicKey].
4400pub mod public_key {
4401    #[allow(unused_imports)]
4402    use super::*;
4403
4404    /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
4405    ///
4406    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
4407    ///
4408    /// # Working with unknown values
4409    ///
4410    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4411    /// additional enum variants at any time. Adding new variants is not considered
4412    /// a breaking change. Applications should write their code in anticipation of:
4413    ///
4414    /// - New values appearing in future releases of the client library, **and**
4415    /// - New values received dynamically, without application changes.
4416    ///
4417    /// Please consult the [Working with enums] section in the user guide for some
4418    /// guidelines.
4419    ///
4420    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4421    #[derive(Clone, Debug, PartialEq)]
4422    #[non_exhaustive]
4423    pub enum PublicKeyFormat {
4424        /// If the
4425        /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
4426        /// field is not specified:
4427        ///
4428        /// - For PQC algorithms, an error will be returned.
4429        /// - For non-PQC algorithms, the default format is PEM, and the field
4430        ///   [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
4431        ///
4432        /// Otherwise, the public key will be exported through the
4433        /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
4434        /// requested format.
4435        ///
4436        /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
4437        /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
4438        /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
4439        Unspecified,
4440        /// The returned public key will be encoded in PEM format.
4441        /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
4442        /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
4443        /// and [Textual Encoding of Subject Public Key Info]
4444        /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
4445        Pem,
4446        /// The returned public key will be encoded in DER format (the
4447        /// PrivateKeyInfo structure from RFC 5208).
4448        Der,
4449        /// This is supported only for PQC algorithms.
4450        /// The key material is returned in the format defined by NIST PQC
4451        /// standards (FIPS 203, FIPS 204, and FIPS 205).
4452        NistPqc,
4453        /// The returned public key is in raw bytes format defined in its standard
4454        /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
4455        XwingRawBytes,
4456        /// If set, the enum was initialized with an unknown value.
4457        ///
4458        /// Applications can examine the value using [PublicKeyFormat::value] or
4459        /// [PublicKeyFormat::name].
4460        UnknownValue(public_key_format::UnknownValue),
4461    }
4462
4463    #[doc(hidden)]
4464    pub mod public_key_format {
4465        #[allow(unused_imports)]
4466        use super::*;
4467        #[derive(Clone, Debug, PartialEq)]
4468        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4469    }
4470
4471    impl PublicKeyFormat {
4472        /// Gets the enum value.
4473        ///
4474        /// Returns `None` if the enum contains an unknown value deserialized from
4475        /// the string representation of enums.
4476        pub fn value(&self) -> std::option::Option<i32> {
4477            match self {
4478                Self::Unspecified => std::option::Option::Some(0),
4479                Self::Pem => std::option::Option::Some(1),
4480                Self::Der => std::option::Option::Some(2),
4481                Self::NistPqc => std::option::Option::Some(3),
4482                Self::XwingRawBytes => std::option::Option::Some(4),
4483                Self::UnknownValue(u) => u.0.value(),
4484            }
4485        }
4486
4487        /// Gets the enum value as a string.
4488        ///
4489        /// Returns `None` if the enum contains an unknown value deserialized from
4490        /// the integer representation of enums.
4491        pub fn name(&self) -> std::option::Option<&str> {
4492            match self {
4493                Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
4494                Self::Pem => std::option::Option::Some("PEM"),
4495                Self::Der => std::option::Option::Some("DER"),
4496                Self::NistPqc => std::option::Option::Some("NIST_PQC"),
4497                Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
4498                Self::UnknownValue(u) => u.0.name(),
4499            }
4500        }
4501    }
4502
4503    impl std::default::Default for PublicKeyFormat {
4504        fn default() -> Self {
4505            use std::convert::From;
4506            Self::from(0)
4507        }
4508    }
4509
4510    impl std::fmt::Display for PublicKeyFormat {
4511        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4512            wkt::internal::display_enum(f, self.name(), self.value())
4513        }
4514    }
4515
4516    impl std::convert::From<i32> for PublicKeyFormat {
4517        fn from(value: i32) -> Self {
4518            match value {
4519                0 => Self::Unspecified,
4520                1 => Self::Pem,
4521                2 => Self::Der,
4522                3 => Self::NistPqc,
4523                4 => Self::XwingRawBytes,
4524                _ => Self::UnknownValue(public_key_format::UnknownValue(
4525                    wkt::internal::UnknownEnumValue::Integer(value),
4526                )),
4527            }
4528        }
4529    }
4530
4531    impl std::convert::From<&str> for PublicKeyFormat {
4532        fn from(value: &str) -> Self {
4533            use std::string::ToString;
4534            match value {
4535                "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
4536                "PEM" => Self::Pem,
4537                "DER" => Self::Der,
4538                "NIST_PQC" => Self::NistPqc,
4539                "XWING_RAW_BYTES" => Self::XwingRawBytes,
4540                _ => Self::UnknownValue(public_key_format::UnknownValue(
4541                    wkt::internal::UnknownEnumValue::String(value.to_string()),
4542                )),
4543            }
4544        }
4545    }
4546
4547    impl serde::ser::Serialize for PublicKeyFormat {
4548        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4549        where
4550            S: serde::Serializer,
4551        {
4552            match self {
4553                Self::Unspecified => serializer.serialize_i32(0),
4554                Self::Pem => serializer.serialize_i32(1),
4555                Self::Der => serializer.serialize_i32(2),
4556                Self::NistPqc => serializer.serialize_i32(3),
4557                Self::XwingRawBytes => serializer.serialize_i32(4),
4558                Self::UnknownValue(u) => u.0.serialize(serializer),
4559            }
4560        }
4561    }
4562
4563    impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
4564        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4565        where
4566            D: serde::Deserializer<'de>,
4567        {
4568            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
4569                ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
4570            ))
4571        }
4572    }
4573}
4574
4575/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
4576/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
4577/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
4578/// key material, generated outside of Cloud KMS.
4579///
4580/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
4581/// generate a "wrapping key", which is a public/private key pair. You use the
4582/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
4583/// protect it during the import process. The nature of the wrapping key depends
4584/// on the choice of
4585/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
4586/// wrapping key generation is complete, the
4587/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
4588/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
4589/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
4590/// fetched public key can then be used to wrap your pre-existing key material.
4591///
4592/// Once the key material is wrapped, it can be imported into a new
4593/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
4594/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
4595/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
4596/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
4597/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
4598/// uses the private key portion of the wrapping key to unwrap the key material.
4599/// Only Cloud KMS has access to the private key.
4600///
4601/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
4602/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
4603/// any key material that was wrapped with the
4604/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
4605///
4606/// For more information, see
4607/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
4608///
4609/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4610/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4611/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4612/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
4613/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
4614/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
4615/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
4616/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
4617#[derive(Clone, Default, PartialEq)]
4618#[non_exhaustive]
4619pub struct ImportJob {
4620    /// Output only. The resource name for this
4621    /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
4622    /// `projects/*/locations/*/keyRings/*/importJobs/*`.
4623    ///
4624    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4625    pub name: std::string::String,
4626
4627    /// Required. Immutable. The wrapping method to be used for incoming key
4628    /// material.
4629    pub import_method: crate::model::import_job::ImportMethod,
4630
4631    /// Required. Immutable. The protection level of the
4632    /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
4633    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
4634    /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
4635    /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
4636    /// into.
4637    ///
4638    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4639    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
4640    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
4641    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4642    pub protection_level: crate::model::ProtectionLevel,
4643
4644    /// Output only. The time at which this
4645    /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
4646    ///
4647    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4648    pub create_time: std::option::Option<wkt::Timestamp>,
4649
4650    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
4651    /// material was generated.
4652    ///
4653    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4654    pub generate_time: std::option::Option<wkt::Timestamp>,
4655
4656    /// Output only. The time at which this
4657    /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
4658    /// can no longer be used to import key material.
4659    ///
4660    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4661    pub expire_time: std::option::Option<wkt::Timestamp>,
4662
4663    /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
4664    /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
4665    /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
4666    ///
4667    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4668    /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
4669    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
4670    pub expire_event_time: std::option::Option<wkt::Timestamp>,
4671
4672    /// Output only. The current state of the
4673    /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
4674    ///
4675    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4676    pub state: crate::model::import_job::ImportJobState,
4677
4678    /// Output only. The public key with which to wrap key material prior to
4679    /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
4680    /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
4681    ///
4682    /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
4683    /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
4684    pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
4685
4686    /// Output only. Statement that was generated and signed by the key creator
4687    /// (for example, an HSM) at key creation time. Use this statement to verify
4688    /// attributes of the key as stored on the HSM, independently of Google.
4689    /// Only present if the chosen
4690    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
4691    /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
4692    ///
4693    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
4694    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
4695    pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
4696
4697    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4698}
4699
4700impl ImportJob {
4701    pub fn new() -> Self {
4702        std::default::Default::default()
4703    }
4704
4705    /// Sets the value of [name][crate::model::ImportJob::name].
4706    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4707        self.name = v.into();
4708        self
4709    }
4710
4711    /// Sets the value of [import_method][crate::model::ImportJob::import_method].
4712    pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
4713        mut self,
4714        v: T,
4715    ) -> Self {
4716        self.import_method = v.into();
4717        self
4718    }
4719
4720    /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
4721    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
4722        mut self,
4723        v: T,
4724    ) -> Self {
4725        self.protection_level = v.into();
4726        self
4727    }
4728
4729    /// Sets the value of [create_time][crate::model::ImportJob::create_time].
4730    pub fn set_create_time<T>(mut self, v: T) -> Self
4731    where
4732        T: std::convert::Into<wkt::Timestamp>,
4733    {
4734        self.create_time = std::option::Option::Some(v.into());
4735        self
4736    }
4737
4738    /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
4739    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
4740    where
4741        T: std::convert::Into<wkt::Timestamp>,
4742    {
4743        self.create_time = v.map(|x| x.into());
4744        self
4745    }
4746
4747    /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
4748    pub fn set_generate_time<T>(mut self, v: T) -> Self
4749    where
4750        T: std::convert::Into<wkt::Timestamp>,
4751    {
4752        self.generate_time = std::option::Option::Some(v.into());
4753        self
4754    }
4755
4756    /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
4757    pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
4758    where
4759        T: std::convert::Into<wkt::Timestamp>,
4760    {
4761        self.generate_time = v.map(|x| x.into());
4762        self
4763    }
4764
4765    /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
4766    pub fn set_expire_time<T>(mut self, v: T) -> Self
4767    where
4768        T: std::convert::Into<wkt::Timestamp>,
4769    {
4770        self.expire_time = std::option::Option::Some(v.into());
4771        self
4772    }
4773
4774    /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
4775    pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
4776    where
4777        T: std::convert::Into<wkt::Timestamp>,
4778    {
4779        self.expire_time = v.map(|x| x.into());
4780        self
4781    }
4782
4783    /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
4784    pub fn set_expire_event_time<T>(mut self, v: T) -> Self
4785    where
4786        T: std::convert::Into<wkt::Timestamp>,
4787    {
4788        self.expire_event_time = std::option::Option::Some(v.into());
4789        self
4790    }
4791
4792    /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
4793    pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
4794    where
4795        T: std::convert::Into<wkt::Timestamp>,
4796    {
4797        self.expire_event_time = v.map(|x| x.into());
4798        self
4799    }
4800
4801    /// Sets the value of [state][crate::model::ImportJob::state].
4802    pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
4803        mut self,
4804        v: T,
4805    ) -> Self {
4806        self.state = v.into();
4807        self
4808    }
4809
4810    /// Sets the value of [public_key][crate::model::ImportJob::public_key].
4811    pub fn set_public_key<T>(mut self, v: T) -> Self
4812    where
4813        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
4814    {
4815        self.public_key = std::option::Option::Some(v.into());
4816        self
4817    }
4818
4819    /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
4820    pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
4821    where
4822        T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
4823    {
4824        self.public_key = v.map(|x| x.into());
4825        self
4826    }
4827
4828    /// Sets the value of [attestation][crate::model::ImportJob::attestation].
4829    pub fn set_attestation<T>(mut self, v: T) -> Self
4830    where
4831        T: std::convert::Into<crate::model::KeyOperationAttestation>,
4832    {
4833        self.attestation = std::option::Option::Some(v.into());
4834        self
4835    }
4836
4837    /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
4838    pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
4839    where
4840        T: std::convert::Into<crate::model::KeyOperationAttestation>,
4841    {
4842        self.attestation = v.map(|x| x.into());
4843        self
4844    }
4845}
4846
4847impl wkt::message::Message for ImportJob {
4848    fn typename() -> &'static str {
4849        "type.googleapis.com/google.cloud.kms.v1.ImportJob"
4850    }
4851}
4852
4853/// Defines additional types related to [ImportJob].
4854pub mod import_job {
4855    #[allow(unused_imports)]
4856    use super::*;
4857
4858    /// The public key component of the wrapping key. For details of the type of
4859    /// key this public key corresponds to, see the
4860    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
4861    ///
4862    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
4863    #[derive(Clone, Default, PartialEq)]
4864    #[non_exhaustive]
4865    pub struct WrappingPublicKey {
4866        /// The public key, encoded in PEM format. For more information, see the [RFC
4867        /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
4868        /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
4869        /// [Textual Encoding of Subject Public Key Info]
4870        /// (<https://tools.ietf.org/html/rfc7468#section-13>).
4871        pub pem: std::string::String,
4872
4873        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4874    }
4875
4876    impl WrappingPublicKey {
4877        pub fn new() -> Self {
4878            std::default::Default::default()
4879        }
4880
4881        /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
4882        pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4883            self.pem = v.into();
4884            self
4885        }
4886    }
4887
4888    impl wkt::message::Message for WrappingPublicKey {
4889        fn typename() -> &'static str {
4890            "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
4891        }
4892    }
4893
4894    /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
4895    /// key wrapping method chosen for this
4896    /// [ImportJob][google.cloud.kms.v1.ImportJob].
4897    ///
4898    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
4899    /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
4900    ///
4901    /// # Working with unknown values
4902    ///
4903    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4904    /// additional enum variants at any time. Adding new variants is not considered
4905    /// a breaking change. Applications should write their code in anticipation of:
4906    ///
4907    /// - New values appearing in future releases of the client library, **and**
4908    /// - New values received dynamically, without application changes.
4909    ///
4910    /// Please consult the [Working with enums] section in the user guide for some
4911    /// guidelines.
4912    ///
4913    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4914    #[derive(Clone, Debug, PartialEq)]
4915    #[non_exhaustive]
4916    pub enum ImportMethod {
4917        /// Not specified.
4918        Unspecified,
4919        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
4920        /// scheme defined in the PKCS #11 standard. In summary, this involves
4921        /// wrapping the raw key with an ephemeral AES key, and wrapping the
4922        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
4923        /// [RSA AES key wrap
4924        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
4925        RsaOaep3072Sha1Aes256,
4926        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
4927        /// scheme defined in the PKCS #11 standard. In summary, this involves
4928        /// wrapping the raw key with an ephemeral AES key, and wrapping the
4929        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
4930        /// [RSA AES key wrap
4931        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
4932        RsaOaep4096Sha1Aes256,
4933        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
4934        /// scheme defined in the PKCS #11 standard. In summary, this involves
4935        /// wrapping the raw key with an ephemeral AES key, and wrapping the
4936        /// ephemeral AES key with a 3072 bit RSA key. For more details, see
4937        /// [RSA AES key wrap
4938        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
4939        RsaOaep3072Sha256Aes256,
4940        /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
4941        /// scheme defined in the PKCS #11 standard. In summary, this involves
4942        /// wrapping the raw key with an ephemeral AES key, and wrapping the
4943        /// ephemeral AES key with a 4096 bit RSA key. For more details, see
4944        /// [RSA AES key wrap
4945        /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
4946        RsaOaep4096Sha256Aes256,
4947        /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
4948        /// key material to be imported is wrapped directly with the RSA key. Due
4949        /// to technical limitations of RSA wrapping, this method cannot be used to
4950        /// wrap RSA keys for import.
4951        RsaOaep3072Sha256,
4952        /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
4953        /// key material to be imported is wrapped directly with the RSA key. Due
4954        /// to technical limitations of RSA wrapping, this method cannot be used to
4955        /// wrap RSA keys for import.
4956        RsaOaep4096Sha256,
4957        /// If set, the enum was initialized with an unknown value.
4958        ///
4959        /// Applications can examine the value using [ImportMethod::value] or
4960        /// [ImportMethod::name].
4961        UnknownValue(import_method::UnknownValue),
4962    }
4963
4964    #[doc(hidden)]
4965    pub mod import_method {
4966        #[allow(unused_imports)]
4967        use super::*;
4968        #[derive(Clone, Debug, PartialEq)]
4969        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4970    }
4971
4972    impl ImportMethod {
4973        /// Gets the enum value.
4974        ///
4975        /// Returns `None` if the enum contains an unknown value deserialized from
4976        /// the string representation of enums.
4977        pub fn value(&self) -> std::option::Option<i32> {
4978            match self {
4979                Self::Unspecified => std::option::Option::Some(0),
4980                Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
4981                Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
4982                Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
4983                Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
4984                Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
4985                Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
4986                Self::UnknownValue(u) => u.0.value(),
4987            }
4988        }
4989
4990        /// Gets the enum value as a string.
4991        ///
4992        /// Returns `None` if the enum contains an unknown value deserialized from
4993        /// the integer representation of enums.
4994        pub fn name(&self) -> std::option::Option<&str> {
4995            match self {
4996                Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
4997                Self::RsaOaep3072Sha1Aes256 => {
4998                    std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
4999                }
5000                Self::RsaOaep4096Sha1Aes256 => {
5001                    std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
5002                }
5003                Self::RsaOaep3072Sha256Aes256 => {
5004                    std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
5005                }
5006                Self::RsaOaep4096Sha256Aes256 => {
5007                    std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
5008                }
5009                Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
5010                Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
5011                Self::UnknownValue(u) => u.0.name(),
5012            }
5013        }
5014    }
5015
5016    impl std::default::Default for ImportMethod {
5017        fn default() -> Self {
5018            use std::convert::From;
5019            Self::from(0)
5020        }
5021    }
5022
5023    impl std::fmt::Display for ImportMethod {
5024        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5025            wkt::internal::display_enum(f, self.name(), self.value())
5026        }
5027    }
5028
5029    impl std::convert::From<i32> for ImportMethod {
5030        fn from(value: i32) -> Self {
5031            match value {
5032                0 => Self::Unspecified,
5033                1 => Self::RsaOaep3072Sha1Aes256,
5034                2 => Self::RsaOaep4096Sha1Aes256,
5035                3 => Self::RsaOaep3072Sha256Aes256,
5036                4 => Self::RsaOaep4096Sha256Aes256,
5037                5 => Self::RsaOaep3072Sha256,
5038                6 => Self::RsaOaep4096Sha256,
5039                _ => Self::UnknownValue(import_method::UnknownValue(
5040                    wkt::internal::UnknownEnumValue::Integer(value),
5041                )),
5042            }
5043        }
5044    }
5045
5046    impl std::convert::From<&str> for ImportMethod {
5047        fn from(value: &str) -> Self {
5048            use std::string::ToString;
5049            match value {
5050                "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
5051                "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
5052                "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
5053                "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
5054                "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
5055                "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
5056                "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
5057                _ => Self::UnknownValue(import_method::UnknownValue(
5058                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5059                )),
5060            }
5061        }
5062    }
5063
5064    impl serde::ser::Serialize for ImportMethod {
5065        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5066        where
5067            S: serde::Serializer,
5068        {
5069            match self {
5070                Self::Unspecified => serializer.serialize_i32(0),
5071                Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
5072                Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
5073                Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
5074                Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
5075                Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
5076                Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
5077                Self::UnknownValue(u) => u.0.serialize(serializer),
5078            }
5079        }
5080    }
5081
5082    impl<'de> serde::de::Deserialize<'de> for ImportMethod {
5083        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5084        where
5085            D: serde::Deserializer<'de>,
5086        {
5087            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
5088                ".google.cloud.kms.v1.ImportJob.ImportMethod",
5089            ))
5090        }
5091    }
5092
5093    /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
5094    /// it can be used.
5095    ///
5096    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5097    ///
5098    /// # Working with unknown values
5099    ///
5100    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5101    /// additional enum variants at any time. Adding new variants is not considered
5102    /// a breaking change. Applications should write their code in anticipation of:
5103    ///
5104    /// - New values appearing in future releases of the client library, **and**
5105    /// - New values received dynamically, without application changes.
5106    ///
5107    /// Please consult the [Working with enums] section in the user guide for some
5108    /// guidelines.
5109    ///
5110    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5111    #[derive(Clone, Debug, PartialEq)]
5112    #[non_exhaustive]
5113    pub enum ImportJobState {
5114        /// Not specified.
5115        Unspecified,
5116        /// The wrapping key for this job is still being generated. It may not be
5117        /// used. Cloud KMS will automatically mark this job as
5118        /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
5119        /// the wrapping key is generated.
5120        ///
5121        /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
5122        PendingGeneration,
5123        /// This job may be used in
5124        /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
5125        /// and
5126        /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
5127        /// requests.
5128        ///
5129        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
5130        /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
5131        Active,
5132        /// This job can no longer be used and may not leave this state once entered.
5133        Expired,
5134        /// If set, the enum was initialized with an unknown value.
5135        ///
5136        /// Applications can examine the value using [ImportJobState::value] or
5137        /// [ImportJobState::name].
5138        UnknownValue(import_job_state::UnknownValue),
5139    }
5140
5141    #[doc(hidden)]
5142    pub mod import_job_state {
5143        #[allow(unused_imports)]
5144        use super::*;
5145        #[derive(Clone, Debug, PartialEq)]
5146        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5147    }
5148
5149    impl ImportJobState {
5150        /// Gets the enum value.
5151        ///
5152        /// Returns `None` if the enum contains an unknown value deserialized from
5153        /// the string representation of enums.
5154        pub fn value(&self) -> std::option::Option<i32> {
5155            match self {
5156                Self::Unspecified => std::option::Option::Some(0),
5157                Self::PendingGeneration => std::option::Option::Some(1),
5158                Self::Active => std::option::Option::Some(2),
5159                Self::Expired => std::option::Option::Some(3),
5160                Self::UnknownValue(u) => u.0.value(),
5161            }
5162        }
5163
5164        /// Gets the enum value as a string.
5165        ///
5166        /// Returns `None` if the enum contains an unknown value deserialized from
5167        /// the integer representation of enums.
5168        pub fn name(&self) -> std::option::Option<&str> {
5169            match self {
5170                Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
5171                Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
5172                Self::Active => std::option::Option::Some("ACTIVE"),
5173                Self::Expired => std::option::Option::Some("EXPIRED"),
5174                Self::UnknownValue(u) => u.0.name(),
5175            }
5176        }
5177    }
5178
5179    impl std::default::Default for ImportJobState {
5180        fn default() -> Self {
5181            use std::convert::From;
5182            Self::from(0)
5183        }
5184    }
5185
5186    impl std::fmt::Display for ImportJobState {
5187        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5188            wkt::internal::display_enum(f, self.name(), self.value())
5189        }
5190    }
5191
5192    impl std::convert::From<i32> for ImportJobState {
5193        fn from(value: i32) -> Self {
5194            match value {
5195                0 => Self::Unspecified,
5196                1 => Self::PendingGeneration,
5197                2 => Self::Active,
5198                3 => Self::Expired,
5199                _ => Self::UnknownValue(import_job_state::UnknownValue(
5200                    wkt::internal::UnknownEnumValue::Integer(value),
5201                )),
5202            }
5203        }
5204    }
5205
5206    impl std::convert::From<&str> for ImportJobState {
5207        fn from(value: &str) -> Self {
5208            use std::string::ToString;
5209            match value {
5210                "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
5211                "PENDING_GENERATION" => Self::PendingGeneration,
5212                "ACTIVE" => Self::Active,
5213                "EXPIRED" => Self::Expired,
5214                _ => Self::UnknownValue(import_job_state::UnknownValue(
5215                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5216                )),
5217            }
5218        }
5219    }
5220
5221    impl serde::ser::Serialize for ImportJobState {
5222        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5223        where
5224            S: serde::Serializer,
5225        {
5226            match self {
5227                Self::Unspecified => serializer.serialize_i32(0),
5228                Self::PendingGeneration => serializer.serialize_i32(1),
5229                Self::Active => serializer.serialize_i32(2),
5230                Self::Expired => serializer.serialize_i32(3),
5231                Self::UnknownValue(u) => u.0.serialize(serializer),
5232            }
5233        }
5234    }
5235
5236    impl<'de> serde::de::Deserialize<'de> for ImportJobState {
5237        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5238        where
5239            D: serde::Deserializer<'de>,
5240        {
5241            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
5242                ".google.cloud.kms.v1.ImportJob.ImportJobState",
5243            ))
5244        }
5245    }
5246}
5247
5248/// ExternalProtectionLevelOptions stores a group of additional fields for
5249/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
5250/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
5251/// protection level and
5252/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
5253/// levels.
5254///
5255/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5256/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
5257/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
5258#[derive(Clone, Default, PartialEq)]
5259#[non_exhaustive]
5260pub struct ExternalProtectionLevelOptions {
5261    /// The URI for an external resource that this
5262    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
5263    ///
5264    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5265    pub external_key_uri: std::string::String,
5266
5267    /// The path to the external key material on the EKM when using
5268    /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
5269    /// this field instead of external_key_uri when using an
5270    /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
5271    ///
5272    /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
5273    pub ekm_connection_key_path: std::string::String,
5274
5275    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5276}
5277
5278impl ExternalProtectionLevelOptions {
5279    pub fn new() -> Self {
5280        std::default::Default::default()
5281    }
5282
5283    /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
5284    pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
5285        mut self,
5286        v: T,
5287    ) -> Self {
5288        self.external_key_uri = v.into();
5289        self
5290    }
5291
5292    /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
5293    pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
5294        mut self,
5295        v: T,
5296    ) -> Self {
5297        self.ekm_connection_key_path = v.into();
5298        self
5299    }
5300}
5301
5302impl wkt::message::Message for ExternalProtectionLevelOptions {
5303    fn typename() -> &'static str {
5304        "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
5305    }
5306}
5307
5308/// A
5309/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
5310/// specifies zero or more allowed
5311/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
5312/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey].
5313///
5314/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
5315/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5316/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
5317#[derive(Clone, Default, PartialEq)]
5318#[non_exhaustive]
5319pub struct KeyAccessJustificationsPolicy {
5320    /// The list of allowed reasons for access to a
5321    /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Zero allowed access reasons
5322    /// means all encrypt, decrypt, and sign operations for the
5323    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with this policy will
5324    /// fail.
5325    ///
5326    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5327    pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
5328
5329    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5330}
5331
5332impl KeyAccessJustificationsPolicy {
5333    pub fn new() -> Self {
5334        std::default::Default::default()
5335    }
5336
5337    /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
5338    pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
5339    where
5340        T: std::iter::IntoIterator<Item = V>,
5341        V: std::convert::Into<crate::model::AccessReason>,
5342    {
5343        use std::iter::Iterator;
5344        self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
5345        self
5346    }
5347}
5348
5349impl wkt::message::Message for KeyAccessJustificationsPolicy {
5350    fn typename() -> &'static str {
5351        "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
5352    }
5353}
5354
5355/// Request message for
5356/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
5357///
5358/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
5359#[derive(Clone, Default, PartialEq)]
5360#[non_exhaustive]
5361pub struct ListKeyRingsRequest {
5362    /// Required. The resource name of the location associated with the
5363    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
5364    /// `projects/*/locations/*`.
5365    ///
5366    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
5367    pub parent: std::string::String,
5368
5369    /// Optional. Optional limit on the number of
5370    /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
5371    /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
5372    /// including the
5373    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
5374    /// in a subsequent request.  If unspecified, the server will pick an
5375    /// appropriate default.
5376    ///
5377    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
5378    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
5379    pub page_size: i32,
5380
5381    /// Optional. Optional pagination token, returned earlier via
5382    /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
5383    ///
5384    /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
5385    pub page_token: std::string::String,
5386
5387    /// Optional. Only include resources that match the filter in the response. For
5388    /// more information, see
5389    /// [Sorting and filtering list
5390    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5391    pub filter: std::string::String,
5392
5393    /// Optional. Specify how the results should be sorted. If not specified, the
5394    /// results will be sorted in the default order.  For more information, see
5395    /// [Sorting and filtering list
5396    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5397    pub order_by: std::string::String,
5398
5399    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5400}
5401
5402impl ListKeyRingsRequest {
5403    pub fn new() -> Self {
5404        std::default::Default::default()
5405    }
5406
5407    /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
5408    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5409        self.parent = v.into();
5410        self
5411    }
5412
5413    /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
5414    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5415        self.page_size = v.into();
5416        self
5417    }
5418
5419    /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
5420    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5421        self.page_token = v.into();
5422        self
5423    }
5424
5425    /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
5426    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5427        self.filter = v.into();
5428        self
5429    }
5430
5431    /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
5432    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5433        self.order_by = v.into();
5434        self
5435    }
5436}
5437
5438impl wkt::message::Message for ListKeyRingsRequest {
5439    fn typename() -> &'static str {
5440        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
5441    }
5442}
5443
5444/// Request message for
5445/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
5446///
5447/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
5448#[derive(Clone, Default, PartialEq)]
5449#[non_exhaustive]
5450pub struct ListCryptoKeysRequest {
5451    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
5452    /// to list, in the format `projects/*/locations/*/keyRings/*`.
5453    ///
5454    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
5455    pub parent: std::string::String,
5456
5457    /// Optional. Optional limit on the number of
5458    /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
5459    /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
5460    /// obtained by including the
5461    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
5462    /// in a subsequent request.  If unspecified, the server will pick an
5463    /// appropriate default.
5464    ///
5465    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5466    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
5467    pub page_size: i32,
5468
5469    /// Optional. Optional pagination token, returned earlier via
5470    /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
5471    ///
5472    /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
5473    pub page_token: std::string::String,
5474
5475    /// The fields of the primary version to include in the response.
5476    pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
5477
5478    /// Optional. Only include resources that match the filter in the response. For
5479    /// more information, see
5480    /// [Sorting and filtering list
5481    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5482    pub filter: std::string::String,
5483
5484    /// Optional. Specify how the results should be sorted. If not specified, the
5485    /// results will be sorted in the default order. For more information, see
5486    /// [Sorting and filtering list
5487    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5488    pub order_by: std::string::String,
5489
5490    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5491}
5492
5493impl ListCryptoKeysRequest {
5494    pub fn new() -> Self {
5495        std::default::Default::default()
5496    }
5497
5498    /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
5499    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5500        self.parent = v.into();
5501        self
5502    }
5503
5504    /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
5505    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5506        self.page_size = v.into();
5507        self
5508    }
5509
5510    /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
5511    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5512        self.page_token = v.into();
5513        self
5514    }
5515
5516    /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
5517    pub fn set_version_view<
5518        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
5519    >(
5520        mut self,
5521        v: T,
5522    ) -> Self {
5523        self.version_view = v.into();
5524        self
5525    }
5526
5527    /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
5528    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5529        self.filter = v.into();
5530        self
5531    }
5532
5533    /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
5534    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5535        self.order_by = v.into();
5536        self
5537    }
5538}
5539
5540impl wkt::message::Message for ListCryptoKeysRequest {
5541    fn typename() -> &'static str {
5542        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
5543    }
5544}
5545
5546/// Request message for
5547/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
5548///
5549/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
5550#[derive(Clone, Default, PartialEq)]
5551#[non_exhaustive]
5552pub struct ListCryptoKeyVersionsRequest {
5553    /// Required. The resource name of the
5554    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
5555    /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
5556    ///
5557    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5558    pub parent: std::string::String,
5559
5560    /// Optional. Optional limit on the number of
5561    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
5562    /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
5563    /// can subsequently be obtained by including the
5564    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
5565    /// in a subsequent request. If unspecified, the server will pick an
5566    /// appropriate default.
5567    ///
5568    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5569    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
5570    pub page_size: i32,
5571
5572    /// Optional. Optional pagination token, returned earlier via
5573    /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
5574    ///
5575    /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
5576    pub page_token: std::string::String,
5577
5578    /// The fields to include in the response.
5579    pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
5580
5581    /// Optional. Only include resources that match the filter in the response. For
5582    /// more information, see
5583    /// [Sorting and filtering list
5584    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5585    pub filter: std::string::String,
5586
5587    /// Optional. Specify how the results should be sorted. If not specified, the
5588    /// results will be sorted in the default order. For more information, see
5589    /// [Sorting and filtering list
5590    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5591    pub order_by: std::string::String,
5592
5593    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5594}
5595
5596impl ListCryptoKeyVersionsRequest {
5597    pub fn new() -> Self {
5598        std::default::Default::default()
5599    }
5600
5601    /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
5602    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5603        self.parent = v.into();
5604        self
5605    }
5606
5607    /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
5608    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5609        self.page_size = v.into();
5610        self
5611    }
5612
5613    /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
5614    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5615        self.page_token = v.into();
5616        self
5617    }
5618
5619    /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
5620    pub fn set_view<
5621        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
5622    >(
5623        mut self,
5624        v: T,
5625    ) -> Self {
5626        self.view = v.into();
5627        self
5628    }
5629
5630    /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
5631    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5632        self.filter = v.into();
5633        self
5634    }
5635
5636    /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
5637    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5638        self.order_by = v.into();
5639        self
5640    }
5641}
5642
5643impl wkt::message::Message for ListCryptoKeyVersionsRequest {
5644    fn typename() -> &'static str {
5645        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
5646    }
5647}
5648
5649/// Request message for
5650/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
5651///
5652/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
5653#[derive(Clone, Default, PartialEq)]
5654#[non_exhaustive]
5655pub struct ListImportJobsRequest {
5656    /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
5657    /// to list, in the format `projects/*/locations/*/keyRings/*`.
5658    ///
5659    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
5660    pub parent: std::string::String,
5661
5662    /// Optional. Optional limit on the number of
5663    /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
5664    /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
5665    /// obtained by including the
5666    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
5667    /// in a subsequent request. If unspecified, the server will pick an
5668    /// appropriate default.
5669    ///
5670    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5671    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
5672    pub page_size: i32,
5673
5674    /// Optional. Optional pagination token, returned earlier via
5675    /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
5676    ///
5677    /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
5678    pub page_token: std::string::String,
5679
5680    /// Optional. Only include resources that match the filter in the response. For
5681    /// more information, see
5682    /// [Sorting and filtering list
5683    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5684    pub filter: std::string::String,
5685
5686    /// Optional. Specify how the results should be sorted. If not specified, the
5687    /// results will be sorted in the default order. For more information, see
5688    /// [Sorting and filtering list
5689    /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5690    pub order_by: std::string::String,
5691
5692    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5693}
5694
5695impl ListImportJobsRequest {
5696    pub fn new() -> Self {
5697        std::default::Default::default()
5698    }
5699
5700    /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
5701    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5702        self.parent = v.into();
5703        self
5704    }
5705
5706    /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
5707    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5708        self.page_size = v.into();
5709        self
5710    }
5711
5712    /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
5713    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5714        self.page_token = v.into();
5715        self
5716    }
5717
5718    /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
5719    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5720        self.filter = v.into();
5721        self
5722    }
5723
5724    /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
5725    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5726        self.order_by = v.into();
5727        self
5728    }
5729}
5730
5731impl wkt::message::Message for ListImportJobsRequest {
5732    fn typename() -> &'static str {
5733        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
5734    }
5735}
5736
5737/// Response message for
5738/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
5739///
5740/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
5741#[derive(Clone, Default, PartialEq)]
5742#[non_exhaustive]
5743pub struct ListKeyRingsResponse {
5744    /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
5745    ///
5746    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
5747    pub key_rings: std::vec::Vec<crate::model::KeyRing>,
5748
5749    /// A token to retrieve next page of results. Pass this value in
5750    /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
5751    /// to retrieve the next page of results.
5752    ///
5753    /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
5754    pub next_page_token: std::string::String,
5755
5756    /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
5757    /// the query.
5758    ///
5759    /// This field is not populated if
5760    /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
5761    /// is applied.
5762    ///
5763    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
5764    /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
5765    pub total_size: i32,
5766
5767    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5768}
5769
5770impl ListKeyRingsResponse {
5771    pub fn new() -> Self {
5772        std::default::Default::default()
5773    }
5774
5775    /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
5776    pub fn set_key_rings<T, V>(mut self, v: T) -> Self
5777    where
5778        T: std::iter::IntoIterator<Item = V>,
5779        V: std::convert::Into<crate::model::KeyRing>,
5780    {
5781        use std::iter::Iterator;
5782        self.key_rings = v.into_iter().map(|i| i.into()).collect();
5783        self
5784    }
5785
5786    /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
5787    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5788        self.next_page_token = v.into();
5789        self
5790    }
5791
5792    /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
5793    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5794        self.total_size = v.into();
5795        self
5796    }
5797}
5798
5799impl wkt::message::Message for ListKeyRingsResponse {
5800    fn typename() -> &'static str {
5801        "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
5802    }
5803}
5804
5805#[doc(hidden)]
5806impl gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
5807    type PageItem = crate::model::KeyRing;
5808
5809    fn items(self) -> std::vec::Vec<Self::PageItem> {
5810        self.key_rings
5811    }
5812
5813    fn next_page_token(&self) -> std::string::String {
5814        use std::clone::Clone;
5815        self.next_page_token.clone()
5816    }
5817}
5818
5819/// Response message for
5820/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
5821///
5822/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
5823#[derive(Clone, Default, PartialEq)]
5824#[non_exhaustive]
5825pub struct ListCryptoKeysResponse {
5826    /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
5827    ///
5828    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5829    pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
5830
5831    /// A token to retrieve next page of results. Pass this value in
5832    /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
5833    /// to retrieve the next page of results.
5834    ///
5835    /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
5836    pub next_page_token: std::string::String,
5837
5838    /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
5839    /// matched the query.
5840    ///
5841    /// This field is not populated if
5842    /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
5843    /// is applied.
5844    ///
5845    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5846    /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
5847    pub total_size: i32,
5848
5849    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5850}
5851
5852impl ListCryptoKeysResponse {
5853    pub fn new() -> Self {
5854        std::default::Default::default()
5855    }
5856
5857    /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
5858    pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
5859    where
5860        T: std::iter::IntoIterator<Item = V>,
5861        V: std::convert::Into<crate::model::CryptoKey>,
5862    {
5863        use std::iter::Iterator;
5864        self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
5865        self
5866    }
5867
5868    /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
5869    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5870        self.next_page_token = v.into();
5871        self
5872    }
5873
5874    /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
5875    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5876        self.total_size = v.into();
5877        self
5878    }
5879}
5880
5881impl wkt::message::Message for ListCryptoKeysResponse {
5882    fn typename() -> &'static str {
5883        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
5884    }
5885}
5886
5887#[doc(hidden)]
5888impl gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
5889    type PageItem = crate::model::CryptoKey;
5890
5891    fn items(self) -> std::vec::Vec<Self::PageItem> {
5892        self.crypto_keys
5893    }
5894
5895    fn next_page_token(&self) -> std::string::String {
5896        use std::clone::Clone;
5897        self.next_page_token.clone()
5898    }
5899}
5900
5901/// Response message for
5902/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
5903///
5904/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
5905#[derive(Clone, Default, PartialEq)]
5906#[non_exhaustive]
5907pub struct ListCryptoKeyVersionsResponse {
5908    /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
5909    ///
5910    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5911    pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
5912
5913    /// A token to retrieve next page of results. Pass this value in
5914    /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
5915    /// to retrieve the next page of results.
5916    ///
5917    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
5918    pub next_page_token: std::string::String,
5919
5920    /// The total number of
5921    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
5922    /// query.
5923    ///
5924    /// This field is not populated if
5925    /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
5926    /// is applied.
5927    ///
5928    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
5929    /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
5930    pub total_size: i32,
5931
5932    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5933}
5934
5935impl ListCryptoKeyVersionsResponse {
5936    pub fn new() -> Self {
5937        std::default::Default::default()
5938    }
5939
5940    /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
5941    pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
5942    where
5943        T: std::iter::IntoIterator<Item = V>,
5944        V: std::convert::Into<crate::model::CryptoKeyVersion>,
5945    {
5946        use std::iter::Iterator;
5947        self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
5948        self
5949    }
5950
5951    /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
5952    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5953        self.next_page_token = v.into();
5954        self
5955    }
5956
5957    /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
5958    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5959        self.total_size = v.into();
5960        self
5961    }
5962}
5963
5964impl wkt::message::Message for ListCryptoKeyVersionsResponse {
5965    fn typename() -> &'static str {
5966        "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
5967    }
5968}
5969
5970#[doc(hidden)]
5971impl gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
5972    type PageItem = crate::model::CryptoKeyVersion;
5973
5974    fn items(self) -> std::vec::Vec<Self::PageItem> {
5975        self.crypto_key_versions
5976    }
5977
5978    fn next_page_token(&self) -> std::string::String {
5979        use std::clone::Clone;
5980        self.next_page_token.clone()
5981    }
5982}
5983
5984/// Response message for
5985/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
5986///
5987/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
5988#[derive(Clone, Default, PartialEq)]
5989#[non_exhaustive]
5990pub struct ListImportJobsResponse {
5991    /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
5992    ///
5993    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
5994    pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
5995
5996    /// A token to retrieve next page of results. Pass this value in
5997    /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
5998    /// to retrieve the next page of results.
5999    ///
6000    /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
6001    pub next_page_token: std::string::String,
6002
6003    /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
6004    /// matched the query.
6005    ///
6006    /// This field is not populated if
6007    /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
6008    /// is applied.
6009    ///
6010    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6011    /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
6012    pub total_size: i32,
6013
6014    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6015}
6016
6017impl ListImportJobsResponse {
6018    pub fn new() -> Self {
6019        std::default::Default::default()
6020    }
6021
6022    /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
6023    pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
6024    where
6025        T: std::iter::IntoIterator<Item = V>,
6026        V: std::convert::Into<crate::model::ImportJob>,
6027    {
6028        use std::iter::Iterator;
6029        self.import_jobs = v.into_iter().map(|i| i.into()).collect();
6030        self
6031    }
6032
6033    /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
6034    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6035        self.next_page_token = v.into();
6036        self
6037    }
6038
6039    /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
6040    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6041        self.total_size = v.into();
6042        self
6043    }
6044}
6045
6046impl wkt::message::Message for ListImportJobsResponse {
6047    fn typename() -> &'static str {
6048        "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
6049    }
6050}
6051
6052#[doc(hidden)]
6053impl gax::paginator::internal::PageableResponse for ListImportJobsResponse {
6054    type PageItem = crate::model::ImportJob;
6055
6056    fn items(self) -> std::vec::Vec<Self::PageItem> {
6057        self.import_jobs
6058    }
6059
6060    fn next_page_token(&self) -> std::string::String {
6061        use std::clone::Clone;
6062        self.next_page_token.clone()
6063    }
6064}
6065
6066/// Request message for
6067/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
6068///
6069/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
6070#[derive(Clone, Default, PartialEq)]
6071#[non_exhaustive]
6072pub struct GetKeyRingRequest {
6073    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
6074    /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
6075    ///
6076    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6077    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
6078    pub name: std::string::String,
6079
6080    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6081}
6082
6083impl GetKeyRingRequest {
6084    pub fn new() -> Self {
6085        std::default::Default::default()
6086    }
6087
6088    /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
6089    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6090        self.name = v.into();
6091        self
6092    }
6093}
6094
6095impl wkt::message::Message for GetKeyRingRequest {
6096    fn typename() -> &'static str {
6097        "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
6098    }
6099}
6100
6101/// Request message for
6102/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
6103///
6104/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
6105#[derive(Clone, Default, PartialEq)]
6106#[non_exhaustive]
6107pub struct GetCryptoKeyRequest {
6108    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
6109    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
6110    ///
6111    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6112    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
6113    pub name: std::string::String,
6114
6115    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6116}
6117
6118impl GetCryptoKeyRequest {
6119    pub fn new() -> Self {
6120        std::default::Default::default()
6121    }
6122
6123    /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
6124    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6125        self.name = v.into();
6126        self
6127    }
6128}
6129
6130impl wkt::message::Message for GetCryptoKeyRequest {
6131    fn typename() -> &'static str {
6132        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
6133    }
6134}
6135
6136/// Request message for
6137/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
6138///
6139/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
6140#[derive(Clone, Default, PartialEq)]
6141#[non_exhaustive]
6142pub struct GetCryptoKeyVersionRequest {
6143    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
6144    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
6145    ///
6146    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6147    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
6148    pub name: std::string::String,
6149
6150    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6151}
6152
6153impl GetCryptoKeyVersionRequest {
6154    pub fn new() -> Self {
6155        std::default::Default::default()
6156    }
6157
6158    /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
6159    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6160        self.name = v.into();
6161        self
6162    }
6163}
6164
6165impl wkt::message::Message for GetCryptoKeyVersionRequest {
6166    fn typename() -> &'static str {
6167        "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
6168    }
6169}
6170
6171/// Request message for
6172/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6173///
6174/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6175#[derive(Clone, Default, PartialEq)]
6176#[non_exhaustive]
6177pub struct GetPublicKeyRequest {
6178    /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
6179    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
6180    ///
6181    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6182    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
6183    pub name: std::string::String,
6184
6185    /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
6186    /// by the user. This field is required for PQC algorithms. If specified, the
6187    /// public key will be exported through the
6188    /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
6189    /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
6190    /// field will be populated for non-PQC algorithms, and an error will be
6191    /// returned for PQC algorithms.
6192    ///
6193    /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
6194    /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
6195    /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
6196    pub public_key_format: crate::model::public_key::PublicKeyFormat,
6197
6198    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6199}
6200
6201impl GetPublicKeyRequest {
6202    pub fn new() -> Self {
6203        std::default::Default::default()
6204    }
6205
6206    /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
6207    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6208        self.name = v.into();
6209        self
6210    }
6211
6212    /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
6213    pub fn set_public_key_format<
6214        T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
6215    >(
6216        mut self,
6217        v: T,
6218    ) -> Self {
6219        self.public_key_format = v.into();
6220        self
6221    }
6222}
6223
6224impl wkt::message::Message for GetPublicKeyRequest {
6225    fn typename() -> &'static str {
6226        "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
6227    }
6228}
6229
6230/// Request message for
6231/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
6232///
6233/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
6234#[derive(Clone, Default, PartialEq)]
6235#[non_exhaustive]
6236pub struct GetImportJobRequest {
6237    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
6238    /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
6239    ///
6240    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6241    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
6242    pub name: std::string::String,
6243
6244    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6245}
6246
6247impl GetImportJobRequest {
6248    pub fn new() -> Self {
6249        std::default::Default::default()
6250    }
6251
6252    /// Sets the value of [name][crate::model::GetImportJobRequest::name].
6253    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6254        self.name = v.into();
6255        self
6256    }
6257}
6258
6259impl wkt::message::Message for GetImportJobRequest {
6260    fn typename() -> &'static str {
6261        "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
6262    }
6263}
6264
6265/// Request message for
6266/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
6267///
6268/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
6269#[derive(Clone, Default, PartialEq)]
6270#[non_exhaustive]
6271pub struct CreateKeyRingRequest {
6272    /// Required. The resource name of the location associated with the
6273    /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
6274    /// `projects/*/locations/*`.
6275    ///
6276    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6277    pub parent: std::string::String,
6278
6279    /// Required. It must be unique within a location and match the regular
6280    /// expression `[a-zA-Z0-9_-]{1,63}`
6281    pub key_ring_id: std::string::String,
6282
6283    /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
6284    /// values.
6285    ///
6286    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6287    pub key_ring: std::option::Option<crate::model::KeyRing>,
6288
6289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6290}
6291
6292impl CreateKeyRingRequest {
6293    pub fn new() -> Self {
6294        std::default::Default::default()
6295    }
6296
6297    /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
6298    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6299        self.parent = v.into();
6300        self
6301    }
6302
6303    /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
6304    pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6305        self.key_ring_id = v.into();
6306        self
6307    }
6308
6309    /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
6310    pub fn set_key_ring<T>(mut self, v: T) -> Self
6311    where
6312        T: std::convert::Into<crate::model::KeyRing>,
6313    {
6314        self.key_ring = std::option::Option::Some(v.into());
6315        self
6316    }
6317
6318    /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
6319    pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
6320    where
6321        T: std::convert::Into<crate::model::KeyRing>,
6322    {
6323        self.key_ring = v.map(|x| x.into());
6324        self
6325    }
6326}
6327
6328impl wkt::message::Message for CreateKeyRingRequest {
6329    fn typename() -> &'static str {
6330        "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
6331    }
6332}
6333
6334/// Request message for
6335/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
6336///
6337/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
6338#[derive(Clone, Default, PartialEq)]
6339#[non_exhaustive]
6340pub struct CreateCryptoKeyRequest {
6341    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
6342    /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6343    ///
6344    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6345    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
6346    pub parent: std::string::String,
6347
6348    /// Required. It must be unique within a KeyRing and match the regular
6349    /// expression `[a-zA-Z0-9_-]{1,63}`
6350    pub crypto_key_id: std::string::String,
6351
6352    /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
6353    /// values.
6354    ///
6355    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6356    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
6357
6358    /// If set to true, the request will create a
6359    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
6360    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
6361    /// manually call
6362    /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6363    /// or
6364    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
6365    /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6366    ///
6367    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6368    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6369    /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6370    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
6371    pub skip_initial_version_creation: bool,
6372
6373    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6374}
6375
6376impl CreateCryptoKeyRequest {
6377    pub fn new() -> Self {
6378        std::default::Default::default()
6379    }
6380
6381    /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
6382    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6383        self.parent = v.into();
6384        self
6385    }
6386
6387    /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
6388    pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6389        self.crypto_key_id = v.into();
6390        self
6391    }
6392
6393    /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
6394    pub fn set_crypto_key<T>(mut self, v: T) -> Self
6395    where
6396        T: std::convert::Into<crate::model::CryptoKey>,
6397    {
6398        self.crypto_key = std::option::Option::Some(v.into());
6399        self
6400    }
6401
6402    /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
6403    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
6404    where
6405        T: std::convert::Into<crate::model::CryptoKey>,
6406    {
6407        self.crypto_key = v.map(|x| x.into());
6408        self
6409    }
6410
6411    /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
6412    pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6413        self.skip_initial_version_creation = v.into();
6414        self
6415    }
6416}
6417
6418impl wkt::message::Message for CreateCryptoKeyRequest {
6419    fn typename() -> &'static str {
6420        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
6421    }
6422}
6423
6424/// Request message for
6425/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
6426///
6427/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6428#[derive(Clone, Default, PartialEq)]
6429#[non_exhaustive]
6430pub struct CreateCryptoKeyVersionRequest {
6431    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
6432    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
6433    /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
6434    ///
6435    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6436    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
6437    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6438    pub parent: std::string::String,
6439
6440    /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
6441    /// initial field values.
6442    ///
6443    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6444    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
6445
6446    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6447}
6448
6449impl CreateCryptoKeyVersionRequest {
6450    pub fn new() -> Self {
6451        std::default::Default::default()
6452    }
6453
6454    /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
6455    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6456        self.parent = v.into();
6457        self
6458    }
6459
6460    /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
6461    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
6462    where
6463        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6464    {
6465        self.crypto_key_version = std::option::Option::Some(v.into());
6466        self
6467    }
6468
6469    /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
6470    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
6471    where
6472        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6473    {
6474        self.crypto_key_version = v.map(|x| x.into());
6475        self
6476    }
6477}
6478
6479impl wkt::message::Message for CreateCryptoKeyVersionRequest {
6480    fn typename() -> &'static str {
6481        "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
6482    }
6483}
6484
6485/// Request message for
6486/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
6487///
6488/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
6489#[derive(Clone, Default, PartialEq)]
6490#[non_exhaustive]
6491pub struct ImportCryptoKeyVersionRequest {
6492    /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
6493    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
6494    ///
6495    /// The create permission is only required on this key when creating a new
6496    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
6497    ///
6498    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6499    /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
6500    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6501    pub parent: std::string::String,
6502
6503    /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
6504    /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
6505    /// target for an import operation. If this field is not present, a new
6506    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
6507    /// supplied key material is created.
6508    ///
6509    /// If this field is present, the supplied key material is imported into
6510    /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
6511    /// import into an existing
6512    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
6513    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
6514    /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
6515    /// have been previously created via
6516    /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
6517    /// and be in
6518    /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
6519    /// or
6520    /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
6521    /// state. The key material and algorithm must match the previous
6522    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
6523    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
6524    /// key material.
6525    ///
6526    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6527    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6528    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
6529    /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
6530    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
6531    /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
6532    pub crypto_key_version: std::string::String,
6533
6534    /// Required. The
6535    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
6536    /// of the key being imported. This does not need to match the
6537    /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
6538    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
6539    ///
6540    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6541    /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
6542    /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
6543    pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
6544
6545    /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
6546    /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
6547    /// material.
6548    ///
6549    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6550    /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
6551    pub import_job: std::string::String,
6552
6553    /// Optional. The wrapped key material to import.
6554    ///
6555    /// Before wrapping, key material must be formatted. If importing symmetric key
6556    /// material, the expected key material format is plain bytes. If importing
6557    /// asymmetric key material, the expected key material format is PKCS#8-encoded
6558    /// DER (the PrivateKeyInfo structure from RFC 5208).
6559    ///
6560    /// When wrapping with import methods
6561    /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
6562    /// or
6563    /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
6564    /// or
6565    /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
6566    /// or
6567    /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
6568    ///
6569    /// this field must contain the concatenation of:
6570    ///
6571    /// This format is the same as the format produced by PKCS#11 mechanism
6572    /// CKM_RSA_AES_KEY_WRAP.
6573    ///
6574    /// When wrapping with import methods
6575    /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
6576    /// or
6577    /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
6578    ///
6579    /// this field must contain the formatted key to be imported, wrapped with the
6580    /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
6581    /// with SHA-256, MGF1 with SHA-256, and an empty label.
6582    ///
6583    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
6584    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
6585    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
6586    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
6587    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
6588    /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
6589    /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
6590    pub wrapped_key: ::bytes::Bytes,
6591
6592    /// This field is legacy. Use the field
6593    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
6594    /// instead.
6595    ///
6596    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
6597    pub wrapped_key_material:
6598        std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
6599
6600    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6601}
6602
6603impl ImportCryptoKeyVersionRequest {
6604    pub fn new() -> Self {
6605        std::default::Default::default()
6606    }
6607
6608    /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
6609    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6610        self.parent = v.into();
6611        self
6612    }
6613
6614    /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
6615    pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
6616        mut self,
6617        v: T,
6618    ) -> Self {
6619        self.crypto_key_version = v.into();
6620        self
6621    }
6622
6623    /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
6624    pub fn set_algorithm<
6625        T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
6626    >(
6627        mut self,
6628        v: T,
6629    ) -> Self {
6630        self.algorithm = v.into();
6631        self
6632    }
6633
6634    /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
6635    pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6636        self.import_job = v.into();
6637        self
6638    }
6639
6640    /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
6641    pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6642        self.wrapped_key = v.into();
6643        self
6644    }
6645
6646    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
6647    ///
6648    /// Note that all the setters affecting `wrapped_key_material` are mutually
6649    /// exclusive.
6650    pub fn set_wrapped_key_material<
6651        T: std::convert::Into<
6652                std::option::Option<
6653                    crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
6654                >,
6655            >,
6656    >(
6657        mut self,
6658        v: T,
6659    ) -> Self {
6660        self.wrapped_key_material = v.into();
6661        self
6662    }
6663
6664    /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
6665    /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
6666    /// holds a different branch.
6667    pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
6668        #[allow(unreachable_patterns)]
6669        self.wrapped_key_material.as_ref().and_then(|v| match v {
6670            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
6671            _ => std::option::Option::None,
6672        })
6673    }
6674
6675    /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
6676    /// to hold a `RsaAesWrappedKey`.
6677    ///
6678    /// Note that all the setters affecting `wrapped_key_material` are
6679    /// mutually exclusive.
6680    pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
6681        self.wrapped_key_material = std::option::Option::Some(
6682            crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
6683                v.into(),
6684            ),
6685        );
6686        self
6687    }
6688}
6689
6690impl wkt::message::Message for ImportCryptoKeyVersionRequest {
6691    fn typename() -> &'static str {
6692        "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
6693    }
6694}
6695
6696/// Defines additional types related to [ImportCryptoKeyVersionRequest].
6697pub mod import_crypto_key_version_request {
6698    #[allow(unused_imports)]
6699    use super::*;
6700
6701    /// This field is legacy. Use the field
6702    /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
6703    /// instead.
6704    ///
6705    /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
6706    #[derive(Clone, Debug, PartialEq)]
6707    #[non_exhaustive]
6708    pub enum WrappedKeyMaterial {
6709        /// Optional. This field has the same meaning as
6710        /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
6711        /// Prefer to use that field in new work. Either that field or this field
6712        /// (but not both) must be specified.
6713        ///
6714        /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
6715        RsaAesWrappedKey(::bytes::Bytes),
6716    }
6717}
6718
6719/// Request message for
6720/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
6721///
6722/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
6723#[derive(Clone, Default, PartialEq)]
6724#[non_exhaustive]
6725pub struct CreateImportJobRequest {
6726    /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
6727    /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
6728    /// [ImportJobs][google.cloud.kms.v1.ImportJob].
6729    ///
6730    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6731    /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6732    /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
6733    pub parent: std::string::String,
6734
6735    /// Required. It must be unique within a KeyRing and match the regular
6736    /// expression `[a-zA-Z0-9_-]{1,63}`
6737    pub import_job_id: std::string::String,
6738
6739    /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
6740    /// values.
6741    ///
6742    /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
6743    pub import_job: std::option::Option<crate::model::ImportJob>,
6744
6745    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6746}
6747
6748impl CreateImportJobRequest {
6749    pub fn new() -> Self {
6750        std::default::Default::default()
6751    }
6752
6753    /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
6754    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6755        self.parent = v.into();
6756        self
6757    }
6758
6759    /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
6760    pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6761        self.import_job_id = v.into();
6762        self
6763    }
6764
6765    /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
6766    pub fn set_import_job<T>(mut self, v: T) -> Self
6767    where
6768        T: std::convert::Into<crate::model::ImportJob>,
6769    {
6770        self.import_job = std::option::Option::Some(v.into());
6771        self
6772    }
6773
6774    /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
6775    pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
6776    where
6777        T: std::convert::Into<crate::model::ImportJob>,
6778    {
6779        self.import_job = v.map(|x| x.into());
6780        self
6781    }
6782}
6783
6784impl wkt::message::Message for CreateImportJobRequest {
6785    fn typename() -> &'static str {
6786        "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
6787    }
6788}
6789
6790/// Request message for
6791/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
6792///
6793/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
6794#[derive(Clone, Default, PartialEq)]
6795#[non_exhaustive]
6796pub struct UpdateCryptoKeyRequest {
6797    /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
6798    ///
6799    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6800    pub crypto_key: std::option::Option<crate::model::CryptoKey>,
6801
6802    /// Required. List of fields to be updated in this request.
6803    pub update_mask: std::option::Option<wkt::FieldMask>,
6804
6805    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6806}
6807
6808impl UpdateCryptoKeyRequest {
6809    pub fn new() -> Self {
6810        std::default::Default::default()
6811    }
6812
6813    /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
6814    pub fn set_crypto_key<T>(mut self, v: T) -> Self
6815    where
6816        T: std::convert::Into<crate::model::CryptoKey>,
6817    {
6818        self.crypto_key = std::option::Option::Some(v.into());
6819        self
6820    }
6821
6822    /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
6823    pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
6824    where
6825        T: std::convert::Into<crate::model::CryptoKey>,
6826    {
6827        self.crypto_key = v.map(|x| x.into());
6828        self
6829    }
6830
6831    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
6832    pub fn set_update_mask<T>(mut self, v: T) -> Self
6833    where
6834        T: std::convert::Into<wkt::FieldMask>,
6835    {
6836        self.update_mask = std::option::Option::Some(v.into());
6837        self
6838    }
6839
6840    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
6841    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6842    where
6843        T: std::convert::Into<wkt::FieldMask>,
6844    {
6845        self.update_mask = v.map(|x| x.into());
6846        self
6847    }
6848}
6849
6850impl wkt::message::Message for UpdateCryptoKeyRequest {
6851    fn typename() -> &'static str {
6852        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
6853    }
6854}
6855
6856/// Request message for
6857/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
6858///
6859/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
6860#[derive(Clone, Default, PartialEq)]
6861#[non_exhaustive]
6862pub struct UpdateCryptoKeyVersionRequest {
6863    /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
6864    /// updated values.
6865    ///
6866    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6867    pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
6868
6869    /// Required. List of fields to be updated in this request.
6870    pub update_mask: std::option::Option<wkt::FieldMask>,
6871
6872    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6873}
6874
6875impl UpdateCryptoKeyVersionRequest {
6876    pub fn new() -> Self {
6877        std::default::Default::default()
6878    }
6879
6880    /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
6881    pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
6882    where
6883        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6884    {
6885        self.crypto_key_version = std::option::Option::Some(v.into());
6886        self
6887    }
6888
6889    /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
6890    pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
6891    where
6892        T: std::convert::Into<crate::model::CryptoKeyVersion>,
6893    {
6894        self.crypto_key_version = v.map(|x| x.into());
6895        self
6896    }
6897
6898    /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
6899    pub fn set_update_mask<T>(mut self, v: T) -> Self
6900    where
6901        T: std::convert::Into<wkt::FieldMask>,
6902    {
6903        self.update_mask = std::option::Option::Some(v.into());
6904        self
6905    }
6906
6907    /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
6908    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
6909    where
6910        T: std::convert::Into<wkt::FieldMask>,
6911    {
6912        self.update_mask = v.map(|x| x.into());
6913        self
6914    }
6915}
6916
6917impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
6918    fn typename() -> &'static str {
6919        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
6920    }
6921}
6922
6923/// Request message for
6924/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6925///
6926/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6927#[derive(Clone, Default, PartialEq)]
6928#[non_exhaustive]
6929pub struct UpdateCryptoKeyPrimaryVersionRequest {
6930    /// Required. The resource name of the
6931    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
6932    ///
6933    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6934    pub name: std::string::String,
6935
6936    /// Required. The id of the child
6937    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
6938    ///
6939    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6940    pub crypto_key_version_id: std::string::String,
6941
6942    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6943}
6944
6945impl UpdateCryptoKeyPrimaryVersionRequest {
6946    pub fn new() -> Self {
6947        std::default::Default::default()
6948    }
6949
6950    /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
6951    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6952        self.name = v.into();
6953        self
6954    }
6955
6956    /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
6957    pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
6958        mut self,
6959        v: T,
6960    ) -> Self {
6961        self.crypto_key_version_id = v.into();
6962        self
6963    }
6964}
6965
6966impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
6967    fn typename() -> &'static str {
6968        "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
6969    }
6970}
6971
6972/// Request message for
6973/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
6974///
6975/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
6976#[derive(Clone, Default, PartialEq)]
6977#[non_exhaustive]
6978pub struct DestroyCryptoKeyVersionRequest {
6979    /// Required. The resource name of the
6980    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
6981    ///
6982    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6983    pub name: std::string::String,
6984
6985    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6986}
6987
6988impl DestroyCryptoKeyVersionRequest {
6989    pub fn new() -> Self {
6990        std::default::Default::default()
6991    }
6992
6993    /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
6994    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6995        self.name = v.into();
6996        self
6997    }
6998}
6999
7000impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
7001    fn typename() -> &'static str {
7002        "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
7003    }
7004}
7005
7006/// Request message for
7007/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
7008///
7009/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
7010#[derive(Clone, Default, PartialEq)]
7011#[non_exhaustive]
7012pub struct RestoreCryptoKeyVersionRequest {
7013    /// Required. The resource name of the
7014    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
7015    ///
7016    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7017    pub name: std::string::String,
7018
7019    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7020}
7021
7022impl RestoreCryptoKeyVersionRequest {
7023    pub fn new() -> Self {
7024        std::default::Default::default()
7025    }
7026
7027    /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
7028    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7029        self.name = v.into();
7030        self
7031    }
7032}
7033
7034impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
7035    fn typename() -> &'static str {
7036        "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
7037    }
7038}
7039
7040/// Request message for
7041/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
7042///
7043/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
7044#[derive(Clone, Default, PartialEq)]
7045#[non_exhaustive]
7046pub struct EncryptRequest {
7047    /// Required. The resource name of the
7048    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
7049    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
7050    /// encryption.
7051    ///
7052    /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
7053    /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
7054    ///
7055    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7056    /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
7057    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7058    pub name: std::string::String,
7059
7060    /// Required. The data to encrypt. Must be no larger than 64KiB.
7061    ///
7062    /// The maximum size depends on the key version's
7063    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
7064    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
7065    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
7066    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
7067    /// plaintext must be no larger than 64KiB. For
7068    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
7069    /// the plaintext and additional_authenticated_data fields must be no larger
7070    /// than 8KiB.
7071    ///
7072    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
7073    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7074    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7075    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7076    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7077    pub plaintext: ::bytes::Bytes,
7078
7079    /// Optional. Optional data that, if specified, must also be provided during
7080    /// decryption through
7081    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
7082    ///
7083    /// The maximum size depends on the key version's
7084    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
7085    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
7086    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
7087    /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
7088    /// AAD must be no larger than 64KiB. For
7089    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
7090    /// the plaintext and additional_authenticated_data fields must be no larger
7091    /// than 8KiB.
7092    ///
7093    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
7094    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
7095    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7096    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7097    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7098    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7099    pub additional_authenticated_data: ::bytes::Bytes,
7100
7101    /// Optional. An optional CRC32C checksum of the
7102    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
7103    /// If specified,
7104    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7105    /// verify the integrity of the received
7106    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
7107    /// using this checksum.
7108    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7109    /// report an error if the checksum verification fails. If you receive a
7110    /// checksum error, your client should verify that
7111    /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
7112    /// is equal to
7113    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
7114    /// and if so, perform a limited number of retries. A persistent mismatch may
7115    /// indicate an issue in your computation of the CRC32C checksum. Note: This
7116    /// field is defined as int64 for reasons of compatibility across different
7117    /// languages. However, it is a non-negative integer, which will never exceed
7118    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
7119    /// this type.
7120    ///
7121    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
7122    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
7123    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7124    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
7125
7126    /// Optional. An optional CRC32C checksum of the
7127    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
7128    /// If specified,
7129    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7130    /// verify the integrity of the received
7131    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
7132    /// using this checksum.
7133    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7134    /// report an error if the checksum verification fails. If you receive a
7135    /// checksum error, your client should verify that
7136    /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
7137    /// is equal to
7138    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
7139    /// and if so, perform a limited number of retries. A persistent mismatch may
7140    /// indicate an issue in your computation of the CRC32C checksum. Note: This
7141    /// field is defined as int64 for reasons of compatibility across different
7142    /// languages. However, it is a non-negative integer, which will never exceed
7143    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
7144    /// this type.
7145    ///
7146    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
7147    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
7148    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7149    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
7150
7151    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7152}
7153
7154impl EncryptRequest {
7155    pub fn new() -> Self {
7156        std::default::Default::default()
7157    }
7158
7159    /// Sets the value of [name][crate::model::EncryptRequest::name].
7160    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7161        self.name = v.into();
7162        self
7163    }
7164
7165    /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
7166    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7167        self.plaintext = v.into();
7168        self
7169    }
7170
7171    /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
7172    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
7173        mut self,
7174        v: T,
7175    ) -> Self {
7176        self.additional_authenticated_data = v.into();
7177        self
7178    }
7179
7180    /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
7181    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
7182    where
7183        T: std::convert::Into<wkt::Int64Value>,
7184    {
7185        self.plaintext_crc32c = std::option::Option::Some(v.into());
7186        self
7187    }
7188
7189    /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
7190    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7191    where
7192        T: std::convert::Into<wkt::Int64Value>,
7193    {
7194        self.plaintext_crc32c = v.map(|x| x.into());
7195        self
7196    }
7197
7198    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
7199    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7200    where
7201        T: std::convert::Into<wkt::Int64Value>,
7202    {
7203        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
7204        self
7205    }
7206
7207    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
7208    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7209        mut self,
7210        v: std::option::Option<T>,
7211    ) -> Self
7212    where
7213        T: std::convert::Into<wkt::Int64Value>,
7214    {
7215        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
7216        self
7217    }
7218}
7219
7220impl wkt::message::Message for EncryptRequest {
7221    fn typename() -> &'static str {
7222        "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
7223    }
7224}
7225
7226/// Request message for
7227/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
7228///
7229/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
7230#[derive(Clone, Default, PartialEq)]
7231#[non_exhaustive]
7232pub struct DecryptRequest {
7233    /// Required. The resource name of the
7234    /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
7235    /// server will choose the appropriate version.
7236    ///
7237    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7238    pub name: std::string::String,
7239
7240    /// Required. The encrypted data originally returned in
7241    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
7242    ///
7243    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
7244    pub ciphertext: ::bytes::Bytes,
7245
7246    /// Optional. Optional data that must match the data originally supplied in
7247    /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
7248    ///
7249    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
7250    pub additional_authenticated_data: ::bytes::Bytes,
7251
7252    /// Optional. An optional CRC32C checksum of the
7253    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
7254    /// If specified,
7255    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7256    /// verify the integrity of the received
7257    /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
7258    /// using this checksum.
7259    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7260    /// report an error if the checksum verification fails. If you receive a
7261    /// checksum error, your client should verify that
7262    /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
7263    /// is equal to
7264    /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
7265    /// and if so, perform a limited number of retries. A persistent mismatch may
7266    /// indicate an issue in your computation of the CRC32C checksum. Note: This
7267    /// field is defined as int64 for reasons of compatibility across different
7268    /// languages. However, it is a non-negative integer, which will never exceed
7269    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
7270    /// this type.
7271    ///
7272    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
7273    /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
7274    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7275    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
7276
7277    /// Optional. An optional CRC32C checksum of the
7278    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
7279    /// If specified,
7280    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7281    /// verify the integrity of the received
7282    /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
7283    /// using this checksum.
7284    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7285    /// report an error if the checksum verification fails. If you receive a
7286    /// checksum error, your client should verify that
7287    /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
7288    /// is equal to
7289    /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
7290    /// and if so, perform a limited number of retries. A persistent mismatch may
7291    /// indicate an issue in your computation of the CRC32C checksum. Note: This
7292    /// field is defined as int64 for reasons of compatibility across different
7293    /// languages. However, it is a non-negative integer, which will never exceed
7294    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
7295    /// this type.
7296    ///
7297    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
7298    /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
7299    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7300    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
7301
7302    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7303}
7304
7305impl DecryptRequest {
7306    pub fn new() -> Self {
7307        std::default::Default::default()
7308    }
7309
7310    /// Sets the value of [name][crate::model::DecryptRequest::name].
7311    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7312        self.name = v.into();
7313        self
7314    }
7315
7316    /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
7317    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7318        self.ciphertext = v.into();
7319        self
7320    }
7321
7322    /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
7323    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
7324        mut self,
7325        v: T,
7326    ) -> Self {
7327        self.additional_authenticated_data = v.into();
7328        self
7329    }
7330
7331    /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
7332    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7333    where
7334        T: std::convert::Into<wkt::Int64Value>,
7335    {
7336        self.ciphertext_crc32c = std::option::Option::Some(v.into());
7337        self
7338    }
7339
7340    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
7341    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7342    where
7343        T: std::convert::Into<wkt::Int64Value>,
7344    {
7345        self.ciphertext_crc32c = v.map(|x| x.into());
7346        self
7347    }
7348
7349    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
7350    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7351    where
7352        T: std::convert::Into<wkt::Int64Value>,
7353    {
7354        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
7355        self
7356    }
7357
7358    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
7359    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7360        mut self,
7361        v: std::option::Option<T>,
7362    ) -> Self
7363    where
7364        T: std::convert::Into<wkt::Int64Value>,
7365    {
7366        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
7367        self
7368    }
7369}
7370
7371impl wkt::message::Message for DecryptRequest {
7372    fn typename() -> &'static str {
7373        "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
7374    }
7375}
7376
7377/// Request message for
7378/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
7379///
7380/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
7381#[derive(Clone, Default, PartialEq)]
7382#[non_exhaustive]
7383pub struct RawEncryptRequest {
7384    /// Required. The resource name of the
7385    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
7386    /// encryption.
7387    ///
7388    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7389    pub name: std::string::String,
7390
7391    /// Required. The data to encrypt. Must be no larger than 64KiB.
7392    ///
7393    /// The maximum size depends on the key version's
7394    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
7395    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
7396    /// plaintext must be no larger than 64KiB. For
7397    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
7398    /// the plaintext and additional_authenticated_data fields must be no larger
7399    /// than 8KiB.
7400    ///
7401    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
7402    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7403    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7404    pub plaintext: ::bytes::Bytes,
7405
7406    /// Optional. Optional data that, if specified, must also be provided during
7407    /// decryption through
7408    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
7409    ///
7410    /// This field may only be used in conjunction with an
7411    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
7412    /// additional authenticated data (for example, AES-GCM).
7413    ///
7414    /// The maximum size depends on the key version's
7415    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
7416    /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
7417    /// plaintext must be no larger than 64KiB. For
7418    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
7419    /// the plaintext and additional_authenticated_data fields must be no larger
7420    /// than 8KiB.
7421    ///
7422    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
7423    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
7424    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7425    /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7426    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
7427    pub additional_authenticated_data: ::bytes::Bytes,
7428
7429    /// Optional. An optional CRC32C checksum of the
7430    /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
7431    /// If specified,
7432    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7433    /// verify the integrity of the received plaintext using this checksum.
7434    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7435    /// report an error if the checksum verification fails. If you receive a
7436    /// checksum error, your client should verify that CRC32C(plaintext) is equal
7437    /// to plaintext_crc32c, and if so, perform a limited number of retries. A
7438    /// persistent mismatch may indicate an issue in your computation of the CRC32C
7439    /// checksum. Note: This field is defined as int64 for reasons of compatibility
7440    /// across different languages. However, it is a non-negative integer, which
7441    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
7442    /// languages that support this type.
7443    ///
7444    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7445    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
7446    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
7447
7448    /// Optional. An optional CRC32C checksum of the
7449    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
7450    /// If specified,
7451    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7452    /// verify the integrity of the received additional_authenticated_data using
7453    /// this checksum.
7454    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7455    /// report an error if the checksum verification fails. If you receive a
7456    /// checksum error, your client should verify that
7457    /// CRC32C(additional_authenticated_data) is equal to
7458    /// additional_authenticated_data_crc32c, and if so, perform
7459    /// a limited number of retries. A persistent mismatch may indicate an issue in
7460    /// your computation of the CRC32C checksum.
7461    /// Note: This field is defined as int64 for reasons of compatibility across
7462    /// different languages. However, it is a non-negative integer, which will
7463    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
7464    /// that support this type.
7465    ///
7466    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7467    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
7468    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
7469
7470    /// Optional. A customer-supplied initialization vector that will be used for
7471    /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
7472    /// generated. It will be returned in
7473    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
7474    ///
7475    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
7476    pub initialization_vector: ::bytes::Bytes,
7477
7478    /// Optional. An optional CRC32C checksum of the
7479    /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
7480    /// If specified,
7481    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7482    /// verify the integrity of the received initialization_vector using this
7483    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
7484    /// will report an error if the checksum verification fails. If you receive a
7485    /// checksum error, your client should verify that
7486    /// CRC32C(initialization_vector) is equal to
7487    /// initialization_vector_crc32c, and if so, perform
7488    /// a limited number of retries. A persistent mismatch may indicate an issue in
7489    /// your computation of the CRC32C checksum.
7490    /// Note: This field is defined as int64 for reasons of compatibility across
7491    /// different languages. However, it is a non-negative integer, which will
7492    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
7493    /// that support this type.
7494    ///
7495    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7496    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
7497    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
7498
7499    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7500}
7501
7502impl RawEncryptRequest {
7503    pub fn new() -> Self {
7504        std::default::Default::default()
7505    }
7506
7507    /// Sets the value of [name][crate::model::RawEncryptRequest::name].
7508    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7509        self.name = v.into();
7510        self
7511    }
7512
7513    /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
7514    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7515        self.plaintext = v.into();
7516        self
7517    }
7518
7519    /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
7520    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
7521        mut self,
7522        v: T,
7523    ) -> Self {
7524        self.additional_authenticated_data = v.into();
7525        self
7526    }
7527
7528    /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
7529    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
7530    where
7531        T: std::convert::Into<wkt::Int64Value>,
7532    {
7533        self.plaintext_crc32c = std::option::Option::Some(v.into());
7534        self
7535    }
7536
7537    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
7538    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7539    where
7540        T: std::convert::Into<wkt::Int64Value>,
7541    {
7542        self.plaintext_crc32c = v.map(|x| x.into());
7543        self
7544    }
7545
7546    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
7547    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7548    where
7549        T: std::convert::Into<wkt::Int64Value>,
7550    {
7551        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
7552        self
7553    }
7554
7555    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
7556    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7557        mut self,
7558        v: std::option::Option<T>,
7559    ) -> Self
7560    where
7561        T: std::convert::Into<wkt::Int64Value>,
7562    {
7563        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
7564        self
7565    }
7566
7567    /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
7568    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
7569        mut self,
7570        v: T,
7571    ) -> Self {
7572        self.initialization_vector = v.into();
7573        self
7574    }
7575
7576    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
7577    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
7578    where
7579        T: std::convert::Into<wkt::Int64Value>,
7580    {
7581        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
7582        self
7583    }
7584
7585    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
7586    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7587    where
7588        T: std::convert::Into<wkt::Int64Value>,
7589    {
7590        self.initialization_vector_crc32c = v.map(|x| x.into());
7591        self
7592    }
7593}
7594
7595impl wkt::message::Message for RawEncryptRequest {
7596    fn typename() -> &'static str {
7597        "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
7598    }
7599}
7600
7601/// Request message for
7602/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
7603///
7604/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
7605#[derive(Clone, Default, PartialEq)]
7606#[non_exhaustive]
7607pub struct RawDecryptRequest {
7608    /// Required. The resource name of the
7609    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
7610    /// decryption.
7611    ///
7612    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7613    pub name: std::string::String,
7614
7615    /// Required. The encrypted data originally returned in
7616    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
7617    ///
7618    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
7619    pub ciphertext: ::bytes::Bytes,
7620
7621    /// Optional. Optional data that must match the data originally supplied in
7622    /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
7623    ///
7624    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
7625    pub additional_authenticated_data: ::bytes::Bytes,
7626
7627    /// Required. The initialization vector (IV) used during encryption, which must
7628    /// match the data originally provided in
7629    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
7630    ///
7631    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
7632    pub initialization_vector: ::bytes::Bytes,
7633
7634    /// The length of the authentication tag that is appended to the end of
7635    /// the ciphertext. If unspecified (0), the default value for the key's
7636    /// algorithm will be used (for AES-GCM, the default value is 16).
7637    pub tag_length: i32,
7638
7639    /// Optional. An optional CRC32C checksum of the
7640    /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
7641    /// If specified,
7642    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7643    /// verify the integrity of the received ciphertext using this checksum.
7644    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7645    /// report an error if the checksum verification fails. If you receive a
7646    /// checksum error, your client should verify that CRC32C(ciphertext) is equal
7647    /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
7648    /// persistent mismatch may indicate an issue in your computation of the CRC32C
7649    /// checksum. Note: This field is defined as int64 for reasons of compatibility
7650    /// across different languages. However, it is a non-negative integer, which
7651    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
7652    /// languages that support this type.
7653    ///
7654    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7655    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
7656    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
7657
7658    /// Optional. An optional CRC32C checksum of the
7659    /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
7660    /// If specified,
7661    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7662    /// verify the integrity of the received additional_authenticated_data using
7663    /// this checksum.
7664    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7665    /// report an error if the checksum verification fails. If you receive a
7666    /// checksum error, your client should verify that
7667    /// CRC32C(additional_authenticated_data) is equal to
7668    /// additional_authenticated_data_crc32c, and if so, perform
7669    /// a limited number of retries. A persistent mismatch may indicate an issue in
7670    /// your computation of the CRC32C checksum.
7671    /// Note: This field is defined as int64 for reasons of compatibility across
7672    /// different languages. However, it is a non-negative integer, which will
7673    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
7674    /// that support this type.
7675    ///
7676    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7677    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
7678    pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
7679
7680    /// Optional. An optional CRC32C checksum of the
7681    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
7682    /// If specified,
7683    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7684    /// verify the integrity of the received initialization_vector using this
7685    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
7686    /// will report an error if the checksum verification fails. If you receive a
7687    /// checksum error, your client should verify that
7688    /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
7689    /// if so, perform a limited number of retries. A persistent mismatch may
7690    /// indicate an issue in your computation of the CRC32C checksum.
7691    /// Note: This field is defined as int64 for reasons of compatibility across
7692    /// different languages. However, it is a non-negative integer, which will
7693    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
7694    /// that support this type.
7695    ///
7696    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7697    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
7698    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
7699
7700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7701}
7702
7703impl RawDecryptRequest {
7704    pub fn new() -> Self {
7705        std::default::Default::default()
7706    }
7707
7708    /// Sets the value of [name][crate::model::RawDecryptRequest::name].
7709    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7710        self.name = v.into();
7711        self
7712    }
7713
7714    /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
7715    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7716        self.ciphertext = v.into();
7717        self
7718    }
7719
7720    /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
7721    pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
7722        mut self,
7723        v: T,
7724    ) -> Self {
7725        self.additional_authenticated_data = v.into();
7726        self
7727    }
7728
7729    /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
7730    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
7731        mut self,
7732        v: T,
7733    ) -> Self {
7734        self.initialization_vector = v.into();
7735        self
7736    }
7737
7738    /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
7739    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7740        self.tag_length = v.into();
7741        self
7742    }
7743
7744    /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
7745    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
7746    where
7747        T: std::convert::Into<wkt::Int64Value>,
7748    {
7749        self.ciphertext_crc32c = std::option::Option::Some(v.into());
7750        self
7751    }
7752
7753    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
7754    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7755    where
7756        T: std::convert::Into<wkt::Int64Value>,
7757    {
7758        self.ciphertext_crc32c = v.map(|x| x.into());
7759        self
7760    }
7761
7762    /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
7763    pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
7764    where
7765        T: std::convert::Into<wkt::Int64Value>,
7766    {
7767        self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
7768        self
7769    }
7770
7771    /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
7772    pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
7773        mut self,
7774        v: std::option::Option<T>,
7775    ) -> Self
7776    where
7777        T: std::convert::Into<wkt::Int64Value>,
7778    {
7779        self.additional_authenticated_data_crc32c = v.map(|x| x.into());
7780        self
7781    }
7782
7783    /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
7784    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
7785    where
7786        T: std::convert::Into<wkt::Int64Value>,
7787    {
7788        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
7789        self
7790    }
7791
7792    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
7793    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7794    where
7795        T: std::convert::Into<wkt::Int64Value>,
7796    {
7797        self.initialization_vector_crc32c = v.map(|x| x.into());
7798        self
7799    }
7800}
7801
7802impl wkt::message::Message for RawDecryptRequest {
7803    fn typename() -> &'static str {
7804        "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
7805    }
7806}
7807
7808/// Request message for
7809/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
7810///
7811/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
7812#[derive(Clone, Default, PartialEq)]
7813#[non_exhaustive]
7814pub struct AsymmetricSignRequest {
7815    /// Required. The resource name of the
7816    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
7817    /// signing.
7818    ///
7819    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7820    pub name: std::string::String,
7821
7822    /// Optional. The digest of the data to sign. The digest must be produced with
7823    /// the same digest algorithm as specified by the key version's
7824    /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
7825    ///
7826    /// This field may not be supplied if
7827    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
7828    /// is supplied.
7829    ///
7830    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
7831    /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
7832    pub digest: std::option::Option<crate::model::Digest>,
7833
7834    /// Optional. An optional CRC32C checksum of the
7835    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
7836    /// If specified,
7837    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7838    /// verify the integrity of the received
7839    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
7840    /// using this checksum.
7841    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7842    /// report an error if the checksum verification fails. If you receive a
7843    /// checksum error, your client should verify that
7844    /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
7845    /// is equal to
7846    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
7847    /// and if so, perform a limited number of retries. A persistent mismatch may
7848    /// indicate an issue in your computation of the CRC32C checksum. Note: This
7849    /// field is defined as int64 for reasons of compatibility across different
7850    /// languages. However, it is a non-negative integer, which will never exceed
7851    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
7852    /// this type.
7853    ///
7854    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
7855    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
7856    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7857    pub digest_crc32c: std::option::Option<wkt::Int64Value>,
7858
7859    /// Optional. The data to sign.
7860    /// It can't be supplied if
7861    /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
7862    /// is supplied.
7863    ///
7864    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
7865    pub data: ::bytes::Bytes,
7866
7867    /// Optional. An optional CRC32C checksum of the
7868    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
7869    /// If specified,
7870    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7871    /// verify the integrity of the received
7872    /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
7873    /// using this checksum.
7874    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7875    /// report an error if the checksum verification fails. If you receive a
7876    /// checksum error, your client should verify that
7877    /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
7878    /// is equal to
7879    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
7880    /// and if so, perform a limited number of retries. A persistent mismatch may
7881    /// indicate an issue in your computation of the CRC32C checksum. Note: This
7882    /// field is defined as int64 for reasons of compatibility across different
7883    /// languages. However, it is a non-negative integer, which will never exceed
7884    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
7885    /// this type.
7886    ///
7887    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
7888    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
7889    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
7890    pub data_crc32c: std::option::Option<wkt::Int64Value>,
7891
7892    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7893}
7894
7895impl AsymmetricSignRequest {
7896    pub fn new() -> Self {
7897        std::default::Default::default()
7898    }
7899
7900    /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
7901    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7902        self.name = v.into();
7903        self
7904    }
7905
7906    /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
7907    pub fn set_digest<T>(mut self, v: T) -> Self
7908    where
7909        T: std::convert::Into<crate::model::Digest>,
7910    {
7911        self.digest = std::option::Option::Some(v.into());
7912        self
7913    }
7914
7915    /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
7916    pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
7917    where
7918        T: std::convert::Into<crate::model::Digest>,
7919    {
7920        self.digest = v.map(|x| x.into());
7921        self
7922    }
7923
7924    /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
7925    pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
7926    where
7927        T: std::convert::Into<wkt::Int64Value>,
7928    {
7929        self.digest_crc32c = std::option::Option::Some(v.into());
7930        self
7931    }
7932
7933    /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
7934    pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7935    where
7936        T: std::convert::Into<wkt::Int64Value>,
7937    {
7938        self.digest_crc32c = v.map(|x| x.into());
7939        self
7940    }
7941
7942    /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
7943    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7944        self.data = v.into();
7945        self
7946    }
7947
7948    /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
7949    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
7950    where
7951        T: std::convert::Into<wkt::Int64Value>,
7952    {
7953        self.data_crc32c = std::option::Option::Some(v.into());
7954        self
7955    }
7956
7957    /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
7958    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
7959    where
7960        T: std::convert::Into<wkt::Int64Value>,
7961    {
7962        self.data_crc32c = v.map(|x| x.into());
7963        self
7964    }
7965}
7966
7967impl wkt::message::Message for AsymmetricSignRequest {
7968    fn typename() -> &'static str {
7969        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
7970    }
7971}
7972
7973/// Request message for
7974/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
7975///
7976/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
7977#[derive(Clone, Default, PartialEq)]
7978#[non_exhaustive]
7979pub struct AsymmetricDecryptRequest {
7980    /// Required. The resource name of the
7981    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
7982    /// decryption.
7983    ///
7984    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7985    pub name: std::string::String,
7986
7987    /// Required. The data encrypted with the named
7988    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
7989    /// OAEP.
7990    ///
7991    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7992    pub ciphertext: ::bytes::Bytes,
7993
7994    /// Optional. An optional CRC32C checksum of the
7995    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
7996    /// If specified,
7997    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
7998    /// verify the integrity of the received
7999    /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
8000    /// using this checksum.
8001    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8002    /// report an error if the checksum verification fails. If you receive a
8003    /// checksum error, your client should verify that
8004    /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
8005    /// is equal to
8006    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
8007    /// and if so, perform a limited number of retries. A persistent mismatch may
8008    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8009    /// field is defined as int64 for reasons of compatibility across different
8010    /// languages. However, it is a non-negative integer, which will never exceed
8011    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8012    /// this type.
8013    ///
8014    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
8015    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
8016    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8017    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
8018
8019    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8020}
8021
8022impl AsymmetricDecryptRequest {
8023    pub fn new() -> Self {
8024        std::default::Default::default()
8025    }
8026
8027    /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
8028    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8029        self.name = v.into();
8030        self
8031    }
8032
8033    /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
8034    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8035        self.ciphertext = v.into();
8036        self
8037    }
8038
8039    /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
8040    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
8041    where
8042        T: std::convert::Into<wkt::Int64Value>,
8043    {
8044        self.ciphertext_crc32c = std::option::Option::Some(v.into());
8045        self
8046    }
8047
8048    /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
8049    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8050    where
8051        T: std::convert::Into<wkt::Int64Value>,
8052    {
8053        self.ciphertext_crc32c = v.map(|x| x.into());
8054        self
8055    }
8056}
8057
8058impl wkt::message::Message for AsymmetricDecryptRequest {
8059    fn typename() -> &'static str {
8060        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
8061    }
8062}
8063
8064/// Request message for
8065/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
8066///
8067/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
8068#[derive(Clone, Default, PartialEq)]
8069#[non_exhaustive]
8070pub struct MacSignRequest {
8071    /// Required. The resource name of the
8072    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
8073    /// signing.
8074    ///
8075    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8076    pub name: std::string::String,
8077
8078    /// Required. The data to sign. The MAC tag is computed over this data field
8079    /// based on the specific algorithm.
8080    pub data: ::bytes::Bytes,
8081
8082    /// Optional. An optional CRC32C checksum of the
8083    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
8084    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
8085    /// will verify the integrity of the received
8086    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
8087    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
8088    /// will report an error if the checksum verification fails. If you receive a
8089    /// checksum error, your client should verify that
8090    /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
8091    /// equal to
8092    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
8093    /// and if so, perform a limited number of retries. A persistent mismatch may
8094    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8095    /// field is defined as int64 for reasons of compatibility across different
8096    /// languages. However, it is a non-negative integer, which will never exceed
8097    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8098    /// this type.
8099    ///
8100    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8101    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
8102    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
8103    pub data_crc32c: std::option::Option<wkt::Int64Value>,
8104
8105    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8106}
8107
8108impl MacSignRequest {
8109    pub fn new() -> Self {
8110        std::default::Default::default()
8111    }
8112
8113    /// Sets the value of [name][crate::model::MacSignRequest::name].
8114    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8115        self.name = v.into();
8116        self
8117    }
8118
8119    /// Sets the value of [data][crate::model::MacSignRequest::data].
8120    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8121        self.data = v.into();
8122        self
8123    }
8124
8125    /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
8126    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
8127    where
8128        T: std::convert::Into<wkt::Int64Value>,
8129    {
8130        self.data_crc32c = std::option::Option::Some(v.into());
8131        self
8132    }
8133
8134    /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
8135    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8136    where
8137        T: std::convert::Into<wkt::Int64Value>,
8138    {
8139        self.data_crc32c = v.map(|x| x.into());
8140        self
8141    }
8142}
8143
8144impl wkt::message::Message for MacSignRequest {
8145    fn typename() -> &'static str {
8146        "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
8147    }
8148}
8149
8150/// Request message for
8151/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
8152///
8153/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
8154#[derive(Clone, Default, PartialEq)]
8155#[non_exhaustive]
8156pub struct MacVerifyRequest {
8157    /// Required. The resource name of the
8158    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
8159    /// verification.
8160    ///
8161    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8162    pub name: std::string::String,
8163
8164    /// Required. The data used previously as a
8165    /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
8166    /// the MAC tag.
8167    ///
8168    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
8169    pub data: ::bytes::Bytes,
8170
8171    /// Optional. An optional CRC32C checksum of the
8172    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
8173    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
8174    /// will verify the integrity of the received
8175    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
8176    /// this checksum.
8177    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8178    /// report an error if the checksum verification fails. If you receive a
8179    /// checksum error, your client should verify that
8180    /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
8181    /// is equal to
8182    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
8183    /// and if so, perform a limited number of retries. A persistent mismatch may
8184    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8185    /// field is defined as int64 for reasons of compatibility across different
8186    /// languages. However, it is a non-negative integer, which will never exceed
8187    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8188    /// this type.
8189    ///
8190    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8191    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
8192    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
8193    pub data_crc32c: std::option::Option<wkt::Int64Value>,
8194
8195    /// Required. The signature to verify.
8196    pub mac: ::bytes::Bytes,
8197
8198    /// Optional. An optional CRC32C checksum of the
8199    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
8200    /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
8201    /// will verify the integrity of the received
8202    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
8203    /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
8204    /// will report an error if the checksum verification fails. If you receive a
8205    /// checksum error, your client should verify that
8206    /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
8207    /// equal to
8208    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
8209    /// and if so, perform a limited number of retries. A persistent mismatch may
8210    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8211    /// field is defined as int64 for reasons of compatibility across different
8212    /// languages. However, it is a non-negative integer, which will never exceed
8213    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8214    /// this type.
8215    ///
8216    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8217    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
8218    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
8219    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
8220
8221    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8222}
8223
8224impl MacVerifyRequest {
8225    pub fn new() -> Self {
8226        std::default::Default::default()
8227    }
8228
8229    /// Sets the value of [name][crate::model::MacVerifyRequest::name].
8230    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8231        self.name = v.into();
8232        self
8233    }
8234
8235    /// Sets the value of [data][crate::model::MacVerifyRequest::data].
8236    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8237        self.data = v.into();
8238        self
8239    }
8240
8241    /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
8242    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
8243    where
8244        T: std::convert::Into<wkt::Int64Value>,
8245    {
8246        self.data_crc32c = std::option::Option::Some(v.into());
8247        self
8248    }
8249
8250    /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
8251    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8252    where
8253        T: std::convert::Into<wkt::Int64Value>,
8254    {
8255        self.data_crc32c = v.map(|x| x.into());
8256        self
8257    }
8258
8259    /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
8260    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8261        self.mac = v.into();
8262        self
8263    }
8264
8265    /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
8266    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
8267    where
8268        T: std::convert::Into<wkt::Int64Value>,
8269    {
8270        self.mac_crc32c = std::option::Option::Some(v.into());
8271        self
8272    }
8273
8274    /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
8275    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8276    where
8277        T: std::convert::Into<wkt::Int64Value>,
8278    {
8279        self.mac_crc32c = v.map(|x| x.into());
8280        self
8281    }
8282}
8283
8284impl wkt::message::Message for MacVerifyRequest {
8285    fn typename() -> &'static str {
8286        "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
8287    }
8288}
8289
8290/// Request message for
8291/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
8292///
8293/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
8294#[derive(Clone, Default, PartialEq)]
8295#[non_exhaustive]
8296pub struct DecapsulateRequest {
8297    /// Required. The resource name of the
8298    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
8299    /// decapsulation.
8300    ///
8301    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8302    pub name: std::string::String,
8303
8304    /// Required. The ciphertext produced from encapsulation with the
8305    /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
8306    /// key(s).
8307    ///
8308    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8309    pub ciphertext: ::bytes::Bytes,
8310
8311    /// Optional. A CRC32C checksum of the
8312    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
8313    /// If specified,
8314    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8315    /// verify the integrity of the received
8316    /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
8317    /// using this checksum.
8318    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
8319    /// report an error if the checksum verification fails. If you receive a
8320    /// checksum error, your client should verify that
8321    /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
8322    /// is equal to
8323    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
8324    /// and if so, perform a limited number of retries. A persistent mismatch may
8325    /// indicate an issue in your computation of the CRC32C checksum. Note: This
8326    /// field is defined as int64 for reasons of compatibility across different
8327    /// languages. However, it is a non-negative integer, which will never exceed
8328    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8329    /// this type.
8330    ///
8331    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
8332    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
8333    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8334    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
8335
8336    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8337}
8338
8339impl DecapsulateRequest {
8340    pub fn new() -> Self {
8341        std::default::Default::default()
8342    }
8343
8344    /// Sets the value of [name][crate::model::DecapsulateRequest::name].
8345    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8346        self.name = v.into();
8347        self
8348    }
8349
8350    /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
8351    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8352        self.ciphertext = v.into();
8353        self
8354    }
8355
8356    /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
8357    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
8358    where
8359        T: std::convert::Into<wkt::Int64Value>,
8360    {
8361        self.ciphertext_crc32c = std::option::Option::Some(v.into());
8362        self
8363    }
8364
8365    /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
8366    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8367    where
8368        T: std::convert::Into<wkt::Int64Value>,
8369    {
8370        self.ciphertext_crc32c = v.map(|x| x.into());
8371        self
8372    }
8373}
8374
8375impl wkt::message::Message for DecapsulateRequest {
8376    fn typename() -> &'static str {
8377        "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
8378    }
8379}
8380
8381/// Request message for
8382/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
8383///
8384/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
8385#[derive(Clone, Default, PartialEq)]
8386#[non_exhaustive]
8387pub struct GenerateRandomBytesRequest {
8388    /// The project-specific location in which to generate random bytes.
8389    /// For example, "projects/my-project/locations/us-central1".
8390    pub location: std::string::String,
8391
8392    /// The length in bytes of the amount of randomness to retrieve.  Minimum 8
8393    /// bytes, maximum 1024 bytes.
8394    pub length_bytes: i32,
8395
8396    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
8397    /// generating the random data. Currently, only
8398    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
8399    /// supported.
8400    ///
8401    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
8402    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
8403    pub protection_level: crate::model::ProtectionLevel,
8404
8405    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8406}
8407
8408impl GenerateRandomBytesRequest {
8409    pub fn new() -> Self {
8410        std::default::Default::default()
8411    }
8412
8413    /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
8414    pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8415        self.location = v.into();
8416        self
8417    }
8418
8419    /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
8420    pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8421        self.length_bytes = v.into();
8422        self
8423    }
8424
8425    /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
8426    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
8427        mut self,
8428        v: T,
8429    ) -> Self {
8430        self.protection_level = v.into();
8431        self
8432    }
8433}
8434
8435impl wkt::message::Message for GenerateRandomBytesRequest {
8436    fn typename() -> &'static str {
8437        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
8438    }
8439}
8440
8441/// Response message for
8442/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
8443///
8444/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
8445#[derive(Clone, Default, PartialEq)]
8446#[non_exhaustive]
8447pub struct EncryptResponse {
8448    /// The resource name of the
8449    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
8450    /// encryption. Check this field to verify that the intended resource was used
8451    /// for encryption.
8452    ///
8453    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8454    pub name: std::string::String,
8455
8456    /// The encrypted data.
8457    pub ciphertext: ::bytes::Bytes,
8458
8459    /// Integrity verification field. A CRC32C checksum of the returned
8460    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
8461    /// An integrity check of
8462    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
8463    /// can be performed by computing the CRC32C checksum of
8464    /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
8465    /// and comparing your results to this field. Discard the response in case of
8466    /// non-matching checksum values, and perform a limited number of retries. A
8467    /// persistent mismatch may indicate an issue in your computation of the CRC32C
8468    /// checksum. Note: This field is defined as int64 for reasons of compatibility
8469    /// across different languages. However, it is a non-negative integer, which
8470    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
8471    /// languages that support this type.
8472    ///
8473    /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
8474    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
8475
8476    /// Integrity verification field. A flag indicating whether
8477    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
8478    /// was received by
8479    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
8480    /// for the integrity verification of the
8481    /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
8482    /// this field indicates either that
8483    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
8484    /// was left unset or that it was not delivered to
8485    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
8486    /// set
8487    /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
8488    /// but this field is still false, discard the response and perform a limited
8489    /// number of retries.
8490    ///
8491    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
8492    /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
8493    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8494    pub verified_plaintext_crc32c: bool,
8495
8496    /// Integrity verification field. A flag indicating whether
8497    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
8498    /// was received by
8499    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
8500    /// for the integrity verification of the
8501    /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
8502    /// false value of this field indicates either that
8503    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
8504    /// was left unset or that it was not delivered to
8505    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
8506    /// set
8507    /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
8508    /// but this field is still false, discard the response and perform a limited
8509    /// number of retries.
8510    ///
8511    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
8512    /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
8513    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8514    pub verified_additional_authenticated_data_crc32c: bool,
8515
8516    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
8517    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
8518    /// encryption.
8519    ///
8520    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8521    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
8522    pub protection_level: crate::model::ProtectionLevel,
8523
8524    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8525}
8526
8527impl EncryptResponse {
8528    pub fn new() -> Self {
8529        std::default::Default::default()
8530    }
8531
8532    /// Sets the value of [name][crate::model::EncryptResponse::name].
8533    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8534        self.name = v.into();
8535        self
8536    }
8537
8538    /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
8539    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8540        self.ciphertext = v.into();
8541        self
8542    }
8543
8544    /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
8545    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
8546    where
8547        T: std::convert::Into<wkt::Int64Value>,
8548    {
8549        self.ciphertext_crc32c = std::option::Option::Some(v.into());
8550        self
8551    }
8552
8553    /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
8554    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8555    where
8556        T: std::convert::Into<wkt::Int64Value>,
8557    {
8558        self.ciphertext_crc32c = v.map(|x| x.into());
8559        self
8560    }
8561
8562    /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
8563    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8564        self.verified_plaintext_crc32c = v.into();
8565        self
8566    }
8567
8568    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
8569    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
8570        mut self,
8571        v: T,
8572    ) -> Self {
8573        self.verified_additional_authenticated_data_crc32c = v.into();
8574        self
8575    }
8576
8577    /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
8578    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
8579        mut self,
8580        v: T,
8581    ) -> Self {
8582        self.protection_level = v.into();
8583        self
8584    }
8585}
8586
8587impl wkt::message::Message for EncryptResponse {
8588    fn typename() -> &'static str {
8589        "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
8590    }
8591}
8592
8593/// Response message for
8594/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
8595///
8596/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
8597#[derive(Clone, Default, PartialEq)]
8598#[non_exhaustive]
8599pub struct DecryptResponse {
8600    /// The decrypted data originally supplied in
8601    /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
8602    ///
8603    /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
8604    pub plaintext: ::bytes::Bytes,
8605
8606    /// Integrity verification field. A CRC32C checksum of the returned
8607    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
8608    /// An integrity check of
8609    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
8610    /// can be performed by computing the CRC32C checksum of
8611    /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
8612    /// and comparing your results to this field. Discard the response in case of
8613    /// non-matching checksum values, and perform a limited number of retries. A
8614    /// persistent mismatch may indicate an issue in your computation of the CRC32C
8615    /// checksum. Note: receiving this response message indicates that
8616    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
8617    /// successfully decrypt the
8618    /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
8619    /// field is defined as int64 for reasons of compatibility across different
8620    /// languages. However, it is a non-negative integer, which will never exceed
8621    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
8622    /// this type.
8623    ///
8624    /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
8625    /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
8626    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8627    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
8628
8629    /// Whether the Decryption was performed using the primary key version.
8630    pub used_primary: bool,
8631
8632    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
8633    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
8634    /// decryption.
8635    ///
8636    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8637    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
8638    pub protection_level: crate::model::ProtectionLevel,
8639
8640    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8641}
8642
8643impl DecryptResponse {
8644    pub fn new() -> Self {
8645        std::default::Default::default()
8646    }
8647
8648    /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
8649    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8650        self.plaintext = v.into();
8651        self
8652    }
8653
8654    /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
8655    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
8656    where
8657        T: std::convert::Into<wkt::Int64Value>,
8658    {
8659        self.plaintext_crc32c = std::option::Option::Some(v.into());
8660        self
8661    }
8662
8663    /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
8664    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8665    where
8666        T: std::convert::Into<wkt::Int64Value>,
8667    {
8668        self.plaintext_crc32c = v.map(|x| x.into());
8669        self
8670    }
8671
8672    /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
8673    pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8674        self.used_primary = v.into();
8675        self
8676    }
8677
8678    /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
8679    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
8680        mut self,
8681        v: T,
8682    ) -> Self {
8683        self.protection_level = v.into();
8684        self
8685    }
8686}
8687
8688impl wkt::message::Message for DecryptResponse {
8689    fn typename() -> &'static str {
8690        "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
8691    }
8692}
8693
8694/// Response message for
8695/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
8696///
8697/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
8698#[derive(Clone, Default, PartialEq)]
8699#[non_exhaustive]
8700pub struct RawEncryptResponse {
8701    /// The encrypted data. In the case of AES-GCM, the authentication tag
8702    /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
8703    /// bytes at the end of this field.
8704    ///
8705    /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
8706    pub ciphertext: ::bytes::Bytes,
8707
8708    /// The initialization vector (IV) generated by the service during
8709    /// encryption. This value must be stored and provided in
8710    /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
8711    /// at decryption time.
8712    ///
8713    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
8714    pub initialization_vector: ::bytes::Bytes,
8715
8716    /// The length of the authentication tag that is appended to
8717    /// the end of the ciphertext.
8718    pub tag_length: i32,
8719
8720    /// Integrity verification field. A CRC32C checksum of the returned
8721    /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
8722    /// An integrity check of ciphertext can be performed by computing the CRC32C
8723    /// checksum of ciphertext and comparing your results to this field. Discard
8724    /// the response in case of non-matching checksum values, and perform a limited
8725    /// number of retries. A persistent mismatch may indicate an issue in your
8726    /// computation of the CRC32C checksum. Note: This field is defined as int64
8727    /// for reasons of compatibility across different languages. However, it is a
8728    /// non-negative integer, which will never exceed 2^32-1, and can be safely
8729    /// downconverted to uint32 in languages that support this type.
8730    ///
8731    /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
8732    pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
8733
8734    /// Integrity verification field. A CRC32C checksum of the returned
8735    /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
8736    /// An integrity check of initialization_vector can be performed by computing
8737    /// the CRC32C checksum of initialization_vector and comparing your results to
8738    /// this field. Discard the response in case of non-matching checksum values,
8739    /// and perform a limited number of retries. A persistent mismatch may indicate
8740    /// an issue in your computation of the CRC32C checksum. Note: This field is
8741    /// defined as int64 for reasons of compatibility across different languages.
8742    /// However, it is a non-negative integer, which will never exceed 2^32-1, and
8743    /// can be safely downconverted to uint32 in languages that support this type.
8744    ///
8745    /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
8746    pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
8747
8748    /// Integrity verification field. A flag indicating whether
8749    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
8750    /// was received by
8751    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
8752    /// for the integrity verification of the plaintext. A false value of this
8753    /// field indicates either that
8754    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
8755    /// was left unset or that it was not delivered to
8756    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
8757    /// set
8758    /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
8759    /// but this field is still false, discard the response and perform a limited
8760    /// number of retries.
8761    ///
8762    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8763    /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
8764    pub verified_plaintext_crc32c: bool,
8765
8766    /// Integrity verification field. A flag indicating whether
8767    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
8768    /// was received by
8769    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
8770    /// for the integrity verification of additional_authenticated_data. A false
8771    /// value of this field indicates either that //
8772    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
8773    /// was left unset or that it was not delivered to
8774    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
8775    /// set
8776    /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
8777    /// but this field is still false, discard the response and perform a limited
8778    /// number of retries.
8779    ///
8780    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8781    /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
8782    pub verified_additional_authenticated_data_crc32c: bool,
8783
8784    /// Integrity verification field. A flag indicating whether
8785    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
8786    /// was received by
8787    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
8788    /// for the integrity verification of initialization_vector. A false value of
8789    /// this field indicates either that
8790    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
8791    /// was left unset or that it was not delivered to
8792    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
8793    /// set
8794    /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
8795    /// but this field is still false, discard the response and perform a limited
8796    /// number of retries.
8797    ///
8798    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8799    /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
8800    pub verified_initialization_vector_crc32c: bool,
8801
8802    /// The resource name of the
8803    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
8804    /// encryption. Check this field to verify that the intended resource was used
8805    /// for encryption.
8806    ///
8807    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8808    pub name: std::string::String,
8809
8810    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
8811    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
8812    /// encryption.
8813    ///
8814    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8815    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
8816    pub protection_level: crate::model::ProtectionLevel,
8817
8818    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8819}
8820
8821impl RawEncryptResponse {
8822    pub fn new() -> Self {
8823        std::default::Default::default()
8824    }
8825
8826    /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
8827    pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8828        self.ciphertext = v.into();
8829        self
8830    }
8831
8832    /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
8833    pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
8834        mut self,
8835        v: T,
8836    ) -> Self {
8837        self.initialization_vector = v.into();
8838        self
8839    }
8840
8841    /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
8842    pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8843        self.tag_length = v.into();
8844        self
8845    }
8846
8847    /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
8848    pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
8849    where
8850        T: std::convert::Into<wkt::Int64Value>,
8851    {
8852        self.ciphertext_crc32c = std::option::Option::Some(v.into());
8853        self
8854    }
8855
8856    /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
8857    pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8858    where
8859        T: std::convert::Into<wkt::Int64Value>,
8860    {
8861        self.ciphertext_crc32c = v.map(|x| x.into());
8862        self
8863    }
8864
8865    /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
8866    pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
8867    where
8868        T: std::convert::Into<wkt::Int64Value>,
8869    {
8870        self.initialization_vector_crc32c = std::option::Option::Some(v.into());
8871        self
8872    }
8873
8874    /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
8875    pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8876    where
8877        T: std::convert::Into<wkt::Int64Value>,
8878    {
8879        self.initialization_vector_crc32c = v.map(|x| x.into());
8880        self
8881    }
8882
8883    /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
8884    pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8885        self.verified_plaintext_crc32c = v.into();
8886        self
8887    }
8888
8889    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
8890    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
8891        mut self,
8892        v: T,
8893    ) -> Self {
8894        self.verified_additional_authenticated_data_crc32c = v.into();
8895        self
8896    }
8897
8898    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
8899    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
8900        mut self,
8901        v: T,
8902    ) -> Self {
8903        self.verified_initialization_vector_crc32c = v.into();
8904        self
8905    }
8906
8907    /// Sets the value of [name][crate::model::RawEncryptResponse::name].
8908    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8909        self.name = v.into();
8910        self
8911    }
8912
8913    /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
8914    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
8915        mut self,
8916        v: T,
8917    ) -> Self {
8918        self.protection_level = v.into();
8919        self
8920    }
8921}
8922
8923impl wkt::message::Message for RawEncryptResponse {
8924    fn typename() -> &'static str {
8925        "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
8926    }
8927}
8928
8929/// Response message for
8930/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
8931///
8932/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
8933#[derive(Clone, Default, PartialEq)]
8934#[non_exhaustive]
8935pub struct RawDecryptResponse {
8936    /// The decrypted data.
8937    pub plaintext: ::bytes::Bytes,
8938
8939    /// Integrity verification field. A CRC32C checksum of the returned
8940    /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
8941    /// An integrity check of plaintext can be performed by computing the CRC32C
8942    /// checksum of plaintext and comparing your results to this field. Discard the
8943    /// response in case of non-matching checksum values, and perform a limited
8944    /// number of retries. A persistent mismatch may indicate an issue in your
8945    /// computation of the CRC32C checksum. Note: receiving this response message
8946    /// indicates that
8947    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
8948    /// successfully decrypt the
8949    /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
8950    /// Note: This field is defined as int64 for reasons of compatibility across
8951    /// different languages. However, it is a non-negative integer, which will
8952    /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
8953    /// that support this type.
8954    ///
8955    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8956    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
8957    /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
8958    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
8959
8960    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
8961    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
8962    /// decryption.
8963    ///
8964    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8965    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
8966    pub protection_level: crate::model::ProtectionLevel,
8967
8968    /// Integrity verification field. A flag indicating whether
8969    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
8970    /// was received by
8971    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
8972    /// for the integrity verification of the ciphertext. A false value of this
8973    /// field indicates either that
8974    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
8975    /// was left unset or that it was not delivered to
8976    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
8977    /// set
8978    /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
8979    /// but this field is still false, discard the response and perform a limited
8980    /// number of retries.
8981    ///
8982    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
8983    /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
8984    pub verified_ciphertext_crc32c: bool,
8985
8986    /// Integrity verification field. A flag indicating whether
8987    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
8988    /// was received by
8989    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
8990    /// for the integrity verification of additional_authenticated_data. A false
8991    /// value of this field indicates either that //
8992    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
8993    /// was left unset or that it was not delivered to
8994    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
8995    /// set
8996    /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
8997    /// but this field is still false, discard the response and perform a limited
8998    /// number of retries.
8999    ///
9000    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9001    /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
9002    pub verified_additional_authenticated_data_crc32c: bool,
9003
9004    /// Integrity verification field. A flag indicating whether
9005    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
9006    /// was received by
9007    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9008    /// for the integrity verification of initialization_vector. A false value of
9009    /// this field indicates either that
9010    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
9011    /// was left unset or that it was not delivered to
9012    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9013    /// set
9014    /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
9015    /// but this field is still false, discard the response and perform a limited
9016    /// number of retries.
9017    ///
9018    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9019    /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
9020    pub verified_initialization_vector_crc32c: bool,
9021
9022    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9023}
9024
9025impl RawDecryptResponse {
9026    pub fn new() -> Self {
9027        std::default::Default::default()
9028    }
9029
9030    /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
9031    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9032        self.plaintext = v.into();
9033        self
9034    }
9035
9036    /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
9037    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
9038    where
9039        T: std::convert::Into<wkt::Int64Value>,
9040    {
9041        self.plaintext_crc32c = std::option::Option::Some(v.into());
9042        self
9043    }
9044
9045    /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
9046    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9047    where
9048        T: std::convert::Into<wkt::Int64Value>,
9049    {
9050        self.plaintext_crc32c = v.map(|x| x.into());
9051        self
9052    }
9053
9054    /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
9055    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9056        mut self,
9057        v: T,
9058    ) -> Self {
9059        self.protection_level = v.into();
9060        self
9061    }
9062
9063    /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
9064    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9065        self.verified_ciphertext_crc32c = v.into();
9066        self
9067    }
9068
9069    /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
9070    pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
9071        mut self,
9072        v: T,
9073    ) -> Self {
9074        self.verified_additional_authenticated_data_crc32c = v.into();
9075        self
9076    }
9077
9078    /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
9079    pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
9080        mut self,
9081        v: T,
9082    ) -> Self {
9083        self.verified_initialization_vector_crc32c = v.into();
9084        self
9085    }
9086}
9087
9088impl wkt::message::Message for RawDecryptResponse {
9089    fn typename() -> &'static str {
9090        "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
9091    }
9092}
9093
9094/// Response message for
9095/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
9096///
9097/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
9098#[derive(Clone, Default, PartialEq)]
9099#[non_exhaustive]
9100pub struct AsymmetricSignResponse {
9101    /// The created signature.
9102    pub signature: ::bytes::Bytes,
9103
9104    /// Integrity verification field. A CRC32C checksum of the returned
9105    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
9106    /// An integrity check of
9107    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
9108    /// can be performed by computing the CRC32C checksum of
9109    /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
9110    /// and comparing your results to this field. Discard the response in case of
9111    /// non-matching checksum values, and perform a limited number of retries. A
9112    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9113    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9114    /// across different languages. However, it is a non-negative integer, which
9115    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
9116    /// languages that support this type.
9117    ///
9118    /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
9119    pub signature_crc32c: std::option::Option<wkt::Int64Value>,
9120
9121    /// Integrity verification field. A flag indicating whether
9122    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
9123    /// was received by
9124    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9125    /// for the integrity verification of the
9126    /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
9127    /// of this field indicates either that
9128    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
9129    /// was left unset or that it was not delivered to
9130    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9131    /// set
9132    /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
9133    /// but this field is still false, discard the response and perform a limited
9134    /// number of retries.
9135    ///
9136    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
9137    /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
9138    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9139    pub verified_digest_crc32c: bool,
9140
9141    /// The resource name of the
9142    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
9143    /// Check this field to verify that the intended resource was used for signing.
9144    ///
9145    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9146    pub name: std::string::String,
9147
9148    /// Integrity verification field. A flag indicating whether
9149    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
9150    /// was received by
9151    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9152    /// for the integrity verification of the
9153    /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
9154    /// this field indicates either that
9155    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
9156    /// was left unset or that it was not delivered to
9157    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9158    /// set
9159    /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
9160    /// but this field is still false, discard the response and perform a limited
9161    /// number of retries.
9162    ///
9163    /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
9164    /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
9165    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9166    pub verified_data_crc32c: bool,
9167
9168    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9169    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
9170    ///
9171    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9172    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9173    pub protection_level: crate::model::ProtectionLevel,
9174
9175    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9176}
9177
9178impl AsymmetricSignResponse {
9179    pub fn new() -> Self {
9180        std::default::Default::default()
9181    }
9182
9183    /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
9184    pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9185        self.signature = v.into();
9186        self
9187    }
9188
9189    /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
9190    pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
9191    where
9192        T: std::convert::Into<wkt::Int64Value>,
9193    {
9194        self.signature_crc32c = std::option::Option::Some(v.into());
9195        self
9196    }
9197
9198    /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
9199    pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9200    where
9201        T: std::convert::Into<wkt::Int64Value>,
9202    {
9203        self.signature_crc32c = v.map(|x| x.into());
9204        self
9205    }
9206
9207    /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
9208    pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9209        self.verified_digest_crc32c = v.into();
9210        self
9211    }
9212
9213    /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
9214    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9215        self.name = v.into();
9216        self
9217    }
9218
9219    /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
9220    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9221        self.verified_data_crc32c = v.into();
9222        self
9223    }
9224
9225    /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
9226    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9227        mut self,
9228        v: T,
9229    ) -> Self {
9230        self.protection_level = v.into();
9231        self
9232    }
9233}
9234
9235impl wkt::message::Message for AsymmetricSignResponse {
9236    fn typename() -> &'static str {
9237        "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
9238    }
9239}
9240
9241/// Response message for
9242/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
9243///
9244/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
9245#[derive(Clone, Default, PartialEq)]
9246#[non_exhaustive]
9247pub struct AsymmetricDecryptResponse {
9248    /// The decrypted data originally encrypted with the matching public key.
9249    pub plaintext: ::bytes::Bytes,
9250
9251    /// Integrity verification field. A CRC32C checksum of the returned
9252    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
9253    /// An integrity check of
9254    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
9255    /// can be performed by computing the CRC32C checksum of
9256    /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
9257    /// and comparing your results to this field. Discard the response in case of
9258    /// non-matching checksum values, and perform a limited number of retries. A
9259    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9260    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9261    /// across different languages. However, it is a non-negative integer, which
9262    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
9263    /// languages that support this type.
9264    ///
9265    /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
9266    pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
9267
9268    /// Integrity verification field. A flag indicating whether
9269    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
9270    /// was received by
9271    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9272    /// for the integrity verification of the
9273    /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
9274    /// false value of this field indicates either that
9275    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
9276    /// was left unset or that it was not delivered to
9277    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9278    /// set
9279    /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
9280    /// but this field is still false, discard the response and perform a limited
9281    /// number of retries.
9282    ///
9283    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
9284    /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
9285    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9286    pub verified_ciphertext_crc32c: bool,
9287
9288    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9289    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
9290    /// decryption.
9291    ///
9292    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9293    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9294    pub protection_level: crate::model::ProtectionLevel,
9295
9296    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9297}
9298
9299impl AsymmetricDecryptResponse {
9300    pub fn new() -> Self {
9301        std::default::Default::default()
9302    }
9303
9304    /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
9305    pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9306        self.plaintext = v.into();
9307        self
9308    }
9309
9310    /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
9311    pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
9312    where
9313        T: std::convert::Into<wkt::Int64Value>,
9314    {
9315        self.plaintext_crc32c = std::option::Option::Some(v.into());
9316        self
9317    }
9318
9319    /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
9320    pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9321    where
9322        T: std::convert::Into<wkt::Int64Value>,
9323    {
9324        self.plaintext_crc32c = v.map(|x| x.into());
9325        self
9326    }
9327
9328    /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
9329    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9330        self.verified_ciphertext_crc32c = v.into();
9331        self
9332    }
9333
9334    /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
9335    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9336        mut self,
9337        v: T,
9338    ) -> Self {
9339        self.protection_level = v.into();
9340        self
9341    }
9342}
9343
9344impl wkt::message::Message for AsymmetricDecryptResponse {
9345    fn typename() -> &'static str {
9346        "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
9347    }
9348}
9349
9350/// Response message for
9351/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
9352///
9353/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
9354#[derive(Clone, Default, PartialEq)]
9355#[non_exhaustive]
9356pub struct MacSignResponse {
9357    /// The resource name of the
9358    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
9359    /// Check this field to verify that the intended resource was used for signing.
9360    ///
9361    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9362    pub name: std::string::String,
9363
9364    /// The created signature.
9365    pub mac: ::bytes::Bytes,
9366
9367    /// Integrity verification field. A CRC32C checksum of the returned
9368    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
9369    /// integrity check of
9370    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
9371    /// performed by computing the CRC32C checksum of
9372    /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
9373    /// comparing your results to this field. Discard the response in case of
9374    /// non-matching checksum values, and perform a limited number of retries. A
9375    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9376    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9377    /// across different languages. However, it is a non-negative integer, which
9378    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
9379    /// languages that support this type.
9380    ///
9381    /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
9382    pub mac_crc32c: std::option::Option<wkt::Int64Value>,
9383
9384    /// Integrity verification field. A flag indicating whether
9385    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
9386    /// was received by
9387    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9388    /// for the integrity verification of the
9389    /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
9390    /// field indicates either that
9391    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
9392    /// was left unset or that it was not delivered to
9393    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9394    /// set
9395    /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
9396    /// but this field is still false, discard the response and perform a limited
9397    /// number of retries.
9398    ///
9399    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9400    /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
9401    /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
9402    pub verified_data_crc32c: bool,
9403
9404    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9405    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
9406    ///
9407    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9408    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9409    pub protection_level: crate::model::ProtectionLevel,
9410
9411    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9412}
9413
9414impl MacSignResponse {
9415    pub fn new() -> Self {
9416        std::default::Default::default()
9417    }
9418
9419    /// Sets the value of [name][crate::model::MacSignResponse::name].
9420    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9421        self.name = v.into();
9422        self
9423    }
9424
9425    /// Sets the value of [mac][crate::model::MacSignResponse::mac].
9426    pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9427        self.mac = v.into();
9428        self
9429    }
9430
9431    /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
9432    pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
9433    where
9434        T: std::convert::Into<wkt::Int64Value>,
9435    {
9436        self.mac_crc32c = std::option::Option::Some(v.into());
9437        self
9438    }
9439
9440    /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
9441    pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9442    where
9443        T: std::convert::Into<wkt::Int64Value>,
9444    {
9445        self.mac_crc32c = v.map(|x| x.into());
9446        self
9447    }
9448
9449    /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
9450    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9451        self.verified_data_crc32c = v.into();
9452        self
9453    }
9454
9455    /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
9456    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9457        mut self,
9458        v: T,
9459    ) -> Self {
9460        self.protection_level = v.into();
9461        self
9462    }
9463}
9464
9465impl wkt::message::Message for MacSignResponse {
9466    fn typename() -> &'static str {
9467        "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
9468    }
9469}
9470
9471/// Response message for
9472/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
9473///
9474/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
9475#[derive(Clone, Default, PartialEq)]
9476#[non_exhaustive]
9477pub struct MacVerifyResponse {
9478    /// The resource name of the
9479    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
9480    /// verification. Check this field to verify that the intended resource was
9481    /// used for verification.
9482    ///
9483    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9484    pub name: std::string::String,
9485
9486    /// This field indicates whether or not the verification operation for
9487    /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
9488    /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
9489    /// successful.
9490    ///
9491    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
9492    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
9493    pub success: bool,
9494
9495    /// Integrity verification field. A flag indicating whether
9496    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
9497    /// was received by
9498    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9499    /// for the integrity verification of the
9500    /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
9501    /// field indicates either that
9502    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
9503    /// was left unset or that it was not delivered to
9504    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9505    /// set
9506    /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
9507    /// but this field is still false, discard the response and perform a limited
9508    /// number of retries.
9509    ///
9510    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9511    /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
9512    /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
9513    pub verified_data_crc32c: bool,
9514
9515    /// Integrity verification field. A flag indicating whether
9516    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
9517    /// was received by
9518    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9519    /// for the integrity verification of the
9520    /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
9521    /// field indicates either that
9522    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
9523    /// was left unset or that it was not delivered to
9524    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9525    /// set
9526    /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
9527    /// but this field is still false, discard the response and perform a limited
9528    /// number of retries.
9529    ///
9530    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9531    /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
9532    /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
9533    pub verified_mac_crc32c: bool,
9534
9535    /// Integrity verification field. This value is used for the integrity
9536    /// verification of [MacVerifyResponse.success]. If the value of this field
9537    /// contradicts the value of [MacVerifyResponse.success], discard the response
9538    /// and perform a limited number of retries.
9539    pub verified_success_integrity: bool,
9540
9541    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9542    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
9543    /// verification.
9544    ///
9545    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9546    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9547    pub protection_level: crate::model::ProtectionLevel,
9548
9549    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9550}
9551
9552impl MacVerifyResponse {
9553    pub fn new() -> Self {
9554        std::default::Default::default()
9555    }
9556
9557    /// Sets the value of [name][crate::model::MacVerifyResponse::name].
9558    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9559        self.name = v.into();
9560        self
9561    }
9562
9563    /// Sets the value of [success][crate::model::MacVerifyResponse::success].
9564    pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9565        self.success = v.into();
9566        self
9567    }
9568
9569    /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
9570    pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9571        self.verified_data_crc32c = v.into();
9572        self
9573    }
9574
9575    /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
9576    pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9577        self.verified_mac_crc32c = v.into();
9578        self
9579    }
9580
9581    /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
9582    pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9583        self.verified_success_integrity = v.into();
9584        self
9585    }
9586
9587    /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
9588    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9589        mut self,
9590        v: T,
9591    ) -> Self {
9592        self.protection_level = v.into();
9593        self
9594    }
9595}
9596
9597impl wkt::message::Message for MacVerifyResponse {
9598    fn typename() -> &'static str {
9599        "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
9600    }
9601}
9602
9603/// Response message for
9604/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
9605///
9606/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
9607#[derive(Clone, Default, PartialEq)]
9608#[non_exhaustive]
9609pub struct DecapsulateResponse {
9610    /// The resource name of the
9611    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
9612    /// decapsulation. Check this field to verify that the intended resource was
9613    /// used for decapsulation.
9614    ///
9615    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9616    pub name: std::string::String,
9617
9618    /// The decapsulated shared_secret originally encapsulated with the matching
9619    /// public key.
9620    pub shared_secret: ::bytes::Bytes,
9621
9622    /// Integrity verification field. A CRC32C checksum of the returned
9623    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
9624    /// An integrity check of
9625    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
9626    /// can be performed by computing the CRC32C checksum of
9627    /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
9628    /// and comparing your results to this field. Discard the response in case of
9629    /// non-matching checksum values, and perform a limited number of retries. A
9630    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9631    /// checksum. Note: receiving this response message indicates that
9632    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
9633    /// successfully decrypt the
9634    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
9635    /// field is defined as int64 for reasons of compatibility across different
9636    /// languages. However, it is a non-negative integer, which will never exceed
9637    /// 2^32-1, and can be safely downconverted to uint32 in languages that support
9638    /// this type.
9639    ///
9640    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
9641    /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
9642    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9643    pub shared_secret_crc32c: std::option::Option<i64>,
9644
9645    /// Integrity verification field. A flag indicating whether
9646    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
9647    /// was received by
9648    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
9649    /// for the integrity verification of the
9650    /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
9651    /// value of this field indicates either that
9652    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
9653    /// was left unset or that it was not delivered to
9654    /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
9655    /// set
9656    /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
9657    /// but this field is still false, discard the response and perform a limited
9658    /// number of retries.
9659    ///
9660    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
9661    /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
9662    /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
9663    pub verified_ciphertext_crc32c: bool,
9664
9665    /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9666    /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
9667    /// decapsulation.
9668    ///
9669    /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9670    /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9671    pub protection_level: crate::model::ProtectionLevel,
9672
9673    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9674}
9675
9676impl DecapsulateResponse {
9677    pub fn new() -> Self {
9678        std::default::Default::default()
9679    }
9680
9681    /// Sets the value of [name][crate::model::DecapsulateResponse::name].
9682    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9683        self.name = v.into();
9684        self
9685    }
9686
9687    /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
9688    pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9689        self.shared_secret = v.into();
9690        self
9691    }
9692
9693    /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
9694    pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
9695    where
9696        T: std::convert::Into<i64>,
9697    {
9698        self.shared_secret_crc32c = std::option::Option::Some(v.into());
9699        self
9700    }
9701
9702    /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
9703    pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9704    where
9705        T: std::convert::Into<i64>,
9706    {
9707        self.shared_secret_crc32c = v.map(|x| x.into());
9708        self
9709    }
9710
9711    /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
9712    pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9713        self.verified_ciphertext_crc32c = v.into();
9714        self
9715    }
9716
9717    /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
9718    pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9719        mut self,
9720        v: T,
9721    ) -> Self {
9722        self.protection_level = v.into();
9723        self
9724    }
9725}
9726
9727impl wkt::message::Message for DecapsulateResponse {
9728    fn typename() -> &'static str {
9729        "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
9730    }
9731}
9732
9733/// Response message for
9734/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
9735///
9736/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
9737#[derive(Clone, Default, PartialEq)]
9738#[non_exhaustive]
9739pub struct GenerateRandomBytesResponse {
9740    /// The generated data.
9741    pub data: ::bytes::Bytes,
9742
9743    /// Integrity verification field. A CRC32C checksum of the returned
9744    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
9745    /// An integrity check of
9746    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
9747    /// can be performed by computing the CRC32C checksum of
9748    /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
9749    /// and comparing your results to this field. Discard the response in case of
9750    /// non-matching checksum values, and perform a limited number of retries. A
9751    /// persistent mismatch may indicate an issue in your computation of the CRC32C
9752    /// checksum. Note: This field is defined as int64 for reasons of compatibility
9753    /// across different languages. However, it is a non-negative integer, which
9754    /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
9755    /// languages that support this type.
9756    ///
9757    /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
9758    pub data_crc32c: std::option::Option<wkt::Int64Value>,
9759
9760    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9761}
9762
9763impl GenerateRandomBytesResponse {
9764    pub fn new() -> Self {
9765        std::default::Default::default()
9766    }
9767
9768    /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
9769    pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9770        self.data = v.into();
9771        self
9772    }
9773
9774    /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
9775    pub fn set_data_crc32c<T>(mut self, v: T) -> Self
9776    where
9777        T: std::convert::Into<wkt::Int64Value>,
9778    {
9779        self.data_crc32c = std::option::Option::Some(v.into());
9780        self
9781    }
9782
9783    /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
9784    pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9785    where
9786        T: std::convert::Into<wkt::Int64Value>,
9787    {
9788        self.data_crc32c = v.map(|x| x.into());
9789        self
9790    }
9791}
9792
9793impl wkt::message::Message for GenerateRandomBytesResponse {
9794    fn typename() -> &'static str {
9795        "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
9796    }
9797}
9798
9799/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
9800///
9801/// [google.cloud.kms.v1.Digest]: crate::model::Digest
9802#[derive(Clone, Default, PartialEq)]
9803#[non_exhaustive]
9804pub struct Digest {
9805    /// Required. The message digest.
9806    pub digest: std::option::Option<crate::model::digest::Digest>,
9807
9808    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9809}
9810
9811impl Digest {
9812    pub fn new() -> Self {
9813        std::default::Default::default()
9814    }
9815
9816    /// Sets the value of [digest][crate::model::Digest::digest].
9817    ///
9818    /// Note that all the setters affecting `digest` are mutually
9819    /// exclusive.
9820    pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
9821        mut self,
9822        v: T,
9823    ) -> Self {
9824        self.digest = v.into();
9825        self
9826    }
9827
9828    /// The value of [digest][crate::model::Digest::digest]
9829    /// if it holds a `Sha256`, `None` if the field is not set or
9830    /// holds a different branch.
9831    pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
9832        #[allow(unreachable_patterns)]
9833        self.digest.as_ref().and_then(|v| match v {
9834            crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
9835            _ => std::option::Option::None,
9836        })
9837    }
9838
9839    /// Sets the value of [digest][crate::model::Digest::digest]
9840    /// to hold a `Sha256`.
9841    ///
9842    /// Note that all the setters affecting `digest` are
9843    /// mutually exclusive.
9844    pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9845        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
9846        self
9847    }
9848
9849    /// The value of [digest][crate::model::Digest::digest]
9850    /// if it holds a `Sha384`, `None` if the field is not set or
9851    /// holds a different branch.
9852    pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
9853        #[allow(unreachable_patterns)]
9854        self.digest.as_ref().and_then(|v| match v {
9855            crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
9856            _ => std::option::Option::None,
9857        })
9858    }
9859
9860    /// Sets the value of [digest][crate::model::Digest::digest]
9861    /// to hold a `Sha384`.
9862    ///
9863    /// Note that all the setters affecting `digest` are
9864    /// mutually exclusive.
9865    pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9866        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
9867        self
9868    }
9869
9870    /// The value of [digest][crate::model::Digest::digest]
9871    /// if it holds a `Sha512`, `None` if the field is not set or
9872    /// holds a different branch.
9873    pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
9874        #[allow(unreachable_patterns)]
9875        self.digest.as_ref().and_then(|v| match v {
9876            crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
9877            _ => std::option::Option::None,
9878        })
9879    }
9880
9881    /// Sets the value of [digest][crate::model::Digest::digest]
9882    /// to hold a `Sha512`.
9883    ///
9884    /// Note that all the setters affecting `digest` are
9885    /// mutually exclusive.
9886    pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9887        self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
9888        self
9889    }
9890}
9891
9892impl wkt::message::Message for Digest {
9893    fn typename() -> &'static str {
9894        "type.googleapis.com/google.cloud.kms.v1.Digest"
9895    }
9896}
9897
9898/// Defines additional types related to [Digest].
9899pub mod digest {
9900    #[allow(unused_imports)]
9901    use super::*;
9902
9903    /// Required. The message digest.
9904    #[derive(Clone, Debug, PartialEq)]
9905    #[non_exhaustive]
9906    pub enum Digest {
9907        /// A message digest produced with the SHA-256 algorithm.
9908        Sha256(::bytes::Bytes),
9909        /// A message digest produced with the SHA-384 algorithm.
9910        Sha384(::bytes::Bytes),
9911        /// A message digest produced with the SHA-512 algorithm.
9912        Sha512(::bytes::Bytes),
9913    }
9914}
9915
9916/// Cloud KMS metadata for the given
9917/// [google.cloud.location.Location][google.cloud.location.Location].
9918///
9919/// [google.cloud.location.Location]: location::model::Location
9920#[derive(Clone, Default, PartialEq)]
9921#[non_exhaustive]
9922pub struct LocationMetadata {
9923    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
9924    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9925    /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
9926    /// location.
9927    ///
9928    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9929    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9930    /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9931    pub hsm_available: bool,
9932
9933    /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
9934    /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9935    /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
9936    /// this location.
9937    ///
9938    /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9939    /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9940    /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
9941    pub ekm_available: bool,
9942
9943    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9944}
9945
9946impl LocationMetadata {
9947    pub fn new() -> Self {
9948        std::default::Default::default()
9949    }
9950
9951    /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
9952    pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9953        self.hsm_available = v.into();
9954        self
9955    }
9956
9957    /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
9958    pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9959        self.ekm_available = v.into();
9960        self
9961    }
9962}
9963
9964impl wkt::message::Message for LocationMetadata {
9965    fn typename() -> &'static str {
9966        "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
9967    }
9968}
9969
9970/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
9971/// cryptographic operations are performed. For more information, see [Protection
9972/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
9973///
9974/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9975///
9976/// # Working with unknown values
9977///
9978/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9979/// additional enum variants at any time. Adding new variants is not considered
9980/// a breaking change. Applications should write their code in anticipation of:
9981///
9982/// - New values appearing in future releases of the client library, **and**
9983/// - New values received dynamically, without application changes.
9984///
9985/// Please consult the [Working with enums] section in the user guide for some
9986/// guidelines.
9987///
9988/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9989#[derive(Clone, Debug, PartialEq)]
9990#[non_exhaustive]
9991pub enum ProtectionLevel {
9992    /// Not specified.
9993    Unspecified,
9994    /// Crypto operations are performed in software.
9995    Software,
9996    /// Crypto operations are performed in a Hardware Security Module.
9997    Hsm,
9998    /// Crypto operations are performed by an external key manager.
9999    External,
10000    /// Crypto operations are performed in an EKM-over-VPC backend.
10001    ExternalVpc,
10002    /// If set, the enum was initialized with an unknown value.
10003    ///
10004    /// Applications can examine the value using [ProtectionLevel::value] or
10005    /// [ProtectionLevel::name].
10006    UnknownValue(protection_level::UnknownValue),
10007}
10008
10009#[doc(hidden)]
10010pub mod protection_level {
10011    #[allow(unused_imports)]
10012    use super::*;
10013    #[derive(Clone, Debug, PartialEq)]
10014    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10015}
10016
10017impl ProtectionLevel {
10018    /// Gets the enum value.
10019    ///
10020    /// Returns `None` if the enum contains an unknown value deserialized from
10021    /// the string representation of enums.
10022    pub fn value(&self) -> std::option::Option<i32> {
10023        match self {
10024            Self::Unspecified => std::option::Option::Some(0),
10025            Self::Software => std::option::Option::Some(1),
10026            Self::Hsm => std::option::Option::Some(2),
10027            Self::External => std::option::Option::Some(3),
10028            Self::ExternalVpc => std::option::Option::Some(4),
10029            Self::UnknownValue(u) => u.0.value(),
10030        }
10031    }
10032
10033    /// Gets the enum value as a string.
10034    ///
10035    /// Returns `None` if the enum contains an unknown value deserialized from
10036    /// the integer representation of enums.
10037    pub fn name(&self) -> std::option::Option<&str> {
10038        match self {
10039            Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
10040            Self::Software => std::option::Option::Some("SOFTWARE"),
10041            Self::Hsm => std::option::Option::Some("HSM"),
10042            Self::External => std::option::Option::Some("EXTERNAL"),
10043            Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
10044            Self::UnknownValue(u) => u.0.name(),
10045        }
10046    }
10047}
10048
10049impl std::default::Default for ProtectionLevel {
10050    fn default() -> Self {
10051        use std::convert::From;
10052        Self::from(0)
10053    }
10054}
10055
10056impl std::fmt::Display for ProtectionLevel {
10057    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10058        wkt::internal::display_enum(f, self.name(), self.value())
10059    }
10060}
10061
10062impl std::convert::From<i32> for ProtectionLevel {
10063    fn from(value: i32) -> Self {
10064        match value {
10065            0 => Self::Unspecified,
10066            1 => Self::Software,
10067            2 => Self::Hsm,
10068            3 => Self::External,
10069            4 => Self::ExternalVpc,
10070            _ => Self::UnknownValue(protection_level::UnknownValue(
10071                wkt::internal::UnknownEnumValue::Integer(value),
10072            )),
10073        }
10074    }
10075}
10076
10077impl std::convert::From<&str> for ProtectionLevel {
10078    fn from(value: &str) -> Self {
10079        use std::string::ToString;
10080        match value {
10081            "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
10082            "SOFTWARE" => Self::Software,
10083            "HSM" => Self::Hsm,
10084            "EXTERNAL" => Self::External,
10085            "EXTERNAL_VPC" => Self::ExternalVpc,
10086            _ => Self::UnknownValue(protection_level::UnknownValue(
10087                wkt::internal::UnknownEnumValue::String(value.to_string()),
10088            )),
10089        }
10090    }
10091}
10092
10093impl serde::ser::Serialize for ProtectionLevel {
10094    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10095    where
10096        S: serde::Serializer,
10097    {
10098        match self {
10099            Self::Unspecified => serializer.serialize_i32(0),
10100            Self::Software => serializer.serialize_i32(1),
10101            Self::Hsm => serializer.serialize_i32(2),
10102            Self::External => serializer.serialize_i32(3),
10103            Self::ExternalVpc => serializer.serialize_i32(4),
10104            Self::UnknownValue(u) => u.0.serialize(serializer),
10105        }
10106    }
10107}
10108
10109impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
10110    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10111    where
10112        D: serde::Deserializer<'de>,
10113    {
10114        deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
10115            ".google.cloud.kms.v1.ProtectionLevel",
10116        ))
10117    }
10118}
10119
10120/// Describes the reason for a data access. Please refer to
10121/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
10122/// for the detailed semantic meaning of justification reason codes.
10123///
10124/// # Working with unknown values
10125///
10126/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10127/// additional enum variants at any time. Adding new variants is not considered
10128/// a breaking change. Applications should write their code in anticipation of:
10129///
10130/// - New values appearing in future releases of the client library, **and**
10131/// - New values received dynamically, without application changes.
10132///
10133/// Please consult the [Working with enums] section in the user guide for some
10134/// guidelines.
10135///
10136/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10137#[derive(Clone, Debug, PartialEq)]
10138#[non_exhaustive]
10139pub enum AccessReason {
10140    /// Unspecified access reason.
10141    ReasonUnspecified,
10142    /// Customer-initiated support.
10143    CustomerInitiatedSupport,
10144    /// Google-initiated access for system management and troubleshooting.
10145    GoogleInitiatedService,
10146    /// Google-initiated access in response to a legal request or legal process.
10147    ThirdPartyDataRequest,
10148    /// Google-initiated access for security, fraud, abuse, or compliance purposes.
10149    GoogleInitiatedReview,
10150    /// Customer uses their account to perform any access to their own data which
10151    /// their IAM policy authorizes.
10152    CustomerInitiatedAccess,
10153    /// Google systems access customer data to help optimize the structure of the
10154    /// data or quality for future uses by the customer.
10155    GoogleInitiatedSystemOperation,
10156    /// No reason is expected for this key request.
10157    ReasonNotExpected,
10158    /// Customer uses their account to perform any access to their own data which
10159    /// their IAM policy authorizes, and one of the following is true:
10160    ///
10161    /// * A Google administrator has reset the root-access account associated with
10162    ///   the user's organization within the past 7 days.
10163    /// * A Google-initiated emergency access operation has interacted with a
10164    ///   resource in the same project or folder as the currently accessed resource
10165    ///   within the past 7 days.
10166    ModifiedCustomerInitiatedAccess,
10167    /// Google systems access customer data to help optimize the structure of the
10168    /// data or quality for future uses by the customer, and one of the following
10169    /// is true:
10170    ///
10171    /// * A Google administrator has reset the root-access account associated with
10172    ///   the user's organization within the past 7 days.
10173    /// * A Google-initiated emergency access operation has interacted with a
10174    ///   resource in the same project or folder as the currently accessed resource
10175    ///   within the past 7 days.
10176    ModifiedGoogleInitiatedSystemOperation,
10177    /// Google-initiated access to maintain system reliability.
10178    GoogleResponseToProductionAlert,
10179    /// One of the following operations is being executed while simultaneously
10180    /// encountering an internal technical issue which prevented a more precise
10181    /// justification code from being generated:
10182    ///
10183    /// * Your account has been used to perform any access to your own data which
10184    ///   your IAM policy authorizes.
10185    /// * An automated Google system operates on encrypted customer data which your
10186    ///   IAM policy authorizes.
10187    /// * Customer-initiated Google support access.
10188    /// * Google-initiated support access to protect system reliability.
10189    CustomerAuthorizedWorkflowServicing,
10190    /// If set, the enum was initialized with an unknown value.
10191    ///
10192    /// Applications can examine the value using [AccessReason::value] or
10193    /// [AccessReason::name].
10194    UnknownValue(access_reason::UnknownValue),
10195}
10196
10197#[doc(hidden)]
10198pub mod access_reason {
10199    #[allow(unused_imports)]
10200    use super::*;
10201    #[derive(Clone, Debug, PartialEq)]
10202    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10203}
10204
10205impl AccessReason {
10206    /// Gets the enum value.
10207    ///
10208    /// Returns `None` if the enum contains an unknown value deserialized from
10209    /// the string representation of enums.
10210    pub fn value(&self) -> std::option::Option<i32> {
10211        match self {
10212            Self::ReasonUnspecified => std::option::Option::Some(0),
10213            Self::CustomerInitiatedSupport => std::option::Option::Some(1),
10214            Self::GoogleInitiatedService => std::option::Option::Some(2),
10215            Self::ThirdPartyDataRequest => std::option::Option::Some(3),
10216            Self::GoogleInitiatedReview => std::option::Option::Some(4),
10217            Self::CustomerInitiatedAccess => std::option::Option::Some(5),
10218            Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
10219            Self::ReasonNotExpected => std::option::Option::Some(7),
10220            Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
10221            Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
10222            Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
10223            Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
10224            Self::UnknownValue(u) => u.0.value(),
10225        }
10226    }
10227
10228    /// Gets the enum value as a string.
10229    ///
10230    /// Returns `None` if the enum contains an unknown value deserialized from
10231    /// the integer representation of enums.
10232    pub fn name(&self) -> std::option::Option<&str> {
10233        match self {
10234            Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
10235            Self::CustomerInitiatedSupport => {
10236                std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
10237            }
10238            Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
10239            Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
10240            Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
10241            Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
10242            Self::GoogleInitiatedSystemOperation => {
10243                std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
10244            }
10245            Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
10246            Self::ModifiedCustomerInitiatedAccess => {
10247                std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
10248            }
10249            Self::ModifiedGoogleInitiatedSystemOperation => {
10250                std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
10251            }
10252            Self::GoogleResponseToProductionAlert => {
10253                std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
10254            }
10255            Self::CustomerAuthorizedWorkflowServicing => {
10256                std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
10257            }
10258            Self::UnknownValue(u) => u.0.name(),
10259        }
10260    }
10261}
10262
10263impl std::default::Default for AccessReason {
10264    fn default() -> Self {
10265        use std::convert::From;
10266        Self::from(0)
10267    }
10268}
10269
10270impl std::fmt::Display for AccessReason {
10271    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10272        wkt::internal::display_enum(f, self.name(), self.value())
10273    }
10274}
10275
10276impl std::convert::From<i32> for AccessReason {
10277    fn from(value: i32) -> Self {
10278        match value {
10279            0 => Self::ReasonUnspecified,
10280            1 => Self::CustomerInitiatedSupport,
10281            2 => Self::GoogleInitiatedService,
10282            3 => Self::ThirdPartyDataRequest,
10283            4 => Self::GoogleInitiatedReview,
10284            5 => Self::CustomerInitiatedAccess,
10285            6 => Self::GoogleInitiatedSystemOperation,
10286            7 => Self::ReasonNotExpected,
10287            8 => Self::ModifiedCustomerInitiatedAccess,
10288            9 => Self::ModifiedGoogleInitiatedSystemOperation,
10289            10 => Self::GoogleResponseToProductionAlert,
10290            11 => Self::CustomerAuthorizedWorkflowServicing,
10291            _ => Self::UnknownValue(access_reason::UnknownValue(
10292                wkt::internal::UnknownEnumValue::Integer(value),
10293            )),
10294        }
10295    }
10296}
10297
10298impl std::convert::From<&str> for AccessReason {
10299    fn from(value: &str) -> Self {
10300        use std::string::ToString;
10301        match value {
10302            "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
10303            "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
10304            "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
10305            "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
10306            "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
10307            "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
10308            "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
10309            "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
10310            "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
10311            "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
10312                Self::ModifiedGoogleInitiatedSystemOperation
10313            }
10314            "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
10315            "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
10316            _ => Self::UnknownValue(access_reason::UnknownValue(
10317                wkt::internal::UnknownEnumValue::String(value.to_string()),
10318            )),
10319        }
10320    }
10321}
10322
10323impl serde::ser::Serialize for AccessReason {
10324    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10325    where
10326        S: serde::Serializer,
10327    {
10328        match self {
10329            Self::ReasonUnspecified => serializer.serialize_i32(0),
10330            Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
10331            Self::GoogleInitiatedService => serializer.serialize_i32(2),
10332            Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
10333            Self::GoogleInitiatedReview => serializer.serialize_i32(4),
10334            Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
10335            Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
10336            Self::ReasonNotExpected => serializer.serialize_i32(7),
10337            Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
10338            Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
10339            Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
10340            Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
10341            Self::UnknownValue(u) => u.0.serialize(serializer),
10342        }
10343    }
10344}
10345
10346impl<'de> serde::de::Deserialize<'de> for AccessReason {
10347    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10348    where
10349        D: serde::Deserializer<'de>,
10350    {
10351        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
10352            ".google.cloud.kms.v1.AccessReason",
10353        ))
10354    }
10355}