google_cloud_kms_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Request message for
40/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
41///
42/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct CreateKeyHandleRequest {
46 /// Required. Name of the resource project and location to create the
47 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
48 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
49 ///
50 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
51 pub parent: std::string::String,
52
53 /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
54 /// unique to the resource project and location. If not provided by the caller,
55 /// a new UUID is used.
56 ///
57 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
58 pub key_handle_id: std::string::String,
59
60 /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
61 ///
62 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
63 pub key_handle: std::option::Option<crate::model::KeyHandle>,
64
65 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
66}
67
68impl CreateKeyHandleRequest {
69 /// Creates a new default instance.
70 pub fn new() -> Self {
71 std::default::Default::default()
72 }
73
74 /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
75 ///
76 /// # Example
77 /// ```ignore,no_run
78 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
79 /// let x = CreateKeyHandleRequest::new().set_parent("example");
80 /// ```
81 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82 self.parent = v.into();
83 self
84 }
85
86 /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
87 ///
88 /// # Example
89 /// ```ignore,no_run
90 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
91 /// let x = CreateKeyHandleRequest::new().set_key_handle_id("example");
92 /// ```
93 pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94 self.key_handle_id = v.into();
95 self
96 }
97
98 /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
99 ///
100 /// # Example
101 /// ```ignore,no_run
102 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
103 /// use google_cloud_kms_v1::model::KeyHandle;
104 /// let x = CreateKeyHandleRequest::new().set_key_handle(KeyHandle::default()/* use setters */);
105 /// ```
106 pub fn set_key_handle<T>(mut self, v: T) -> Self
107 where
108 T: std::convert::Into<crate::model::KeyHandle>,
109 {
110 self.key_handle = std::option::Option::Some(v.into());
111 self
112 }
113
114 /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
119 /// use google_cloud_kms_v1::model::KeyHandle;
120 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(Some(KeyHandle::default()/* use setters */));
121 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(None::<KeyHandle>);
122 /// ```
123 pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
124 where
125 T: std::convert::Into<crate::model::KeyHandle>,
126 {
127 self.key_handle = v.map(|x| x.into());
128 self
129 }
130}
131
132impl wkt::message::Message for CreateKeyHandleRequest {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
135 }
136}
137
138/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
139///
140/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
141#[derive(Clone, Default, PartialEq)]
142#[non_exhaustive]
143pub struct GetKeyHandleRequest {
144 /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
145 /// e.g.
146 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
147 ///
148 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
149 pub name: std::string::String,
150
151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
152}
153
154impl GetKeyHandleRequest {
155 /// Creates a new default instance.
156 pub fn new() -> Self {
157 std::default::Default::default()
158 }
159
160 /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_kms_v1::model::GetKeyHandleRequest;
165 /// let x = GetKeyHandleRequest::new().set_name("example");
166 /// ```
167 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
168 self.name = v.into();
169 self
170 }
171}
172
173impl wkt::message::Message for GetKeyHandleRequest {
174 fn typename() -> &'static str {
175 "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
176 }
177}
178
179/// Resource-oriented representation of a request to Cloud KMS Autokey and the
180/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
181///
182/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
183#[derive(Clone, Default, PartialEq)]
184#[non_exhaustive]
185pub struct KeyHandle {
186 /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
187 /// resource, e.g.
188 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
189 ///
190 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
191 pub name: std::string::String,
192
193 /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
194 /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
195 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
196 /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
197 /// project will reflect the value configured in the
198 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
199 /// project's ancestor folder at the time of the
200 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
201 /// ancestor folder has a configured
202 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
203 /// configurations is used.
204 ///
205 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
206 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
207 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
208 pub kms_key: std::string::String,
209
210 /// Required. Indicates the resource type that the resulting
211 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
212 /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
213 /// types.
214 ///
215 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
216 pub resource_type_selector: std::string::String,
217
218 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
219}
220
221impl KeyHandle {
222 /// Creates a new default instance.
223 pub fn new() -> Self {
224 std::default::Default::default()
225 }
226
227 /// Sets the value of [name][crate::model::KeyHandle::name].
228 ///
229 /// # Example
230 /// ```ignore,no_run
231 /// # use google_cloud_kms_v1::model::KeyHandle;
232 /// let x = KeyHandle::new().set_name("example");
233 /// ```
234 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
235 self.name = v.into();
236 self
237 }
238
239 /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
240 ///
241 /// # Example
242 /// ```ignore,no_run
243 /// # use google_cloud_kms_v1::model::KeyHandle;
244 /// let x = KeyHandle::new().set_kms_key("example");
245 /// ```
246 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
247 self.kms_key = v.into();
248 self
249 }
250
251 /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
252 ///
253 /// # Example
254 /// ```ignore,no_run
255 /// # use google_cloud_kms_v1::model::KeyHandle;
256 /// let x = KeyHandle::new().set_resource_type_selector("example");
257 /// ```
258 pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
259 mut self,
260 v: T,
261 ) -> Self {
262 self.resource_type_selector = v.into();
263 self
264 }
265}
266
267impl wkt::message::Message for KeyHandle {
268 fn typename() -> &'static str {
269 "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
270 }
271}
272
273/// Metadata message for
274/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
275/// operation response.
276///
277/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
278#[derive(Clone, Default, PartialEq)]
279#[non_exhaustive]
280pub struct CreateKeyHandleMetadata {
281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
282}
283
284impl CreateKeyHandleMetadata {
285 /// Creates a new default instance.
286 pub fn new() -> Self {
287 std::default::Default::default()
288 }
289}
290
291impl wkt::message::Message for CreateKeyHandleMetadata {
292 fn typename() -> &'static str {
293 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
294 }
295}
296
297/// Request message for
298/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
299///
300/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
301#[derive(Clone, Default, PartialEq)]
302#[non_exhaustive]
303pub struct ListKeyHandlesRequest {
304 /// Required. Name of the resource project and location from which to list
305 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
306 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
307 ///
308 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
309 pub parent: std::string::String,
310
311 /// Optional. Optional limit on the number of
312 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
313 /// service may return fewer than this value. Further
314 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
315 /// including the
316 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
317 /// in a subsequent request. If unspecified, at most 100
318 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
319 ///
320 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
321 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
322 pub page_size: i32,
323
324 /// Optional. Optional pagination token, returned earlier via
325 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
326 ///
327 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
328 pub page_token: std::string::String,
329
330 /// Optional. Filter to apply when listing
331 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
332 /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
333 ///
334 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
335 pub filter: std::string::String,
336
337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
338}
339
340impl ListKeyHandlesRequest {
341 /// Creates a new default instance.
342 pub fn new() -> Self {
343 std::default::Default::default()
344 }
345
346 /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
347 ///
348 /// # Example
349 /// ```ignore,no_run
350 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
351 /// let x = ListKeyHandlesRequest::new().set_parent("example");
352 /// ```
353 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
354 self.parent = v.into();
355 self
356 }
357
358 /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
359 ///
360 /// # Example
361 /// ```ignore,no_run
362 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
363 /// let x = ListKeyHandlesRequest::new().set_page_size(42);
364 /// ```
365 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
366 self.page_size = v.into();
367 self
368 }
369
370 /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
371 ///
372 /// # Example
373 /// ```ignore,no_run
374 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
375 /// let x = ListKeyHandlesRequest::new().set_page_token("example");
376 /// ```
377 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
378 self.page_token = v.into();
379 self
380 }
381
382 /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
383 ///
384 /// # Example
385 /// ```ignore,no_run
386 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
387 /// let x = ListKeyHandlesRequest::new().set_filter("example");
388 /// ```
389 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
390 self.filter = v.into();
391 self
392 }
393}
394
395impl wkt::message::Message for ListKeyHandlesRequest {
396 fn typename() -> &'static str {
397 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
398 }
399}
400
401/// Response message for
402/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
403///
404/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
405#[derive(Clone, Default, PartialEq)]
406#[non_exhaustive]
407pub struct ListKeyHandlesResponse {
408 /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
409 ///
410 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
411 pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
412
413 /// A token to retrieve next page of results. Pass this value in
414 /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
415 /// to retrieve the next page of results.
416 ///
417 /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
418 pub next_page_token: std::string::String,
419
420 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
421}
422
423impl ListKeyHandlesResponse {
424 /// Creates a new default instance.
425 pub fn new() -> Self {
426 std::default::Default::default()
427 }
428
429 /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
430 ///
431 /// # Example
432 /// ```ignore,no_run
433 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
434 /// use google_cloud_kms_v1::model::KeyHandle;
435 /// let x = ListKeyHandlesResponse::new()
436 /// .set_key_handles([
437 /// KeyHandle::default()/* use setters */,
438 /// KeyHandle::default()/* use (different) setters */,
439 /// ]);
440 /// ```
441 pub fn set_key_handles<T, V>(mut self, v: T) -> Self
442 where
443 T: std::iter::IntoIterator<Item = V>,
444 V: std::convert::Into<crate::model::KeyHandle>,
445 {
446 use std::iter::Iterator;
447 self.key_handles = v.into_iter().map(|i| i.into()).collect();
448 self
449 }
450
451 /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
452 ///
453 /// # Example
454 /// ```ignore,no_run
455 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
456 /// let x = ListKeyHandlesResponse::new().set_next_page_token("example");
457 /// ```
458 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
459 self.next_page_token = v.into();
460 self
461 }
462}
463
464impl wkt::message::Message for ListKeyHandlesResponse {
465 fn typename() -> &'static str {
466 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
467 }
468}
469
470#[doc(hidden)]
471impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
472 type PageItem = crate::model::KeyHandle;
473
474 fn items(self) -> std::vec::Vec<Self::PageItem> {
475 self.key_handles
476 }
477
478 fn next_page_token(&self) -> std::string::String {
479 use std::clone::Clone;
480 self.next_page_token.clone()
481 }
482}
483
484/// Request message for
485/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
486///
487/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
488#[derive(Clone, Default, PartialEq)]
489#[non_exhaustive]
490pub struct UpdateAutokeyConfigRequest {
491 /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
492 /// update.
493 ///
494 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
495 pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
496
497 /// Required. Masks which fields of the
498 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
499 /// `keyProject`.
500 ///
501 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
502 pub update_mask: std::option::Option<wkt::FieldMask>,
503
504 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
505}
506
507impl UpdateAutokeyConfigRequest {
508 /// Creates a new default instance.
509 pub fn new() -> Self {
510 std::default::Default::default()
511 }
512
513 /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
514 ///
515 /// # Example
516 /// ```ignore,no_run
517 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
518 /// use google_cloud_kms_v1::model::AutokeyConfig;
519 /// let x = UpdateAutokeyConfigRequest::new().set_autokey_config(AutokeyConfig::default()/* use setters */);
520 /// ```
521 pub fn set_autokey_config<T>(mut self, v: T) -> Self
522 where
523 T: std::convert::Into<crate::model::AutokeyConfig>,
524 {
525 self.autokey_config = std::option::Option::Some(v.into());
526 self
527 }
528
529 /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
530 ///
531 /// # Example
532 /// ```ignore,no_run
533 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
534 /// use google_cloud_kms_v1::model::AutokeyConfig;
535 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(Some(AutokeyConfig::default()/* use setters */));
536 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(None::<AutokeyConfig>);
537 /// ```
538 pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
539 where
540 T: std::convert::Into<crate::model::AutokeyConfig>,
541 {
542 self.autokey_config = v.map(|x| x.into());
543 self
544 }
545
546 /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
547 ///
548 /// # Example
549 /// ```ignore,no_run
550 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
551 /// use wkt::FieldMask;
552 /// let x = UpdateAutokeyConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
553 /// ```
554 pub fn set_update_mask<T>(mut self, v: T) -> Self
555 where
556 T: std::convert::Into<wkt::FieldMask>,
557 {
558 self.update_mask = std::option::Option::Some(v.into());
559 self
560 }
561
562 /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
563 ///
564 /// # Example
565 /// ```ignore,no_run
566 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
567 /// use wkt::FieldMask;
568 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
569 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
570 /// ```
571 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
572 where
573 T: std::convert::Into<wkt::FieldMask>,
574 {
575 self.update_mask = v.map(|x| x.into());
576 self
577 }
578}
579
580impl wkt::message::Message for UpdateAutokeyConfigRequest {
581 fn typename() -> &'static str {
582 "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
583 }
584}
585
586/// Request message for
587/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
588///
589/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
590#[derive(Clone, Default, PartialEq)]
591#[non_exhaustive]
592pub struct GetAutokeyConfigRequest {
593 /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
594 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
595 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
596 ///
597 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
598 pub name: std::string::String,
599
600 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
601}
602
603impl GetAutokeyConfigRequest {
604 /// Creates a new default instance.
605 pub fn new() -> Self {
606 std::default::Default::default()
607 }
608
609 /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
610 ///
611 /// # Example
612 /// ```ignore,no_run
613 /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
614 /// let x = GetAutokeyConfigRequest::new().set_name("example");
615 /// ```
616 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
617 self.name = v.into();
618 self
619 }
620}
621
622impl wkt::message::Message for GetAutokeyConfigRequest {
623 fn typename() -> &'static str {
624 "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
625 }
626}
627
628/// Cloud KMS Autokey configuration for a folder.
629#[derive(Clone, Default, PartialEq)]
630#[non_exhaustive]
631pub struct AutokeyConfig {
632 /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
633 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
634 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
635 ///
636 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
637 pub name: std::string::String,
638
639 /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
640 /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
641 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
642 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
643 /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
644 /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
645 /// this key project. Once configured, for Cloud KMS Autokey to function
646 /// properly, this key project must have the Cloud KMS API activated and the
647 /// Cloud KMS Service Agent for this key project must be granted the
648 /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
649 /// key project field will clear the configuration.
650 ///
651 /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
652 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
653 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
654 pub key_project: std::string::String,
655
656 /// Output only. The state for the AutokeyConfig.
657 pub state: crate::model::autokey_config::State,
658
659 /// Optional. A checksum computed by the server based on the value of other
660 /// fields. This may be sent on update requests to ensure that the client has
661 /// an up-to-date value before proceeding. The request will be rejected with an
662 /// ABORTED error on a mismatched etag.
663 pub etag: std::string::String,
664
665 /// Optional. KeyProjectResolutionMode for the AutokeyConfig.
666 /// Valid values are `DEDICATED_KEY_PROJECT`, `RESOURCE_PROJECT`, or
667 /// `DISABLED`.
668 pub key_project_resolution_mode: crate::model::autokey_config::KeyProjectResolutionMode,
669
670 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
671}
672
673impl AutokeyConfig {
674 /// Creates a new default instance.
675 pub fn new() -> Self {
676 std::default::Default::default()
677 }
678
679 /// Sets the value of [name][crate::model::AutokeyConfig::name].
680 ///
681 /// # Example
682 /// ```ignore,no_run
683 /// # use google_cloud_kms_v1::model::AutokeyConfig;
684 /// let x = AutokeyConfig::new().set_name("example");
685 /// ```
686 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
687 self.name = v.into();
688 self
689 }
690
691 /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
692 ///
693 /// # Example
694 /// ```ignore,no_run
695 /// # use google_cloud_kms_v1::model::AutokeyConfig;
696 /// let x = AutokeyConfig::new().set_key_project("example");
697 /// ```
698 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
699 self.key_project = v.into();
700 self
701 }
702
703 /// Sets the value of [state][crate::model::AutokeyConfig::state].
704 ///
705 /// # Example
706 /// ```ignore,no_run
707 /// # use google_cloud_kms_v1::model::AutokeyConfig;
708 /// use google_cloud_kms_v1::model::autokey_config::State;
709 /// let x0 = AutokeyConfig::new().set_state(State::Active);
710 /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
711 /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
712 /// ```
713 pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
714 mut self,
715 v: T,
716 ) -> Self {
717 self.state = v.into();
718 self
719 }
720
721 /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
722 ///
723 /// # Example
724 /// ```ignore,no_run
725 /// # use google_cloud_kms_v1::model::AutokeyConfig;
726 /// let x = AutokeyConfig::new().set_etag("example");
727 /// ```
728 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
729 self.etag = v.into();
730 self
731 }
732
733 /// Sets the value of [key_project_resolution_mode][crate::model::AutokeyConfig::key_project_resolution_mode].
734 ///
735 /// # Example
736 /// ```ignore,no_run
737 /// # use google_cloud_kms_v1::model::AutokeyConfig;
738 /// use google_cloud_kms_v1::model::autokey_config::KeyProjectResolutionMode;
739 /// let x0 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::DedicatedKeyProject);
740 /// let x1 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::ResourceProject);
741 /// let x2 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::Disabled);
742 /// ```
743 pub fn set_key_project_resolution_mode<
744 T: std::convert::Into<crate::model::autokey_config::KeyProjectResolutionMode>,
745 >(
746 mut self,
747 v: T,
748 ) -> Self {
749 self.key_project_resolution_mode = v.into();
750 self
751 }
752}
753
754impl wkt::message::Message for AutokeyConfig {
755 fn typename() -> &'static str {
756 "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
757 }
758}
759
760/// Defines additional types related to [AutokeyConfig].
761pub mod autokey_config {
762 #[allow(unused_imports)]
763 use super::*;
764
765 /// The states AutokeyConfig can be in.
766 ///
767 /// # Working with unknown values
768 ///
769 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
770 /// additional enum variants at any time. Adding new variants is not considered
771 /// a breaking change. Applications should write their code in anticipation of:
772 ///
773 /// - New values appearing in future releases of the client library, **and**
774 /// - New values received dynamically, without application changes.
775 ///
776 /// Please consult the [Working with enums] section in the user guide for some
777 /// guidelines.
778 ///
779 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
780 #[derive(Clone, Debug, PartialEq)]
781 #[non_exhaustive]
782 pub enum State {
783 /// The state of the AutokeyConfig is unspecified.
784 Unspecified,
785 /// The AutokeyConfig is currently active.
786 Active,
787 /// A previously configured key project has been deleted and the current
788 /// AutokeyConfig is unusable.
789 KeyProjectDeleted,
790 /// The AutokeyConfig is not yet initialized or has been reset to its default
791 /// uninitialized state.
792 Uninitialized,
793 /// The service account lacks the necessary permissions in the key project to
794 /// configure Autokey.
795 KeyProjectPermissionDenied,
796 /// If set, the enum was initialized with an unknown value.
797 ///
798 /// Applications can examine the value using [State::value] or
799 /// [State::name].
800 UnknownValue(state::UnknownValue),
801 }
802
803 #[doc(hidden)]
804 pub mod state {
805 #[allow(unused_imports)]
806 use super::*;
807 #[derive(Clone, Debug, PartialEq)]
808 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
809 }
810
811 impl State {
812 /// Gets the enum value.
813 ///
814 /// Returns `None` if the enum contains an unknown value deserialized from
815 /// the string representation of enums.
816 pub fn value(&self) -> std::option::Option<i32> {
817 match self {
818 Self::Unspecified => std::option::Option::Some(0),
819 Self::Active => std::option::Option::Some(1),
820 Self::KeyProjectDeleted => std::option::Option::Some(2),
821 Self::Uninitialized => std::option::Option::Some(3),
822 Self::KeyProjectPermissionDenied => std::option::Option::Some(4),
823 Self::UnknownValue(u) => u.0.value(),
824 }
825 }
826
827 /// Gets the enum value as a string.
828 ///
829 /// Returns `None` if the enum contains an unknown value deserialized from
830 /// the integer representation of enums.
831 pub fn name(&self) -> std::option::Option<&str> {
832 match self {
833 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
834 Self::Active => std::option::Option::Some("ACTIVE"),
835 Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
836 Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
837 Self::KeyProjectPermissionDenied => {
838 std::option::Option::Some("KEY_PROJECT_PERMISSION_DENIED")
839 }
840 Self::UnknownValue(u) => u.0.name(),
841 }
842 }
843 }
844
845 impl std::default::Default for State {
846 fn default() -> Self {
847 use std::convert::From;
848 Self::from(0)
849 }
850 }
851
852 impl std::fmt::Display for State {
853 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
854 wkt::internal::display_enum(f, self.name(), self.value())
855 }
856 }
857
858 impl std::convert::From<i32> for State {
859 fn from(value: i32) -> Self {
860 match value {
861 0 => Self::Unspecified,
862 1 => Self::Active,
863 2 => Self::KeyProjectDeleted,
864 3 => Self::Uninitialized,
865 4 => Self::KeyProjectPermissionDenied,
866 _ => Self::UnknownValue(state::UnknownValue(
867 wkt::internal::UnknownEnumValue::Integer(value),
868 )),
869 }
870 }
871 }
872
873 impl std::convert::From<&str> for State {
874 fn from(value: &str) -> Self {
875 use std::string::ToString;
876 match value {
877 "STATE_UNSPECIFIED" => Self::Unspecified,
878 "ACTIVE" => Self::Active,
879 "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
880 "UNINITIALIZED" => Self::Uninitialized,
881 "KEY_PROJECT_PERMISSION_DENIED" => Self::KeyProjectPermissionDenied,
882 _ => Self::UnknownValue(state::UnknownValue(
883 wkt::internal::UnknownEnumValue::String(value.to_string()),
884 )),
885 }
886 }
887 }
888
889 impl serde::ser::Serialize for State {
890 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
891 where
892 S: serde::Serializer,
893 {
894 match self {
895 Self::Unspecified => serializer.serialize_i32(0),
896 Self::Active => serializer.serialize_i32(1),
897 Self::KeyProjectDeleted => serializer.serialize_i32(2),
898 Self::Uninitialized => serializer.serialize_i32(3),
899 Self::KeyProjectPermissionDenied => serializer.serialize_i32(4),
900 Self::UnknownValue(u) => u.0.serialize(serializer),
901 }
902 }
903 }
904
905 impl<'de> serde::de::Deserialize<'de> for State {
906 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
907 where
908 D: serde::Deserializer<'de>,
909 {
910 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
911 ".google.cloud.kms.v1.AutokeyConfig.State",
912 ))
913 }
914 }
915
916 /// Defines the resolution mode enum for the key project.
917 /// The
918 /// [KeyProjectResolutionMode][google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]
919 /// determines the mechanism by which
920 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] identifies a
921 /// [key_project][google.cloud.kms.v1.AutokeyConfig.key_project] at its
922 /// specific configuration node. This parameter also determines if Autokey can
923 /// be used within this project or folder.
924 ///
925 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
926 /// [google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]: crate::model::autokey_config::KeyProjectResolutionMode
927 /// [google.cloud.kms.v1.AutokeyConfig.key_project]: crate::model::AutokeyConfig::key_project
928 ///
929 /// # Working with unknown values
930 ///
931 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
932 /// additional enum variants at any time. Adding new variants is not considered
933 /// a breaking change. Applications should write their code in anticipation of:
934 ///
935 /// - New values appearing in future releases of the client library, **and**
936 /// - New values received dynamically, without application changes.
937 ///
938 /// Please consult the [Working with enums] section in the user guide for some
939 /// guidelines.
940 ///
941 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
942 #[derive(Clone, Debug, PartialEq)]
943 #[non_exhaustive]
944 pub enum KeyProjectResolutionMode {
945 /// Default value. KeyProjectResolutionMode when not specified will act as
946 /// `DEDICATED_KEY_PROJECT`.
947 Unspecified,
948 /// Keys are created in a dedicated project specified by `key_project`.
949 DedicatedKeyProject,
950 /// Keys are created in the same project as the resource requesting the key.
951 /// The `key_project` must not be set when this mode is used.
952 ResourceProject,
953 /// Disables the AutokeyConfig. When this mode is set, any AutokeyConfig
954 /// from higher levels in the resource hierarchy are ignored for this
955 /// resource and its descendants. This setting can be overridden
956 /// by a more specific configuration at a lower level. For example,
957 /// if Autokey is disabled on a folder, it can be re-enabled on a sub-folder
958 /// or project within that folder by setting a different mode (e.g.,
959 /// DEDICATED_KEY_PROJECT or RESOURCE_PROJECT).
960 Disabled,
961 /// If set, the enum was initialized with an unknown value.
962 ///
963 /// Applications can examine the value using [KeyProjectResolutionMode::value] or
964 /// [KeyProjectResolutionMode::name].
965 UnknownValue(key_project_resolution_mode::UnknownValue),
966 }
967
968 #[doc(hidden)]
969 pub mod key_project_resolution_mode {
970 #[allow(unused_imports)]
971 use super::*;
972 #[derive(Clone, Debug, PartialEq)]
973 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
974 }
975
976 impl KeyProjectResolutionMode {
977 /// Gets the enum value.
978 ///
979 /// Returns `None` if the enum contains an unknown value deserialized from
980 /// the string representation of enums.
981 pub fn value(&self) -> std::option::Option<i32> {
982 match self {
983 Self::Unspecified => std::option::Option::Some(0),
984 Self::DedicatedKeyProject => std::option::Option::Some(1),
985 Self::ResourceProject => std::option::Option::Some(2),
986 Self::Disabled => std::option::Option::Some(3),
987 Self::UnknownValue(u) => u.0.value(),
988 }
989 }
990
991 /// Gets the enum value as a string.
992 ///
993 /// Returns `None` if the enum contains an unknown value deserialized from
994 /// the integer representation of enums.
995 pub fn name(&self) -> std::option::Option<&str> {
996 match self {
997 Self::Unspecified => {
998 std::option::Option::Some("KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED")
999 }
1000 Self::DedicatedKeyProject => std::option::Option::Some("DEDICATED_KEY_PROJECT"),
1001 Self::ResourceProject => std::option::Option::Some("RESOURCE_PROJECT"),
1002 Self::Disabled => std::option::Option::Some("DISABLED"),
1003 Self::UnknownValue(u) => u.0.name(),
1004 }
1005 }
1006 }
1007
1008 impl std::default::Default for KeyProjectResolutionMode {
1009 fn default() -> Self {
1010 use std::convert::From;
1011 Self::from(0)
1012 }
1013 }
1014
1015 impl std::fmt::Display for KeyProjectResolutionMode {
1016 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1017 wkt::internal::display_enum(f, self.name(), self.value())
1018 }
1019 }
1020
1021 impl std::convert::From<i32> for KeyProjectResolutionMode {
1022 fn from(value: i32) -> Self {
1023 match value {
1024 0 => Self::Unspecified,
1025 1 => Self::DedicatedKeyProject,
1026 2 => Self::ResourceProject,
1027 3 => Self::Disabled,
1028 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1029 wkt::internal::UnknownEnumValue::Integer(value),
1030 )),
1031 }
1032 }
1033 }
1034
1035 impl std::convert::From<&str> for KeyProjectResolutionMode {
1036 fn from(value: &str) -> Self {
1037 use std::string::ToString;
1038 match value {
1039 "KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED" => Self::Unspecified,
1040 "DEDICATED_KEY_PROJECT" => Self::DedicatedKeyProject,
1041 "RESOURCE_PROJECT" => Self::ResourceProject,
1042 "DISABLED" => Self::Disabled,
1043 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1044 wkt::internal::UnknownEnumValue::String(value.to_string()),
1045 )),
1046 }
1047 }
1048 }
1049
1050 impl serde::ser::Serialize for KeyProjectResolutionMode {
1051 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1052 where
1053 S: serde::Serializer,
1054 {
1055 match self {
1056 Self::Unspecified => serializer.serialize_i32(0),
1057 Self::DedicatedKeyProject => serializer.serialize_i32(1),
1058 Self::ResourceProject => serializer.serialize_i32(2),
1059 Self::Disabled => serializer.serialize_i32(3),
1060 Self::UnknownValue(u) => u.0.serialize(serializer),
1061 }
1062 }
1063 }
1064
1065 impl<'de> serde::de::Deserialize<'de> for KeyProjectResolutionMode {
1066 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1067 where
1068 D: serde::Deserializer<'de>,
1069 {
1070 deserializer.deserialize_any(
1071 wkt::internal::EnumVisitor::<KeyProjectResolutionMode>::new(
1072 ".google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode",
1073 ),
1074 )
1075 }
1076 }
1077}
1078
1079/// Request message for
1080/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1081///
1082/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1083#[derive(Clone, Default, PartialEq)]
1084#[non_exhaustive]
1085pub struct ShowEffectiveAutokeyConfigRequest {
1086 /// Required. Name of the resource project to the show effective Cloud KMS
1087 /// Autokey configuration for. This may be helpful for interrogating the effect
1088 /// of nested folder configurations on a given resource project.
1089 pub parent: std::string::String,
1090
1091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1092}
1093
1094impl ShowEffectiveAutokeyConfigRequest {
1095 /// Creates a new default instance.
1096 pub fn new() -> Self {
1097 std::default::Default::default()
1098 }
1099
1100 /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
1101 ///
1102 /// # Example
1103 /// ```ignore,no_run
1104 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
1105 /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
1106 /// ```
1107 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1108 self.parent = v.into();
1109 self
1110 }
1111}
1112
1113impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
1114 fn typename() -> &'static str {
1115 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
1116 }
1117}
1118
1119/// Response message for
1120/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1121///
1122/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1123#[derive(Clone, Default, PartialEq)]
1124#[non_exhaustive]
1125pub struct ShowEffectiveAutokeyConfigResponse {
1126 /// Name of the key project configured in the resource project's folder
1127 /// ancestry.
1128 pub key_project: std::string::String,
1129
1130 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1131}
1132
1133impl ShowEffectiveAutokeyConfigResponse {
1134 /// Creates a new default instance.
1135 pub fn new() -> Self {
1136 std::default::Default::default()
1137 }
1138
1139 /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
1140 ///
1141 /// # Example
1142 /// ```ignore,no_run
1143 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
1144 /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
1145 /// ```
1146 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1147 self.key_project = v.into();
1148 self
1149 }
1150}
1151
1152impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
1153 fn typename() -> &'static str {
1154 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
1155 }
1156}
1157
1158/// Request message for
1159/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1160///
1161/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1162#[derive(Clone, Default, PartialEq)]
1163#[non_exhaustive]
1164pub struct ListEkmConnectionsRequest {
1165 /// Required. The resource name of the location associated with the
1166 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
1167 /// `projects/*/locations/*`.
1168 ///
1169 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1170 pub parent: std::string::String,
1171
1172 /// Optional. Optional limit on the number of
1173 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
1174 /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
1175 /// subsequently be obtained by including the
1176 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
1177 /// in a subsequent request. If unspecified, the server will pick an
1178 /// appropriate default.
1179 ///
1180 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1181 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1182 pub page_size: i32,
1183
1184 /// Optional. Optional pagination token, returned earlier via
1185 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
1186 ///
1187 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1188 pub page_token: std::string::String,
1189
1190 /// Optional. Only include resources that match the filter in the response. For
1191 /// more information, see
1192 /// [Sorting and filtering list
1193 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1194 pub filter: std::string::String,
1195
1196 /// Optional. Specify how the results should be sorted. If not specified, the
1197 /// results will be sorted in the default order. For more information, see
1198 /// [Sorting and filtering list
1199 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1200 pub order_by: std::string::String,
1201
1202 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1203}
1204
1205impl ListEkmConnectionsRequest {
1206 /// Creates a new default instance.
1207 pub fn new() -> Self {
1208 std::default::Default::default()
1209 }
1210
1211 /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1212 ///
1213 /// # Example
1214 /// ```ignore,no_run
1215 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1216 /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1217 /// ```
1218 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1219 self.parent = v.into();
1220 self
1221 }
1222
1223 /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1224 ///
1225 /// # Example
1226 /// ```ignore,no_run
1227 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1228 /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1229 /// ```
1230 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1231 self.page_size = v.into();
1232 self
1233 }
1234
1235 /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1236 ///
1237 /// # Example
1238 /// ```ignore,no_run
1239 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1240 /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1241 /// ```
1242 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1243 self.page_token = v.into();
1244 self
1245 }
1246
1247 /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1248 ///
1249 /// # Example
1250 /// ```ignore,no_run
1251 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1252 /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1253 /// ```
1254 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255 self.filter = v.into();
1256 self
1257 }
1258
1259 /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1260 ///
1261 /// # Example
1262 /// ```ignore,no_run
1263 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1264 /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1265 /// ```
1266 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1267 self.order_by = v.into();
1268 self
1269 }
1270}
1271
1272impl wkt::message::Message for ListEkmConnectionsRequest {
1273 fn typename() -> &'static str {
1274 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1275 }
1276}
1277
1278/// Response message for
1279/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1280///
1281/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1282#[derive(Clone, Default, PartialEq)]
1283#[non_exhaustive]
1284pub struct ListEkmConnectionsResponse {
1285 /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1286 ///
1287 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1288 pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1289
1290 /// A token to retrieve next page of results. Pass this value in
1291 /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1292 /// to retrieve the next page of results.
1293 ///
1294 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1295 pub next_page_token: std::string::String,
1296
1297 /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1298 /// that matched the query.
1299 ///
1300 /// This field is not populated if
1301 /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1302 /// is applied.
1303 ///
1304 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1305 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1306 pub total_size: i32,
1307
1308 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1309}
1310
1311impl ListEkmConnectionsResponse {
1312 /// Creates a new default instance.
1313 pub fn new() -> Self {
1314 std::default::Default::default()
1315 }
1316
1317 /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1318 ///
1319 /// # Example
1320 /// ```ignore,no_run
1321 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1322 /// use google_cloud_kms_v1::model::EkmConnection;
1323 /// let x = ListEkmConnectionsResponse::new()
1324 /// .set_ekm_connections([
1325 /// EkmConnection::default()/* use setters */,
1326 /// EkmConnection::default()/* use (different) setters */,
1327 /// ]);
1328 /// ```
1329 pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1330 where
1331 T: std::iter::IntoIterator<Item = V>,
1332 V: std::convert::Into<crate::model::EkmConnection>,
1333 {
1334 use std::iter::Iterator;
1335 self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1336 self
1337 }
1338
1339 /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1340 ///
1341 /// # Example
1342 /// ```ignore,no_run
1343 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1344 /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1345 /// ```
1346 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1347 self.next_page_token = v.into();
1348 self
1349 }
1350
1351 /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1352 ///
1353 /// # Example
1354 /// ```ignore,no_run
1355 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1356 /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1357 /// ```
1358 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1359 self.total_size = v.into();
1360 self
1361 }
1362}
1363
1364impl wkt::message::Message for ListEkmConnectionsResponse {
1365 fn typename() -> &'static str {
1366 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1367 }
1368}
1369
1370#[doc(hidden)]
1371impl google_cloud_gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1372 type PageItem = crate::model::EkmConnection;
1373
1374 fn items(self) -> std::vec::Vec<Self::PageItem> {
1375 self.ekm_connections
1376 }
1377
1378 fn next_page_token(&self) -> std::string::String {
1379 use std::clone::Clone;
1380 self.next_page_token.clone()
1381 }
1382}
1383
1384/// Request message for
1385/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1386///
1387/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1388#[derive(Clone, Default, PartialEq)]
1389#[non_exhaustive]
1390pub struct GetEkmConnectionRequest {
1391 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1392 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1393 ///
1394 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1395 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1396 pub name: std::string::String,
1397
1398 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1399}
1400
1401impl GetEkmConnectionRequest {
1402 /// Creates a new default instance.
1403 pub fn new() -> Self {
1404 std::default::Default::default()
1405 }
1406
1407 /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1408 ///
1409 /// # Example
1410 /// ```ignore,no_run
1411 /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1412 /// let x = GetEkmConnectionRequest::new().set_name("example");
1413 /// ```
1414 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1415 self.name = v.into();
1416 self
1417 }
1418}
1419
1420impl wkt::message::Message for GetEkmConnectionRequest {
1421 fn typename() -> &'static str {
1422 "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1423 }
1424}
1425
1426/// Request message for
1427/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1428///
1429/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1430#[derive(Clone, Default, PartialEq)]
1431#[non_exhaustive]
1432pub struct CreateEkmConnectionRequest {
1433 /// Required. The resource name of the location associated with the
1434 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1435 /// `projects/*/locations/*`.
1436 ///
1437 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1438 pub parent: std::string::String,
1439
1440 /// Required. It must be unique within a location and match the regular
1441 /// expression `[a-zA-Z0-9_-]{1,63}`.
1442 pub ekm_connection_id: std::string::String,
1443
1444 /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1445 /// initial field values.
1446 ///
1447 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1448 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1449
1450 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1451}
1452
1453impl CreateEkmConnectionRequest {
1454 /// Creates a new default instance.
1455 pub fn new() -> Self {
1456 std::default::Default::default()
1457 }
1458
1459 /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1460 ///
1461 /// # Example
1462 /// ```ignore,no_run
1463 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1464 /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1465 /// ```
1466 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1467 self.parent = v.into();
1468 self
1469 }
1470
1471 /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1472 ///
1473 /// # Example
1474 /// ```ignore,no_run
1475 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1476 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1477 /// ```
1478 pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1479 mut self,
1480 v: T,
1481 ) -> Self {
1482 self.ekm_connection_id = v.into();
1483 self
1484 }
1485
1486 /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1487 ///
1488 /// # Example
1489 /// ```ignore,no_run
1490 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1491 /// use google_cloud_kms_v1::model::EkmConnection;
1492 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1493 /// ```
1494 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1495 where
1496 T: std::convert::Into<crate::model::EkmConnection>,
1497 {
1498 self.ekm_connection = std::option::Option::Some(v.into());
1499 self
1500 }
1501
1502 /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1503 ///
1504 /// # Example
1505 /// ```ignore,no_run
1506 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1507 /// use google_cloud_kms_v1::model::EkmConnection;
1508 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1509 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1510 /// ```
1511 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1512 where
1513 T: std::convert::Into<crate::model::EkmConnection>,
1514 {
1515 self.ekm_connection = v.map(|x| x.into());
1516 self
1517 }
1518}
1519
1520impl wkt::message::Message for CreateEkmConnectionRequest {
1521 fn typename() -> &'static str {
1522 "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1523 }
1524}
1525
1526/// Request message for
1527/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1528///
1529/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1530#[derive(Clone, Default, PartialEq)]
1531#[non_exhaustive]
1532pub struct UpdateEkmConnectionRequest {
1533 /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1534 /// values.
1535 ///
1536 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1537 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1538
1539 /// Required. List of fields to be updated in this request.
1540 pub update_mask: std::option::Option<wkt::FieldMask>,
1541
1542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1543}
1544
1545impl UpdateEkmConnectionRequest {
1546 /// Creates a new default instance.
1547 pub fn new() -> Self {
1548 std::default::Default::default()
1549 }
1550
1551 /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1552 ///
1553 /// # Example
1554 /// ```ignore,no_run
1555 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1556 /// use google_cloud_kms_v1::model::EkmConnection;
1557 /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1558 /// ```
1559 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1560 where
1561 T: std::convert::Into<crate::model::EkmConnection>,
1562 {
1563 self.ekm_connection = std::option::Option::Some(v.into());
1564 self
1565 }
1566
1567 /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1568 ///
1569 /// # Example
1570 /// ```ignore,no_run
1571 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1572 /// use google_cloud_kms_v1::model::EkmConnection;
1573 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1574 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1575 /// ```
1576 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1577 where
1578 T: std::convert::Into<crate::model::EkmConnection>,
1579 {
1580 self.ekm_connection = v.map(|x| x.into());
1581 self
1582 }
1583
1584 /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1585 ///
1586 /// # Example
1587 /// ```ignore,no_run
1588 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1589 /// use wkt::FieldMask;
1590 /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1591 /// ```
1592 pub fn set_update_mask<T>(mut self, v: T) -> Self
1593 where
1594 T: std::convert::Into<wkt::FieldMask>,
1595 {
1596 self.update_mask = std::option::Option::Some(v.into());
1597 self
1598 }
1599
1600 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1601 ///
1602 /// # Example
1603 /// ```ignore,no_run
1604 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1605 /// use wkt::FieldMask;
1606 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1607 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1608 /// ```
1609 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1610 where
1611 T: std::convert::Into<wkt::FieldMask>,
1612 {
1613 self.update_mask = v.map(|x| x.into());
1614 self
1615 }
1616}
1617
1618impl wkt::message::Message for UpdateEkmConnectionRequest {
1619 fn typename() -> &'static str {
1620 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1621 }
1622}
1623
1624/// Request message for
1625/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1626///
1627/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1628#[derive(Clone, Default, PartialEq)]
1629#[non_exhaustive]
1630pub struct GetEkmConfigRequest {
1631 /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1632 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1633 ///
1634 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1635 /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1636 pub name: std::string::String,
1637
1638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1639}
1640
1641impl GetEkmConfigRequest {
1642 /// Creates a new default instance.
1643 pub fn new() -> Self {
1644 std::default::Default::default()
1645 }
1646
1647 /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1648 ///
1649 /// # Example
1650 /// ```ignore,no_run
1651 /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1652 /// let x = GetEkmConfigRequest::new().set_name("example");
1653 /// ```
1654 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1655 self.name = v.into();
1656 self
1657 }
1658}
1659
1660impl wkt::message::Message for GetEkmConfigRequest {
1661 fn typename() -> &'static str {
1662 "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1663 }
1664}
1665
1666/// Request message for
1667/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1668///
1669/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1670#[derive(Clone, Default, PartialEq)]
1671#[non_exhaustive]
1672pub struct UpdateEkmConfigRequest {
1673 /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1674 ///
1675 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1676 pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1677
1678 /// Required. List of fields to be updated in this request.
1679 pub update_mask: std::option::Option<wkt::FieldMask>,
1680
1681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1682}
1683
1684impl UpdateEkmConfigRequest {
1685 /// Creates a new default instance.
1686 pub fn new() -> Self {
1687 std::default::Default::default()
1688 }
1689
1690 /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1691 ///
1692 /// # Example
1693 /// ```ignore,no_run
1694 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1695 /// use google_cloud_kms_v1::model::EkmConfig;
1696 /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1697 /// ```
1698 pub fn set_ekm_config<T>(mut self, v: T) -> Self
1699 where
1700 T: std::convert::Into<crate::model::EkmConfig>,
1701 {
1702 self.ekm_config = std::option::Option::Some(v.into());
1703 self
1704 }
1705
1706 /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1707 ///
1708 /// # Example
1709 /// ```ignore,no_run
1710 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1711 /// use google_cloud_kms_v1::model::EkmConfig;
1712 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1713 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1714 /// ```
1715 pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1716 where
1717 T: std::convert::Into<crate::model::EkmConfig>,
1718 {
1719 self.ekm_config = v.map(|x| x.into());
1720 self
1721 }
1722
1723 /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1728 /// use wkt::FieldMask;
1729 /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1730 /// ```
1731 pub fn set_update_mask<T>(mut self, v: T) -> Self
1732 where
1733 T: std::convert::Into<wkt::FieldMask>,
1734 {
1735 self.update_mask = std::option::Option::Some(v.into());
1736 self
1737 }
1738
1739 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1740 ///
1741 /// # Example
1742 /// ```ignore,no_run
1743 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1744 /// use wkt::FieldMask;
1745 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1746 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1747 /// ```
1748 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1749 where
1750 T: std::convert::Into<wkt::FieldMask>,
1751 {
1752 self.update_mask = v.map(|x| x.into());
1753 self
1754 }
1755}
1756
1757impl wkt::message::Message for UpdateEkmConfigRequest {
1758 fn typename() -> &'static str {
1759 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1760 }
1761}
1762
1763/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1764/// certificate used to authenticate HTTPS connections to EKM replicas.
1765///
1766/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1767#[derive(Clone, Default, PartialEq)]
1768#[non_exhaustive]
1769pub struct Certificate {
1770 /// Required. The raw certificate bytes in DER format.
1771 pub raw_der: ::bytes::Bytes,
1772
1773 /// Output only. True if the certificate was parsed successfully.
1774 pub parsed: bool,
1775
1776 /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1777 /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1778 ///
1779 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1780 pub issuer: std::string::String,
1781
1782 /// Output only. The subject distinguished name in RFC 2253 format. Only
1783 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1784 ///
1785 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1786 pub subject: std::string::String,
1787
1788 /// Output only. The subject Alternative DNS names. Only present if
1789 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1790 ///
1791 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1792 pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1793
1794 /// Output only. The certificate is not valid before this time. Only present if
1795 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1796 ///
1797 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1798 pub not_before_time: std::option::Option<wkt::Timestamp>,
1799
1800 /// Output only. The certificate is not valid after this time. Only present if
1801 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1802 ///
1803 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1804 pub not_after_time: std::option::Option<wkt::Timestamp>,
1805
1806 /// Output only. The certificate serial number as a hex string. Only present if
1807 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1808 ///
1809 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1810 pub serial_number: std::string::String,
1811
1812 /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1813 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1814 ///
1815 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1816 pub sha256_fingerprint: std::string::String,
1817
1818 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1819}
1820
1821impl Certificate {
1822 /// Creates a new default instance.
1823 pub fn new() -> Self {
1824 std::default::Default::default()
1825 }
1826
1827 /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1828 ///
1829 /// # Example
1830 /// ```ignore,no_run
1831 /// # use google_cloud_kms_v1::model::Certificate;
1832 /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1833 /// ```
1834 pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1835 self.raw_der = v.into();
1836 self
1837 }
1838
1839 /// Sets the value of [parsed][crate::model::Certificate::parsed].
1840 ///
1841 /// # Example
1842 /// ```ignore,no_run
1843 /// # use google_cloud_kms_v1::model::Certificate;
1844 /// let x = Certificate::new().set_parsed(true);
1845 /// ```
1846 pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1847 self.parsed = v.into();
1848 self
1849 }
1850
1851 /// Sets the value of [issuer][crate::model::Certificate::issuer].
1852 ///
1853 /// # Example
1854 /// ```ignore,no_run
1855 /// # use google_cloud_kms_v1::model::Certificate;
1856 /// let x = Certificate::new().set_issuer("example");
1857 /// ```
1858 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1859 self.issuer = v.into();
1860 self
1861 }
1862
1863 /// Sets the value of [subject][crate::model::Certificate::subject].
1864 ///
1865 /// # Example
1866 /// ```ignore,no_run
1867 /// # use google_cloud_kms_v1::model::Certificate;
1868 /// let x = Certificate::new().set_subject("example");
1869 /// ```
1870 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1871 self.subject = v.into();
1872 self
1873 }
1874
1875 /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1876 ///
1877 /// # Example
1878 /// ```ignore,no_run
1879 /// # use google_cloud_kms_v1::model::Certificate;
1880 /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1881 /// ```
1882 pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1883 where
1884 T: std::iter::IntoIterator<Item = V>,
1885 V: std::convert::Into<std::string::String>,
1886 {
1887 use std::iter::Iterator;
1888 self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1889 self
1890 }
1891
1892 /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1893 ///
1894 /// # Example
1895 /// ```ignore,no_run
1896 /// # use google_cloud_kms_v1::model::Certificate;
1897 /// use wkt::Timestamp;
1898 /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1899 /// ```
1900 pub fn set_not_before_time<T>(mut self, v: T) -> Self
1901 where
1902 T: std::convert::Into<wkt::Timestamp>,
1903 {
1904 self.not_before_time = std::option::Option::Some(v.into());
1905 self
1906 }
1907
1908 /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1909 ///
1910 /// # Example
1911 /// ```ignore,no_run
1912 /// # use google_cloud_kms_v1::model::Certificate;
1913 /// use wkt::Timestamp;
1914 /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1915 /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1916 /// ```
1917 pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1918 where
1919 T: std::convert::Into<wkt::Timestamp>,
1920 {
1921 self.not_before_time = v.map(|x| x.into());
1922 self
1923 }
1924
1925 /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1926 ///
1927 /// # Example
1928 /// ```ignore,no_run
1929 /// # use google_cloud_kms_v1::model::Certificate;
1930 /// use wkt::Timestamp;
1931 /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1932 /// ```
1933 pub fn set_not_after_time<T>(mut self, v: T) -> Self
1934 where
1935 T: std::convert::Into<wkt::Timestamp>,
1936 {
1937 self.not_after_time = std::option::Option::Some(v.into());
1938 self
1939 }
1940
1941 /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1942 ///
1943 /// # Example
1944 /// ```ignore,no_run
1945 /// # use google_cloud_kms_v1::model::Certificate;
1946 /// use wkt::Timestamp;
1947 /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1948 /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1949 /// ```
1950 pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1951 where
1952 T: std::convert::Into<wkt::Timestamp>,
1953 {
1954 self.not_after_time = v.map(|x| x.into());
1955 self
1956 }
1957
1958 /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1959 ///
1960 /// # Example
1961 /// ```ignore,no_run
1962 /// # use google_cloud_kms_v1::model::Certificate;
1963 /// let x = Certificate::new().set_serial_number("example");
1964 /// ```
1965 pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1966 self.serial_number = v.into();
1967 self
1968 }
1969
1970 /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1971 ///
1972 /// # Example
1973 /// ```ignore,no_run
1974 /// # use google_cloud_kms_v1::model::Certificate;
1975 /// let x = Certificate::new().set_sha256_fingerprint("example");
1976 /// ```
1977 pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1978 mut self,
1979 v: T,
1980 ) -> Self {
1981 self.sha256_fingerprint = v.into();
1982 self
1983 }
1984}
1985
1986impl wkt::message::Message for Certificate {
1987 fn typename() -> &'static str {
1988 "type.googleapis.com/google.cloud.kms.v1.Certificate"
1989 }
1990}
1991
1992/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
1993/// individual EKM connection. It can be used for creating
1994/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
1995/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
1996/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
1997/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
1998/// performing cryptographic operations using keys created within the
1999/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2000///
2001/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2002/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2003/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2004/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2005/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2006#[derive(Clone, Default, PartialEq)]
2007#[non_exhaustive]
2008pub struct EkmConnection {
2009 /// Output only. The resource name for the
2010 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
2011 /// `projects/*/locations/*/ekmConnections/*`.
2012 ///
2013 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2014 pub name: std::string::String,
2015
2016 /// Output only. The time at which the
2017 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
2018 ///
2019 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2020 pub create_time: std::option::Option<wkt::Timestamp>,
2021
2022 /// Optional. A list of
2023 /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
2024 /// the EKM can be reached. There should be one ServiceResolver per EKM
2025 /// replica. Currently, only a single
2026 /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
2027 /// supported.
2028 ///
2029 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2030 pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
2031
2032 /// Optional. Etag of the currently stored
2033 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2034 ///
2035 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2036 pub etag: std::string::String,
2037
2038 /// Optional. Describes who can perform control plane operations on the EKM. If
2039 /// unset, this defaults to
2040 /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
2041 ///
2042 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
2043 pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
2044
2045 /// Optional. Identifies the EKM Crypto Space that this
2046 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
2047 /// field is required if
2048 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
2049 /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
2050 ///
2051 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2052 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2053 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
2054 pub crypto_space_path: std::string::String,
2055
2056 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2057}
2058
2059impl EkmConnection {
2060 /// Creates a new default instance.
2061 pub fn new() -> Self {
2062 std::default::Default::default()
2063 }
2064
2065 /// Sets the value of [name][crate::model::EkmConnection::name].
2066 ///
2067 /// # Example
2068 /// ```ignore,no_run
2069 /// # use google_cloud_kms_v1::model::EkmConnection;
2070 /// let x = EkmConnection::new().set_name("example");
2071 /// ```
2072 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2073 self.name = v.into();
2074 self
2075 }
2076
2077 /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
2078 ///
2079 /// # Example
2080 /// ```ignore,no_run
2081 /// # use google_cloud_kms_v1::model::EkmConnection;
2082 /// use wkt::Timestamp;
2083 /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
2084 /// ```
2085 pub fn set_create_time<T>(mut self, v: T) -> Self
2086 where
2087 T: std::convert::Into<wkt::Timestamp>,
2088 {
2089 self.create_time = std::option::Option::Some(v.into());
2090 self
2091 }
2092
2093 /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
2094 ///
2095 /// # Example
2096 /// ```ignore,no_run
2097 /// # use google_cloud_kms_v1::model::EkmConnection;
2098 /// use wkt::Timestamp;
2099 /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2100 /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
2101 /// ```
2102 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2103 where
2104 T: std::convert::Into<wkt::Timestamp>,
2105 {
2106 self.create_time = v.map(|x| x.into());
2107 self
2108 }
2109
2110 /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
2111 ///
2112 /// # Example
2113 /// ```ignore,no_run
2114 /// # use google_cloud_kms_v1::model::EkmConnection;
2115 /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2116 /// let x = EkmConnection::new()
2117 /// .set_service_resolvers([
2118 /// ServiceResolver::default()/* use setters */,
2119 /// ServiceResolver::default()/* use (different) setters */,
2120 /// ]);
2121 /// ```
2122 pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
2123 where
2124 T: std::iter::IntoIterator<Item = V>,
2125 V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
2126 {
2127 use std::iter::Iterator;
2128 self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
2129 self
2130 }
2131
2132 /// Sets the value of [etag][crate::model::EkmConnection::etag].
2133 ///
2134 /// # Example
2135 /// ```ignore,no_run
2136 /// # use google_cloud_kms_v1::model::EkmConnection;
2137 /// let x = EkmConnection::new().set_etag("example");
2138 /// ```
2139 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2140 self.etag = v.into();
2141 self
2142 }
2143
2144 /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
2145 ///
2146 /// # Example
2147 /// ```ignore,no_run
2148 /// # use google_cloud_kms_v1::model::EkmConnection;
2149 /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
2150 /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
2151 /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
2152 /// ```
2153 pub fn set_key_management_mode<
2154 T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
2155 >(
2156 mut self,
2157 v: T,
2158 ) -> Self {
2159 self.key_management_mode = v.into();
2160 self
2161 }
2162
2163 /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
2164 ///
2165 /// # Example
2166 /// ```ignore,no_run
2167 /// # use google_cloud_kms_v1::model::EkmConnection;
2168 /// let x = EkmConnection::new().set_crypto_space_path("example");
2169 /// ```
2170 pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
2171 mut self,
2172 v: T,
2173 ) -> Self {
2174 self.crypto_space_path = v.into();
2175 self
2176 }
2177}
2178
2179impl wkt::message::Message for EkmConnection {
2180 fn typename() -> &'static str {
2181 "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
2182 }
2183}
2184
2185/// Defines additional types related to [EkmConnection].
2186pub mod ekm_connection {
2187 #[allow(unused_imports)]
2188 use super::*;
2189
2190 /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
2191 /// represents an EKM replica that can be reached within an
2192 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2193 ///
2194 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2195 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2196 #[derive(Clone, Default, PartialEq)]
2197 #[non_exhaustive]
2198 pub struct ServiceResolver {
2199 /// Required. The resource name of the Service Directory service pointing to
2200 /// an EKM replica, in the format
2201 /// `projects/*/locations/*/namespaces/*/services/*`.
2202 pub service_directory_service: std::string::String,
2203
2204 /// Optional. The filter applied to the endpoints of the resolved service. If
2205 /// no filter is specified, all endpoints will be considered. An endpoint
2206 /// will be chosen arbitrarily from the filtered list for each request.
2207 ///
2208 /// For endpoint filter syntax and examples, see
2209 /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
2210 pub endpoint_filter: std::string::String,
2211
2212 /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
2213 pub hostname: std::string::String,
2214
2215 /// Required. A list of leaf server certificates used to authenticate HTTPS
2216 /// connections to the EKM replica. Currently, a maximum of 10
2217 /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2218 ///
2219 /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2220 pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2221
2222 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2223 }
2224
2225 impl ServiceResolver {
2226 /// Creates a new default instance.
2227 pub fn new() -> Self {
2228 std::default::Default::default()
2229 }
2230
2231 /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2232 ///
2233 /// # Example
2234 /// ```ignore,no_run
2235 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2236 /// let x = ServiceResolver::new().set_service_directory_service("example");
2237 /// ```
2238 pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2239 mut self,
2240 v: T,
2241 ) -> Self {
2242 self.service_directory_service = v.into();
2243 self
2244 }
2245
2246 /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2247 ///
2248 /// # Example
2249 /// ```ignore,no_run
2250 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2251 /// let x = ServiceResolver::new().set_endpoint_filter("example");
2252 /// ```
2253 pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2254 mut self,
2255 v: T,
2256 ) -> Self {
2257 self.endpoint_filter = v.into();
2258 self
2259 }
2260
2261 /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2262 ///
2263 /// # Example
2264 /// ```ignore,no_run
2265 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2266 /// let x = ServiceResolver::new().set_hostname("example");
2267 /// ```
2268 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2269 self.hostname = v.into();
2270 self
2271 }
2272
2273 /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2274 ///
2275 /// # Example
2276 /// ```ignore,no_run
2277 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2278 /// use google_cloud_kms_v1::model::Certificate;
2279 /// let x = ServiceResolver::new()
2280 /// .set_server_certificates([
2281 /// Certificate::default()/* use setters */,
2282 /// Certificate::default()/* use (different) setters */,
2283 /// ]);
2284 /// ```
2285 pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2286 where
2287 T: std::iter::IntoIterator<Item = V>,
2288 V: std::convert::Into<crate::model::Certificate>,
2289 {
2290 use std::iter::Iterator;
2291 self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2292 self
2293 }
2294 }
2295
2296 impl wkt::message::Message for ServiceResolver {
2297 fn typename() -> &'static str {
2298 "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2299 }
2300 }
2301
2302 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2303 /// describes who can perform control plane cryptographic operations using this
2304 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2305 ///
2306 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2307 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2308 ///
2309 /// # Working with unknown values
2310 ///
2311 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2312 /// additional enum variants at any time. Adding new variants is not considered
2313 /// a breaking change. Applications should write their code in anticipation of:
2314 ///
2315 /// - New values appearing in future releases of the client library, **and**
2316 /// - New values received dynamically, without application changes.
2317 ///
2318 /// Please consult the [Working with enums] section in the user guide for some
2319 /// guidelines.
2320 ///
2321 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2322 #[derive(Clone, Debug, PartialEq)]
2323 #[non_exhaustive]
2324 pub enum KeyManagementMode {
2325 /// Not specified.
2326 Unspecified,
2327 /// EKM-side key management operations on
2328 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2329 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2330 /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2331 ///
2332 /// * When creating a
2333 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2334 /// this
2335 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2336 /// supply the key path of pre-existing external key material that will be
2337 /// linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2338 /// * Destruction of external key material cannot be requested via the
2339 /// Cloud KMS API and must be performed directly in the EKM.
2340 /// * Automatic rotation of key material is not supported.
2341 ///
2342 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2343 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2344 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2345 Manual,
2346 /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2347 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2348 /// management operations initiated from Cloud KMS. This means that:
2349 ///
2350 /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2351 /// associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2352 /// is
2353 /// created, the EKM automatically generates new key material and a new
2354 /// key path. The caller cannot supply the key path of pre-existing
2355 /// external key material.
2356 /// * Destruction of external key material associated with this
2357 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2358 /// calling
2359 /// [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2360 /// * Automatic rotation of key material is supported.
2361 ///
2362 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2363 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2364 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2365 /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2366 CloudKms,
2367 /// If set, the enum was initialized with an unknown value.
2368 ///
2369 /// Applications can examine the value using [KeyManagementMode::value] or
2370 /// [KeyManagementMode::name].
2371 UnknownValue(key_management_mode::UnknownValue),
2372 }
2373
2374 #[doc(hidden)]
2375 pub mod key_management_mode {
2376 #[allow(unused_imports)]
2377 use super::*;
2378 #[derive(Clone, Debug, PartialEq)]
2379 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2380 }
2381
2382 impl KeyManagementMode {
2383 /// Gets the enum value.
2384 ///
2385 /// Returns `None` if the enum contains an unknown value deserialized from
2386 /// the string representation of enums.
2387 pub fn value(&self) -> std::option::Option<i32> {
2388 match self {
2389 Self::Unspecified => std::option::Option::Some(0),
2390 Self::Manual => std::option::Option::Some(1),
2391 Self::CloudKms => std::option::Option::Some(2),
2392 Self::UnknownValue(u) => u.0.value(),
2393 }
2394 }
2395
2396 /// Gets the enum value as a string.
2397 ///
2398 /// Returns `None` if the enum contains an unknown value deserialized from
2399 /// the integer representation of enums.
2400 pub fn name(&self) -> std::option::Option<&str> {
2401 match self {
2402 Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2403 Self::Manual => std::option::Option::Some("MANUAL"),
2404 Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2405 Self::UnknownValue(u) => u.0.name(),
2406 }
2407 }
2408 }
2409
2410 impl std::default::Default for KeyManagementMode {
2411 fn default() -> Self {
2412 use std::convert::From;
2413 Self::from(0)
2414 }
2415 }
2416
2417 impl std::fmt::Display for KeyManagementMode {
2418 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2419 wkt::internal::display_enum(f, self.name(), self.value())
2420 }
2421 }
2422
2423 impl std::convert::From<i32> for KeyManagementMode {
2424 fn from(value: i32) -> Self {
2425 match value {
2426 0 => Self::Unspecified,
2427 1 => Self::Manual,
2428 2 => Self::CloudKms,
2429 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2430 wkt::internal::UnknownEnumValue::Integer(value),
2431 )),
2432 }
2433 }
2434 }
2435
2436 impl std::convert::From<&str> for KeyManagementMode {
2437 fn from(value: &str) -> Self {
2438 use std::string::ToString;
2439 match value {
2440 "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2441 "MANUAL" => Self::Manual,
2442 "CLOUD_KMS" => Self::CloudKms,
2443 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2444 wkt::internal::UnknownEnumValue::String(value.to_string()),
2445 )),
2446 }
2447 }
2448 }
2449
2450 impl serde::ser::Serialize for KeyManagementMode {
2451 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2452 where
2453 S: serde::Serializer,
2454 {
2455 match self {
2456 Self::Unspecified => serializer.serialize_i32(0),
2457 Self::Manual => serializer.serialize_i32(1),
2458 Self::CloudKms => serializer.serialize_i32(2),
2459 Self::UnknownValue(u) => u.0.serialize(serializer),
2460 }
2461 }
2462 }
2463
2464 impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2465 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2466 where
2467 D: serde::Deserializer<'de>,
2468 {
2469 deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2470 ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2471 ))
2472 }
2473 }
2474}
2475
2476/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2477/// represents configuration parameters that apply to all
2478/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2479/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2480/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2481/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2482/// project and location.
2483///
2484/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2485/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2486/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2487/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2488/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2489#[derive(Clone, Default, PartialEq)]
2490#[non_exhaustive]
2491pub struct EkmConfig {
2492 /// Output only. The resource name for the
2493 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2494 /// `projects/*/locations/*/ekmConfig`.
2495 ///
2496 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2497 pub name: std::string::String,
2498
2499 /// Optional. Resource name of the default
2500 /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2501 /// the empty string removes the default.
2502 ///
2503 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2504 pub default_ekm_connection: std::string::String,
2505
2506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2507}
2508
2509impl EkmConfig {
2510 /// Creates a new default instance.
2511 pub fn new() -> Self {
2512 std::default::Default::default()
2513 }
2514
2515 /// Sets the value of [name][crate::model::EkmConfig::name].
2516 ///
2517 /// # Example
2518 /// ```ignore,no_run
2519 /// # use google_cloud_kms_v1::model::EkmConfig;
2520 /// let x = EkmConfig::new().set_name("example");
2521 /// ```
2522 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2523 self.name = v.into();
2524 self
2525 }
2526
2527 /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2528 ///
2529 /// # Example
2530 /// ```ignore,no_run
2531 /// # use google_cloud_kms_v1::model::EkmConfig;
2532 /// let x = EkmConfig::new().set_default_ekm_connection("example");
2533 /// ```
2534 pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2535 mut self,
2536 v: T,
2537 ) -> Self {
2538 self.default_ekm_connection = v.into();
2539 self
2540 }
2541}
2542
2543impl wkt::message::Message for EkmConfig {
2544 fn typename() -> &'static str {
2545 "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2546 }
2547}
2548
2549/// Request message for
2550/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2551///
2552/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2553#[derive(Clone, Default, PartialEq)]
2554#[non_exhaustive]
2555pub struct VerifyConnectivityRequest {
2556 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2557 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2558 ///
2559 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2560 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2561 pub name: std::string::String,
2562
2563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2564}
2565
2566impl VerifyConnectivityRequest {
2567 /// Creates a new default instance.
2568 pub fn new() -> Self {
2569 std::default::Default::default()
2570 }
2571
2572 /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2573 ///
2574 /// # Example
2575 /// ```ignore,no_run
2576 /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2577 /// let x = VerifyConnectivityRequest::new().set_name("example");
2578 /// ```
2579 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2580 self.name = v.into();
2581 self
2582 }
2583}
2584
2585impl wkt::message::Message for VerifyConnectivityRequest {
2586 fn typename() -> &'static str {
2587 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2588 }
2589}
2590
2591/// Response message for
2592/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2593///
2594/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2595#[derive(Clone, Default, PartialEq)]
2596#[non_exhaustive]
2597pub struct VerifyConnectivityResponse {
2598 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2599}
2600
2601impl VerifyConnectivityResponse {
2602 /// Creates a new default instance.
2603 pub fn new() -> Self {
2604 std::default::Default::default()
2605 }
2606}
2607
2608impl wkt::message::Message for VerifyConnectivityResponse {
2609 fn typename() -> &'static str {
2610 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2611 }
2612}
2613
2614/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2615/// represents a single-tenant HSM instance. It can be used for creating
2616/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2617/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2618/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2619/// well as performing cryptographic operations using keys created within the
2620/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2621///
2622/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2623/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2624/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2625#[derive(Clone, Default, PartialEq)]
2626#[non_exhaustive]
2627pub struct SingleTenantHsmInstance {
2628 /// Identifier. The resource name for this
2629 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2630 /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2631 ///
2632 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2633 pub name: std::string::String,
2634
2635 /// Output only. The time at which the
2636 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2637 /// created.
2638 ///
2639 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2640 pub create_time: std::option::Option<wkt::Timestamp>,
2641
2642 /// Output only. The state of the
2643 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2644 ///
2645 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2646 pub state: crate::model::single_tenant_hsm_instance::State,
2647
2648 /// Required. The quorum auth configuration for the
2649 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2650 ///
2651 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2652 pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2653
2654 /// Output only. The time at which the
2655 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2656 /// deleted.
2657 ///
2658 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2659 pub delete_time: std::option::Option<wkt::Timestamp>,
2660
2661 /// Output only. The system-defined duration that an instance can remain
2662 /// unrefreshed until it is automatically disabled. This will have a value of
2663 /// 730 days.
2664 pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2665
2666 /// Output only. The time at which the instance will be automatically disabled
2667 /// if not refreshed. This field is updated upon creation and after each
2668 /// successful refresh operation and enable. A
2669 /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2670 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2671 /// before this time otherwise the
2672 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2673 /// become disabled.
2674 ///
2675 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2676 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2677 pub disable_time: std::option::Option<wkt::Timestamp>,
2678
2679 /// Optional. Immutable. Indicates whether key portability is enabled for the
2680 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2681 /// This can only be set at creation time. Key portability features are
2682 /// disabled by default and not yet available in GA.
2683 ///
2684 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2685 pub key_portability_enabled: bool,
2686
2687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2688}
2689
2690impl SingleTenantHsmInstance {
2691 /// Creates a new default instance.
2692 pub fn new() -> Self {
2693 std::default::Default::default()
2694 }
2695
2696 /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2697 ///
2698 /// # Example
2699 /// ```ignore,no_run
2700 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2701 /// let x = SingleTenantHsmInstance::new().set_name("example");
2702 /// ```
2703 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2704 self.name = v.into();
2705 self
2706 }
2707
2708 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2709 ///
2710 /// # Example
2711 /// ```ignore,no_run
2712 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2713 /// use wkt::Timestamp;
2714 /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2715 /// ```
2716 pub fn set_create_time<T>(mut self, v: T) -> Self
2717 where
2718 T: std::convert::Into<wkt::Timestamp>,
2719 {
2720 self.create_time = std::option::Option::Some(v.into());
2721 self
2722 }
2723
2724 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2725 ///
2726 /// # Example
2727 /// ```ignore,no_run
2728 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2729 /// use wkt::Timestamp;
2730 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2731 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2732 /// ```
2733 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2734 where
2735 T: std::convert::Into<wkt::Timestamp>,
2736 {
2737 self.create_time = v.map(|x| x.into());
2738 self
2739 }
2740
2741 /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2742 ///
2743 /// # Example
2744 /// ```ignore,no_run
2745 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2746 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2747 /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2748 /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2749 /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2750 /// ```
2751 pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2752 mut self,
2753 v: T,
2754 ) -> Self {
2755 self.state = v.into();
2756 self
2757 }
2758
2759 /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2760 ///
2761 /// # Example
2762 /// ```ignore,no_run
2763 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2764 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2765 /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2766 /// ```
2767 pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2768 where
2769 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2770 {
2771 self.quorum_auth = std::option::Option::Some(v.into());
2772 self
2773 }
2774
2775 /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2776 ///
2777 /// # Example
2778 /// ```ignore,no_run
2779 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2780 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2781 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2782 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2783 /// ```
2784 pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2785 where
2786 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2787 {
2788 self.quorum_auth = v.map(|x| x.into());
2789 self
2790 }
2791
2792 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2793 ///
2794 /// # Example
2795 /// ```ignore,no_run
2796 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2797 /// use wkt::Timestamp;
2798 /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2799 /// ```
2800 pub fn set_delete_time<T>(mut self, v: T) -> Self
2801 where
2802 T: std::convert::Into<wkt::Timestamp>,
2803 {
2804 self.delete_time = std::option::Option::Some(v.into());
2805 self
2806 }
2807
2808 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2809 ///
2810 /// # Example
2811 /// ```ignore,no_run
2812 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2813 /// use wkt::Timestamp;
2814 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2815 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2816 /// ```
2817 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2818 where
2819 T: std::convert::Into<wkt::Timestamp>,
2820 {
2821 self.delete_time = v.map(|x| x.into());
2822 self
2823 }
2824
2825 /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2826 ///
2827 /// # Example
2828 /// ```ignore,no_run
2829 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2830 /// use wkt::Duration;
2831 /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2832 /// ```
2833 pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2834 where
2835 T: std::convert::Into<wkt::Duration>,
2836 {
2837 self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2838 self
2839 }
2840
2841 /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2842 ///
2843 /// # Example
2844 /// ```ignore,no_run
2845 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2846 /// use wkt::Duration;
2847 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2848 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2849 /// ```
2850 pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2851 mut self,
2852 v: std::option::Option<T>,
2853 ) -> Self
2854 where
2855 T: std::convert::Into<wkt::Duration>,
2856 {
2857 self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2858 self
2859 }
2860
2861 /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2862 ///
2863 /// # Example
2864 /// ```ignore,no_run
2865 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2866 /// use wkt::Timestamp;
2867 /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2868 /// ```
2869 pub fn set_disable_time<T>(mut self, v: T) -> Self
2870 where
2871 T: std::convert::Into<wkt::Timestamp>,
2872 {
2873 self.disable_time = std::option::Option::Some(v.into());
2874 self
2875 }
2876
2877 /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2878 ///
2879 /// # Example
2880 /// ```ignore,no_run
2881 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2882 /// use wkt::Timestamp;
2883 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2884 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2885 /// ```
2886 pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2887 where
2888 T: std::convert::Into<wkt::Timestamp>,
2889 {
2890 self.disable_time = v.map(|x| x.into());
2891 self
2892 }
2893
2894 /// Sets the value of [key_portability_enabled][crate::model::SingleTenantHsmInstance::key_portability_enabled].
2895 ///
2896 /// # Example
2897 /// ```ignore,no_run
2898 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2899 /// let x = SingleTenantHsmInstance::new().set_key_portability_enabled(true);
2900 /// ```
2901 pub fn set_key_portability_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2902 self.key_portability_enabled = v.into();
2903 self
2904 }
2905}
2906
2907impl wkt::message::Message for SingleTenantHsmInstance {
2908 fn typename() -> &'static str {
2909 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2910 }
2911}
2912
2913/// Defines additional types related to [SingleTenantHsmInstance].
2914pub mod single_tenant_hsm_instance {
2915 #[allow(unused_imports)]
2916 use super::*;
2917
2918 /// Configuration for M of N quorum auth.
2919 #[derive(Clone, Default, PartialEq)]
2920 #[non_exhaustive]
2921 pub struct QuorumAuth {
2922 /// Required. The total number of approvers. This is the N value used
2923 /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2924 /// or equal to 16.
2925 pub total_approver_count: i32,
2926
2927 /// Output only. The required numbers of approvers. The M value used for M of
2928 /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2929 /// to
2930 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2931 ///
2932 ///
2933 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2934 pub required_approver_count: i32,
2935
2936 /// Output only. The public keys associated with the 2FA keys for M of N
2937 /// quorum auth.
2938 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2939
2940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2941 }
2942
2943 impl QuorumAuth {
2944 /// Creates a new default instance.
2945 pub fn new() -> Self {
2946 std::default::Default::default()
2947 }
2948
2949 /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2950 ///
2951 /// # Example
2952 /// ```ignore,no_run
2953 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2954 /// let x = QuorumAuth::new().set_total_approver_count(42);
2955 /// ```
2956 pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2957 self.total_approver_count = v.into();
2958 self
2959 }
2960
2961 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2962 ///
2963 /// # Example
2964 /// ```ignore,no_run
2965 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2966 /// let x = QuorumAuth::new().set_required_approver_count(42);
2967 /// ```
2968 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2969 self.required_approver_count = v.into();
2970 self
2971 }
2972
2973 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
2974 ///
2975 /// # Example
2976 /// ```ignore,no_run
2977 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2978 /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
2979 /// ```
2980 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
2981 where
2982 T: std::iter::IntoIterator<Item = V>,
2983 V: std::convert::Into<std::string::String>,
2984 {
2985 use std::iter::Iterator;
2986 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
2987 self
2988 }
2989 }
2990
2991 impl wkt::message::Message for QuorumAuth {
2992 fn typename() -> &'static str {
2993 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
2994 }
2995 }
2996
2997 /// The set of states of a
2998 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2999 ///
3000 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3001 ///
3002 /// # Working with unknown values
3003 ///
3004 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3005 /// additional enum variants at any time. Adding new variants is not considered
3006 /// a breaking change. Applications should write their code in anticipation of:
3007 ///
3008 /// - New values appearing in future releases of the client library, **and**
3009 /// - New values received dynamically, without application changes.
3010 ///
3011 /// Please consult the [Working with enums] section in the user guide for some
3012 /// guidelines.
3013 ///
3014 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3015 #[derive(Clone, Debug, PartialEq)]
3016 #[non_exhaustive]
3017 pub enum State {
3018 /// Not specified.
3019 Unspecified,
3020 /// The
3021 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3022 /// being created.
3023 ///
3024 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3025 Creating,
3026 /// The
3027 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3028 /// waiting for 2FA keys to be registered. This can be done by calling
3029 /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
3030 /// with the [RegisterTwoFactorAuthKeys][] operation.
3031 ///
3032 /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
3033 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3034 PendingTwoFactorAuthRegistration,
3035 /// The
3036 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3037 /// ready to use. A
3038 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3039 /// must be in the
3040 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
3041 /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
3042 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
3043 /// be usable.
3044 ///
3045 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3046 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3047 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
3048 Active,
3049 /// The
3050 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3051 /// being disabled.
3052 ///
3053 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3054 Disabling,
3055 /// The
3056 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3057 /// disabled.
3058 ///
3059 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3060 Disabled,
3061 /// The
3062 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3063 /// being deleted. Requests to the instance will be rejected in this state.
3064 ///
3065 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3066 Deleting,
3067 /// The
3068 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3069 /// has been deleted.
3070 ///
3071 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3072 Deleted,
3073 /// The
3074 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3075 /// has failed and can not be recovered or used.
3076 ///
3077 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3078 Failed,
3079 /// If set, the enum was initialized with an unknown value.
3080 ///
3081 /// Applications can examine the value using [State::value] or
3082 /// [State::name].
3083 UnknownValue(state::UnknownValue),
3084 }
3085
3086 #[doc(hidden)]
3087 pub mod state {
3088 #[allow(unused_imports)]
3089 use super::*;
3090 #[derive(Clone, Debug, PartialEq)]
3091 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3092 }
3093
3094 impl State {
3095 /// Gets the enum value.
3096 ///
3097 /// Returns `None` if the enum contains an unknown value deserialized from
3098 /// the string representation of enums.
3099 pub fn value(&self) -> std::option::Option<i32> {
3100 match self {
3101 Self::Unspecified => std::option::Option::Some(0),
3102 Self::Creating => std::option::Option::Some(1),
3103 Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
3104 Self::Active => std::option::Option::Some(3),
3105 Self::Disabling => std::option::Option::Some(4),
3106 Self::Disabled => std::option::Option::Some(5),
3107 Self::Deleting => std::option::Option::Some(6),
3108 Self::Deleted => std::option::Option::Some(7),
3109 Self::Failed => std::option::Option::Some(8),
3110 Self::UnknownValue(u) => u.0.value(),
3111 }
3112 }
3113
3114 /// Gets the enum value as a string.
3115 ///
3116 /// Returns `None` if the enum contains an unknown value deserialized from
3117 /// the integer representation of enums.
3118 pub fn name(&self) -> std::option::Option<&str> {
3119 match self {
3120 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3121 Self::Creating => std::option::Option::Some("CREATING"),
3122 Self::PendingTwoFactorAuthRegistration => {
3123 std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
3124 }
3125 Self::Active => std::option::Option::Some("ACTIVE"),
3126 Self::Disabling => std::option::Option::Some("DISABLING"),
3127 Self::Disabled => std::option::Option::Some("DISABLED"),
3128 Self::Deleting => std::option::Option::Some("DELETING"),
3129 Self::Deleted => std::option::Option::Some("DELETED"),
3130 Self::Failed => std::option::Option::Some("FAILED"),
3131 Self::UnknownValue(u) => u.0.name(),
3132 }
3133 }
3134 }
3135
3136 impl std::default::Default for State {
3137 fn default() -> Self {
3138 use std::convert::From;
3139 Self::from(0)
3140 }
3141 }
3142
3143 impl std::fmt::Display for State {
3144 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3145 wkt::internal::display_enum(f, self.name(), self.value())
3146 }
3147 }
3148
3149 impl std::convert::From<i32> for State {
3150 fn from(value: i32) -> Self {
3151 match value {
3152 0 => Self::Unspecified,
3153 1 => Self::Creating,
3154 2 => Self::PendingTwoFactorAuthRegistration,
3155 3 => Self::Active,
3156 4 => Self::Disabling,
3157 5 => Self::Disabled,
3158 6 => Self::Deleting,
3159 7 => Self::Deleted,
3160 8 => Self::Failed,
3161 _ => Self::UnknownValue(state::UnknownValue(
3162 wkt::internal::UnknownEnumValue::Integer(value),
3163 )),
3164 }
3165 }
3166 }
3167
3168 impl std::convert::From<&str> for State {
3169 fn from(value: &str) -> Self {
3170 use std::string::ToString;
3171 match value {
3172 "STATE_UNSPECIFIED" => Self::Unspecified,
3173 "CREATING" => Self::Creating,
3174 "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
3175 "ACTIVE" => Self::Active,
3176 "DISABLING" => Self::Disabling,
3177 "DISABLED" => Self::Disabled,
3178 "DELETING" => Self::Deleting,
3179 "DELETED" => Self::Deleted,
3180 "FAILED" => Self::Failed,
3181 _ => Self::UnknownValue(state::UnknownValue(
3182 wkt::internal::UnknownEnumValue::String(value.to_string()),
3183 )),
3184 }
3185 }
3186 }
3187
3188 impl serde::ser::Serialize for State {
3189 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3190 where
3191 S: serde::Serializer,
3192 {
3193 match self {
3194 Self::Unspecified => serializer.serialize_i32(0),
3195 Self::Creating => serializer.serialize_i32(1),
3196 Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
3197 Self::Active => serializer.serialize_i32(3),
3198 Self::Disabling => serializer.serialize_i32(4),
3199 Self::Disabled => serializer.serialize_i32(5),
3200 Self::Deleting => serializer.serialize_i32(6),
3201 Self::Deleted => serializer.serialize_i32(7),
3202 Self::Failed => serializer.serialize_i32(8),
3203 Self::UnknownValue(u) => u.0.serialize(serializer),
3204 }
3205 }
3206 }
3207
3208 impl<'de> serde::de::Deserialize<'de> for State {
3209 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3210 where
3211 D: serde::Deserializer<'de>,
3212 {
3213 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3214 ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
3215 ))
3216 }
3217 }
3218}
3219
3220/// A
3221/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3222/// represents a proposal to perform an operation on a
3223/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3224///
3225/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3226/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3227#[derive(Clone, Default, PartialEq)]
3228#[non_exhaustive]
3229pub struct SingleTenantHsmInstanceProposal {
3230 /// Identifier. The resource name for this
3231 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
3232 /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
3233 ///
3234 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3235 pub name: std::string::String,
3236
3237 /// Output only. The time at which the
3238 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3239 /// was created.
3240 ///
3241 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3242 pub create_time: std::option::Option<wkt::Timestamp>,
3243
3244 /// Output only. The state of the
3245 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3246 ///
3247 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3248 pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3249
3250 /// Output only. The root cause of the most recent failure. Only present if
3251 /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3252 /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3253 ///
3254 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3255 pub failure_reason: std::string::String,
3256
3257 /// Output only. The time at which the
3258 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3259 /// was deleted.
3260 ///
3261 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3262 pub delete_time: std::option::Option<wkt::Timestamp>,
3263
3264 /// Output only. The time at which the soft-deleted
3265 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3266 /// will be permanently purged. This field is only populated
3267 /// when the state is DELETED and will be set a time after expiration of the
3268 /// proposal, i.e. >= expire_time or (create_time + ttl).
3269 ///
3270 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3271 pub purge_time: std::option::Option<wkt::Timestamp>,
3272
3273 /// The approval parameters for the
3274 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3275 /// The type of parameters is determined by the operation being proposed.
3276 ///
3277 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3278 pub approval_parameters:
3279 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3280
3281 /// The expiration of the
3282 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3283 /// If not set, the
3284 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3285 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3286 /// time is 5 minutes.
3287 ///
3288 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3289 pub expiration:
3290 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3291
3292 /// The operation to perform on the
3293 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3294 ///
3295 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3296 pub operation:
3297 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3298
3299 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3300}
3301
3302impl SingleTenantHsmInstanceProposal {
3303 /// Creates a new default instance.
3304 pub fn new() -> Self {
3305 std::default::Default::default()
3306 }
3307
3308 /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3309 ///
3310 /// # Example
3311 /// ```ignore,no_run
3312 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3313 /// let x = SingleTenantHsmInstanceProposal::new().set_name("example");
3314 /// ```
3315 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3316 self.name = v.into();
3317 self
3318 }
3319
3320 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3321 ///
3322 /// # Example
3323 /// ```ignore,no_run
3324 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3325 /// use wkt::Timestamp;
3326 /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3327 /// ```
3328 pub fn set_create_time<T>(mut self, v: T) -> Self
3329 where
3330 T: std::convert::Into<wkt::Timestamp>,
3331 {
3332 self.create_time = std::option::Option::Some(v.into());
3333 self
3334 }
3335
3336 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3337 ///
3338 /// # Example
3339 /// ```ignore,no_run
3340 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3341 /// use wkt::Timestamp;
3342 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3343 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3344 /// ```
3345 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3346 where
3347 T: std::convert::Into<wkt::Timestamp>,
3348 {
3349 self.create_time = v.map(|x| x.into());
3350 self
3351 }
3352
3353 /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3354 ///
3355 /// # Example
3356 /// ```ignore,no_run
3357 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3358 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3359 /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3360 /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3361 /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3362 /// ```
3363 pub fn set_state<
3364 T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3365 >(
3366 mut self,
3367 v: T,
3368 ) -> Self {
3369 self.state = v.into();
3370 self
3371 }
3372
3373 /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3374 ///
3375 /// # Example
3376 /// ```ignore,no_run
3377 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3378 /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3379 /// ```
3380 pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3381 self.failure_reason = v.into();
3382 self
3383 }
3384
3385 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3386 ///
3387 /// # Example
3388 /// ```ignore,no_run
3389 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3390 /// use wkt::Timestamp;
3391 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3392 /// ```
3393 pub fn set_delete_time<T>(mut self, v: T) -> Self
3394 where
3395 T: std::convert::Into<wkt::Timestamp>,
3396 {
3397 self.delete_time = std::option::Option::Some(v.into());
3398 self
3399 }
3400
3401 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3402 ///
3403 /// # Example
3404 /// ```ignore,no_run
3405 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3406 /// use wkt::Timestamp;
3407 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3408 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3409 /// ```
3410 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3411 where
3412 T: std::convert::Into<wkt::Timestamp>,
3413 {
3414 self.delete_time = v.map(|x| x.into());
3415 self
3416 }
3417
3418 /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3419 ///
3420 /// # Example
3421 /// ```ignore,no_run
3422 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3423 /// use wkt::Timestamp;
3424 /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3425 /// ```
3426 pub fn set_purge_time<T>(mut self, v: T) -> Self
3427 where
3428 T: std::convert::Into<wkt::Timestamp>,
3429 {
3430 self.purge_time = std::option::Option::Some(v.into());
3431 self
3432 }
3433
3434 /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3435 ///
3436 /// # Example
3437 /// ```ignore,no_run
3438 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3439 /// use wkt::Timestamp;
3440 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3441 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3442 /// ```
3443 pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3444 where
3445 T: std::convert::Into<wkt::Timestamp>,
3446 {
3447 self.purge_time = v.map(|x| x.into());
3448 self
3449 }
3450
3451 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3452 ///
3453 /// Note that all the setters affecting `approval_parameters` are mutually
3454 /// exclusive.
3455 ///
3456 /// # Example
3457 /// ```ignore,no_run
3458 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3459 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3460 /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3461 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3462 /// ```
3463 pub fn set_approval_parameters<
3464 T: std::convert::Into<
3465 std::option::Option<
3466 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3467 >,
3468 >,
3469 >(
3470 mut self,
3471 v: T,
3472 ) -> Self {
3473 self.approval_parameters = v.into();
3474 self
3475 }
3476
3477 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3478 /// if it holds a `QuorumParameters`, `None` if the field is not set or
3479 /// holds a different branch.
3480 pub fn quorum_parameters(
3481 &self,
3482 ) -> std::option::Option<
3483 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3484 > {
3485 #[allow(unreachable_patterns)]
3486 self.approval_parameters.as_ref().and_then(|v| match v {
3487 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3488 _ => std::option::Option::None,
3489 })
3490 }
3491
3492 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3493 /// to hold a `QuorumParameters`.
3494 ///
3495 /// Note that all the setters affecting `approval_parameters` are
3496 /// mutually exclusive.
3497 ///
3498 /// # Example
3499 /// ```ignore,no_run
3500 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3501 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3502 /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3503 /// assert!(x.quorum_parameters().is_some());
3504 /// assert!(x.required_action_quorum_parameters().is_none());
3505 /// ```
3506 pub fn set_quorum_parameters<
3507 T: std::convert::Into<
3508 std::boxed::Box<
3509 crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3510 >,
3511 >,
3512 >(
3513 mut self,
3514 v: T,
3515 ) -> Self {
3516 self.approval_parameters = std::option::Option::Some(
3517 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3518 v.into(),
3519 ),
3520 );
3521 self
3522 }
3523
3524 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3525 /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3526 /// holds a different branch.
3527 pub fn required_action_quorum_parameters(
3528 &self,
3529 ) -> std::option::Option<
3530 &std::boxed::Box<
3531 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3532 >,
3533 > {
3534 #[allow(unreachable_patterns)]
3535 self.approval_parameters.as_ref().and_then(|v| match v {
3536 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3537 _ => std::option::Option::None,
3538 })
3539 }
3540
3541 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3542 /// to hold a `RequiredActionQuorumParameters`.
3543 ///
3544 /// Note that all the setters affecting `approval_parameters` are
3545 /// mutually exclusive.
3546 ///
3547 /// # Example
3548 /// ```ignore,no_run
3549 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3550 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3551 /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3552 /// assert!(x.required_action_quorum_parameters().is_some());
3553 /// assert!(x.quorum_parameters().is_none());
3554 /// ```
3555 pub fn set_required_action_quorum_parameters<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters>>>(mut self, v: T) -> Self{
3556 self.approval_parameters = std::option::Option::Some(
3557 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3558 v.into()
3559 )
3560 );
3561 self
3562 }
3563
3564 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3565 ///
3566 /// Note that all the setters affecting `expiration` are mutually
3567 /// exclusive.
3568 ///
3569 /// # Example
3570 /// ```ignore,no_run
3571 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3572 /// use wkt::Timestamp;
3573 /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3574 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3575 /// ```
3576 pub fn set_expiration<
3577 T: std::convert::Into<
3578 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3579 >,
3580 >(
3581 mut self,
3582 v: T,
3583 ) -> Self {
3584 self.expiration = v.into();
3585 self
3586 }
3587
3588 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3589 /// if it holds a `ExpireTime`, `None` if the field is not set or
3590 /// holds a different branch.
3591 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3592 #[allow(unreachable_patterns)]
3593 self.expiration.as_ref().and_then(|v| match v {
3594 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3595 std::option::Option::Some(v)
3596 }
3597 _ => std::option::Option::None,
3598 })
3599 }
3600
3601 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3602 /// to hold a `ExpireTime`.
3603 ///
3604 /// Note that all the setters affecting `expiration` are
3605 /// mutually exclusive.
3606 ///
3607 /// # Example
3608 /// ```ignore,no_run
3609 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3610 /// use wkt::Timestamp;
3611 /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3612 /// assert!(x.expire_time().is_some());
3613 /// assert!(x.ttl().is_none());
3614 /// ```
3615 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3616 mut self,
3617 v: T,
3618 ) -> Self {
3619 self.expiration = std::option::Option::Some(
3620 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3621 );
3622 self
3623 }
3624
3625 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3626 /// if it holds a `Ttl`, `None` if the field is not set or
3627 /// holds a different branch.
3628 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3629 #[allow(unreachable_patterns)]
3630 self.expiration.as_ref().and_then(|v| match v {
3631 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3632 std::option::Option::Some(v)
3633 }
3634 _ => std::option::Option::None,
3635 })
3636 }
3637
3638 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3639 /// to hold a `Ttl`.
3640 ///
3641 /// Note that all the setters affecting `expiration` are
3642 /// mutually exclusive.
3643 ///
3644 /// # Example
3645 /// ```ignore,no_run
3646 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3647 /// use wkt::Duration;
3648 /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3649 /// assert!(x.ttl().is_some());
3650 /// assert!(x.expire_time().is_none());
3651 /// ```
3652 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3653 self.expiration = std::option::Option::Some(
3654 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3655 );
3656 self
3657 }
3658
3659 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3660 ///
3661 /// Note that all the setters affecting `operation` are mutually
3662 /// exclusive.
3663 ///
3664 /// # Example
3665 /// ```ignore,no_run
3666 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3667 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3668 /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3669 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3670 /// ```
3671 pub fn set_operation<
3672 T: std::convert::Into<
3673 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3674 >,
3675 >(
3676 mut self,
3677 v: T,
3678 ) -> Self {
3679 self.operation = v.into();
3680 self
3681 }
3682
3683 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3684 /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3685 /// holds a different branch.
3686 pub fn register_two_factor_auth_keys(
3687 &self,
3688 ) -> std::option::Option<
3689 &std::boxed::Box<
3690 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3691 >,
3692 > {
3693 #[allow(unreachable_patterns)]
3694 self.operation.as_ref().and_then(|v| match v {
3695 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3696 _ => std::option::Option::None,
3697 })
3698 }
3699
3700 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3701 /// to hold a `RegisterTwoFactorAuthKeys`.
3702 ///
3703 /// Note that all the setters affecting `operation` are
3704 /// mutually exclusive.
3705 ///
3706 /// # Example
3707 /// ```ignore,no_run
3708 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3709 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3710 /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3711 /// assert!(x.register_two_factor_auth_keys().is_some());
3712 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3713 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3714 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3715 /// assert!(x.add_quorum_member().is_none());
3716 /// assert!(x.remove_quorum_member().is_none());
3717 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3718 /// ```
3719 pub fn set_register_two_factor_auth_keys<
3720 T: std::convert::Into<
3721 std::boxed::Box<
3722 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3723 >,
3724 >,
3725 >(
3726 mut self,
3727 v: T,
3728 ) -> Self {
3729 self.operation = std::option::Option::Some(
3730 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3731 v.into(),
3732 ),
3733 );
3734 self
3735 }
3736
3737 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3738 /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3739 /// holds a different branch.
3740 pub fn disable_single_tenant_hsm_instance(
3741 &self,
3742 ) -> std::option::Option<
3743 &std::boxed::Box<
3744 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3745 >,
3746 > {
3747 #[allow(unreachable_patterns)]
3748 self.operation.as_ref().and_then(|v| match v {
3749 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3750 _ => std::option::Option::None,
3751 })
3752 }
3753
3754 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3755 /// to hold a `DisableSingleTenantHsmInstance`.
3756 ///
3757 /// Note that all the setters affecting `operation` are
3758 /// mutually exclusive.
3759 ///
3760 /// # Example
3761 /// ```ignore,no_run
3762 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3763 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3764 /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3765 /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3766 /// assert!(x.register_two_factor_auth_keys().is_none());
3767 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3768 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3769 /// assert!(x.add_quorum_member().is_none());
3770 /// assert!(x.remove_quorum_member().is_none());
3771 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3772 /// ```
3773 pub fn set_disable_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3774 self.operation = std::option::Option::Some(
3775 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3776 v.into()
3777 )
3778 );
3779 self
3780 }
3781
3782 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3783 /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3784 /// holds a different branch.
3785 pub fn enable_single_tenant_hsm_instance(
3786 &self,
3787 ) -> std::option::Option<
3788 &std::boxed::Box<
3789 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3790 >,
3791 > {
3792 #[allow(unreachable_patterns)]
3793 self.operation.as_ref().and_then(|v| match v {
3794 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3795 _ => std::option::Option::None,
3796 })
3797 }
3798
3799 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3800 /// to hold a `EnableSingleTenantHsmInstance`.
3801 ///
3802 /// Note that all the setters affecting `operation` are
3803 /// mutually exclusive.
3804 ///
3805 /// # Example
3806 /// ```ignore,no_run
3807 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3808 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3809 /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3810 /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3811 /// assert!(x.register_two_factor_auth_keys().is_none());
3812 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3813 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3814 /// assert!(x.add_quorum_member().is_none());
3815 /// assert!(x.remove_quorum_member().is_none());
3816 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3817 /// ```
3818 pub fn set_enable_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3819 self.operation = std::option::Option::Some(
3820 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3821 v.into()
3822 )
3823 );
3824 self
3825 }
3826
3827 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3828 /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3829 /// holds a different branch.
3830 pub fn delete_single_tenant_hsm_instance(
3831 &self,
3832 ) -> std::option::Option<
3833 &std::boxed::Box<
3834 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3835 >,
3836 > {
3837 #[allow(unreachable_patterns)]
3838 self.operation.as_ref().and_then(|v| match v {
3839 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3840 _ => std::option::Option::None,
3841 })
3842 }
3843
3844 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3845 /// to hold a `DeleteSingleTenantHsmInstance`.
3846 ///
3847 /// Note that all the setters affecting `operation` are
3848 /// mutually exclusive.
3849 ///
3850 /// # Example
3851 /// ```ignore,no_run
3852 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3853 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3854 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3855 /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3856 /// assert!(x.register_two_factor_auth_keys().is_none());
3857 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3858 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3859 /// assert!(x.add_quorum_member().is_none());
3860 /// assert!(x.remove_quorum_member().is_none());
3861 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3862 /// ```
3863 pub fn set_delete_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
3864 self.operation = std::option::Option::Some(
3865 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3866 v.into()
3867 )
3868 );
3869 self
3870 }
3871
3872 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3873 /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3874 /// holds a different branch.
3875 pub fn add_quorum_member(
3876 &self,
3877 ) -> std::option::Option<
3878 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3879 > {
3880 #[allow(unreachable_patterns)]
3881 self.operation.as_ref().and_then(|v| match v {
3882 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3883 std::option::Option::Some(v)
3884 }
3885 _ => std::option::Option::None,
3886 })
3887 }
3888
3889 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3890 /// to hold a `AddQuorumMember`.
3891 ///
3892 /// Note that all the setters affecting `operation` are
3893 /// mutually exclusive.
3894 ///
3895 /// # Example
3896 /// ```ignore,no_run
3897 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3898 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3899 /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3900 /// assert!(x.add_quorum_member().is_some());
3901 /// assert!(x.register_two_factor_auth_keys().is_none());
3902 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3903 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3904 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3905 /// assert!(x.remove_quorum_member().is_none());
3906 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3907 /// ```
3908 pub fn set_add_quorum_member<
3909 T: std::convert::Into<
3910 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3911 >,
3912 >(
3913 mut self,
3914 v: T,
3915 ) -> Self {
3916 self.operation = std::option::Option::Some(
3917 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3918 );
3919 self
3920 }
3921
3922 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3923 /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3924 /// holds a different branch.
3925 pub fn remove_quorum_member(
3926 &self,
3927 ) -> std::option::Option<
3928 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3929 > {
3930 #[allow(unreachable_patterns)]
3931 self.operation.as_ref().and_then(|v| match v {
3932 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3933 std::option::Option::Some(v)
3934 }
3935 _ => std::option::Option::None,
3936 })
3937 }
3938
3939 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3940 /// to hold a `RemoveQuorumMember`.
3941 ///
3942 /// Note that all the setters affecting `operation` are
3943 /// mutually exclusive.
3944 ///
3945 /// # Example
3946 /// ```ignore,no_run
3947 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3948 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
3949 /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3950 /// assert!(x.remove_quorum_member().is_some());
3951 /// assert!(x.register_two_factor_auth_keys().is_none());
3952 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3953 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3954 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3955 /// assert!(x.add_quorum_member().is_none());
3956 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3957 /// ```
3958 pub fn set_remove_quorum_member<
3959 T: std::convert::Into<
3960 std::boxed::Box<
3961 crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
3962 >,
3963 >,
3964 >(
3965 mut self,
3966 v: T,
3967 ) -> Self {
3968 self.operation = std::option::Option::Some(
3969 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
3970 v.into(),
3971 ),
3972 );
3973 self
3974 }
3975
3976 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3977 /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
3978 /// holds a different branch.
3979 pub fn refresh_single_tenant_hsm_instance(
3980 &self,
3981 ) -> std::option::Option<
3982 &std::boxed::Box<
3983 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
3984 >,
3985 > {
3986 #[allow(unreachable_patterns)]
3987 self.operation.as_ref().and_then(|v| match v {
3988 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3989 _ => std::option::Option::None,
3990 })
3991 }
3992
3993 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3994 /// to hold a `RefreshSingleTenantHsmInstance`.
3995 ///
3996 /// Note that all the setters affecting `operation` are
3997 /// mutually exclusive.
3998 ///
3999 /// # Example
4000 /// ```ignore,no_run
4001 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
4002 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
4003 /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
4004 /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
4005 /// assert!(x.register_two_factor_auth_keys().is_none());
4006 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
4007 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
4008 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
4009 /// assert!(x.add_quorum_member().is_none());
4010 /// assert!(x.remove_quorum_member().is_none());
4011 /// ```
4012 pub fn set_refresh_single_tenant_hsm_instance<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance>>>(mut self, v: T) -> Self{
4013 self.operation = std::option::Option::Some(
4014 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
4015 v.into()
4016 )
4017 );
4018 self
4019 }
4020}
4021
4022impl wkt::message::Message for SingleTenantHsmInstanceProposal {
4023 fn typename() -> &'static str {
4024 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
4025 }
4026}
4027
4028/// Defines additional types related to [SingleTenantHsmInstanceProposal].
4029pub mod single_tenant_hsm_instance_proposal {
4030 #[allow(unused_imports)]
4031 use super::*;
4032
4033 /// Parameters of quorum approval for the
4034 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4035 ///
4036 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4037 #[derive(Clone, Default, PartialEq)]
4038 #[non_exhaustive]
4039 pub struct QuorumParameters {
4040 /// Output only. The required numbers of approvers. This is the M value used
4041 /// for M of N quorum auth. It is less than the number of public keys.
4042 pub required_approver_count: i32,
4043
4044 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4045 /// of N of these challenges are required to be signed to approve the
4046 /// operation.
4047 pub challenges: std::vec::Vec<crate::model::Challenge>,
4048
4049 /// Output only. The public keys associated with the 2FA keys that have
4050 /// already approved the
4051 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4052 /// by signing the challenge.
4053 ///
4054 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4055 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4056
4057 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4058 }
4059
4060 impl QuorumParameters {
4061 /// Creates a new default instance.
4062 pub fn new() -> Self {
4063 std::default::Default::default()
4064 }
4065
4066 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
4067 ///
4068 /// # Example
4069 /// ```ignore,no_run
4070 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4071 /// let x = QuorumParameters::new().set_required_approver_count(42);
4072 /// ```
4073 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4074 self.required_approver_count = v.into();
4075 self
4076 }
4077
4078 /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
4079 ///
4080 /// # Example
4081 /// ```ignore,no_run
4082 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4083 /// use google_cloud_kms_v1::model::Challenge;
4084 /// let x = QuorumParameters::new()
4085 /// .set_challenges([
4086 /// Challenge::default()/* use setters */,
4087 /// Challenge::default()/* use (different) setters */,
4088 /// ]);
4089 /// ```
4090 pub fn set_challenges<T, V>(mut self, v: T) -> Self
4091 where
4092 T: std::iter::IntoIterator<Item = V>,
4093 V: std::convert::Into<crate::model::Challenge>,
4094 {
4095 use std::iter::Iterator;
4096 self.challenges = v.into_iter().map(|i| i.into()).collect();
4097 self
4098 }
4099
4100 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
4101 ///
4102 /// # Example
4103 /// ```ignore,no_run
4104 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4105 /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4106 /// ```
4107 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4108 where
4109 T: std::iter::IntoIterator<Item = V>,
4110 V: std::convert::Into<std::string::String>,
4111 {
4112 use std::iter::Iterator;
4113 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4114 self
4115 }
4116 }
4117
4118 impl wkt::message::Message for QuorumParameters {
4119 fn typename() -> &'static str {
4120 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
4121 }
4122 }
4123
4124 /// Parameters for an approval that has both required challenges and a
4125 /// quorum.
4126 #[derive(Clone, Default, PartialEq)]
4127 #[non_exhaustive]
4128 pub struct RequiredActionQuorumParameters {
4129 /// Output only. A list of specific challenges that must be signed.
4130 /// For some operations, this will contain a single challenge.
4131 pub required_challenges: std::vec::Vec<crate::model::Challenge>,
4132
4133 /// Output only. The required number of quorum approvers. This is the M value
4134 /// used for M of N quorum auth. It is less than the number of public keys.
4135 pub required_approver_count: i32,
4136
4137 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4138 /// of N of these challenges are required to be signed to approve the
4139 /// operation.
4140 pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
4141
4142 /// Output only. The public keys associated with the 2FA keys that have
4143 /// already approved the
4144 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4145 /// by signing the challenge.
4146 ///
4147 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4148 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4149
4150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4151 }
4152
4153 impl RequiredActionQuorumParameters {
4154 /// Creates a new default instance.
4155 pub fn new() -> Self {
4156 std::default::Default::default()
4157 }
4158
4159 /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
4160 ///
4161 /// # Example
4162 /// ```ignore,no_run
4163 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4164 /// use google_cloud_kms_v1::model::Challenge;
4165 /// let x = RequiredActionQuorumParameters::new()
4166 /// .set_required_challenges([
4167 /// Challenge::default()/* use setters */,
4168 /// Challenge::default()/* use (different) setters */,
4169 /// ]);
4170 /// ```
4171 pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
4172 where
4173 T: std::iter::IntoIterator<Item = V>,
4174 V: std::convert::Into<crate::model::Challenge>,
4175 {
4176 use std::iter::Iterator;
4177 self.required_challenges = v.into_iter().map(|i| i.into()).collect();
4178 self
4179 }
4180
4181 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
4182 ///
4183 /// # Example
4184 /// ```ignore,no_run
4185 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4186 /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
4187 /// ```
4188 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4189 self.required_approver_count = v.into();
4190 self
4191 }
4192
4193 /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
4194 ///
4195 /// # Example
4196 /// ```ignore,no_run
4197 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4198 /// use google_cloud_kms_v1::model::Challenge;
4199 /// let x = RequiredActionQuorumParameters::new()
4200 /// .set_quorum_challenges([
4201 /// Challenge::default()/* use setters */,
4202 /// Challenge::default()/* use (different) setters */,
4203 /// ]);
4204 /// ```
4205 pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
4206 where
4207 T: std::iter::IntoIterator<Item = V>,
4208 V: std::convert::Into<crate::model::Challenge>,
4209 {
4210 use std::iter::Iterator;
4211 self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
4212 self
4213 }
4214
4215 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
4216 ///
4217 /// # Example
4218 /// ```ignore,no_run
4219 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4220 /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4221 /// ```
4222 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4223 where
4224 T: std::iter::IntoIterator<Item = V>,
4225 V: std::convert::Into<std::string::String>,
4226 {
4227 use std::iter::Iterator;
4228 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4229 self
4230 }
4231 }
4232
4233 impl wkt::message::Message for RequiredActionQuorumParameters {
4234 fn typename() -> &'static str {
4235 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
4236 }
4237 }
4238
4239 /// Register 2FA keys for the
4240 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4241 /// This operation requires all Challenges to be signed by 2FA keys. The
4242 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4243 /// be in the
4244 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4245 /// state to perform this operation.
4246 ///
4247 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4248 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4249 #[derive(Clone, Default, PartialEq)]
4250 #[non_exhaustive]
4251 pub struct RegisterTwoFactorAuthKeys {
4252 /// Required. The required numbers of approvers to set for the
4253 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4254 /// This is the M value used for M of N quorum auth. Must be greater than or
4255 /// equal to 2 and less than or equal to
4256 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4257 ///
4258 ///
4259 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4260 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4261 pub required_approver_count: i32,
4262
4263 /// Required. The public keys associated with the 2FA keys for M of N quorum
4264 /// auth. Public keys must be associated with RSA 2048 keys.
4265 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4266
4267 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4268 }
4269
4270 impl RegisterTwoFactorAuthKeys {
4271 /// Creates a new default instance.
4272 pub fn new() -> Self {
4273 std::default::Default::default()
4274 }
4275
4276 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4277 ///
4278 /// # Example
4279 /// ```ignore,no_run
4280 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4281 /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4282 /// ```
4283 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4284 self.required_approver_count = v.into();
4285 self
4286 }
4287
4288 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4289 ///
4290 /// # Example
4291 /// ```ignore,no_run
4292 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4293 /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4294 /// ```
4295 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4296 where
4297 T: std::iter::IntoIterator<Item = V>,
4298 V: std::convert::Into<std::string::String>,
4299 {
4300 use std::iter::Iterator;
4301 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4302 self
4303 }
4304 }
4305
4306 impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4307 fn typename() -> &'static str {
4308 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4309 }
4310 }
4311
4312 /// Disable the
4313 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4314 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4315 /// be in the
4316 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4317 /// perform this operation.
4318 ///
4319 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4320 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4321 #[derive(Clone, Default, PartialEq)]
4322 #[non_exhaustive]
4323 pub struct DisableSingleTenantHsmInstance {
4324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4325 }
4326
4327 impl DisableSingleTenantHsmInstance {
4328 /// Creates a new default instance.
4329 pub fn new() -> Self {
4330 std::default::Default::default()
4331 }
4332 }
4333
4334 impl wkt::message::Message for DisableSingleTenantHsmInstance {
4335 fn typename() -> &'static str {
4336 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4337 }
4338 }
4339
4340 /// Enable the
4341 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4342 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4343 /// be in the
4344 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4345 /// state to perform this operation.
4346 ///
4347 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4348 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4349 #[derive(Clone, Default, PartialEq)]
4350 #[non_exhaustive]
4351 pub struct EnableSingleTenantHsmInstance {
4352 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4353 }
4354
4355 impl EnableSingleTenantHsmInstance {
4356 /// Creates a new default instance.
4357 pub fn new() -> Self {
4358 std::default::Default::default()
4359 }
4360 }
4361
4362 impl wkt::message::Message for EnableSingleTenantHsmInstance {
4363 fn typename() -> &'static str {
4364 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4365 }
4366 }
4367
4368 /// Delete the
4369 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4370 /// Deleting a
4371 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4372 /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4373 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4374 /// unusable. The
4375 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4376 /// not be in the
4377 /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4378 /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4379 /// to perform this operation.
4380 ///
4381 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4382 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4383 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4384 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4385 #[derive(Clone, Default, PartialEq)]
4386 #[non_exhaustive]
4387 pub struct DeleteSingleTenantHsmInstance {
4388 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4389 }
4390
4391 impl DeleteSingleTenantHsmInstance {
4392 /// Creates a new default instance.
4393 pub fn new() -> Self {
4394 std::default::Default::default()
4395 }
4396 }
4397
4398 impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4399 fn typename() -> &'static str {
4400 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4401 }
4402 }
4403
4404 /// Add a quorum member to the
4405 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4406 /// This will increase the
4407 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4408 /// by 1. The
4409 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4410 /// be in the
4411 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4412 /// perform this operation.
4413 ///
4414 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4415 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4416 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4417 #[derive(Clone, Default, PartialEq)]
4418 #[non_exhaustive]
4419 pub struct AddQuorumMember {
4420 /// Required. The public key associated with the 2FA key for the new quorum
4421 /// member to add. Public keys must be associated with RSA 2048 keys.
4422 pub two_factor_public_key_pem: std::string::String,
4423
4424 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4425 }
4426
4427 impl AddQuorumMember {
4428 /// Creates a new default instance.
4429 pub fn new() -> Self {
4430 std::default::Default::default()
4431 }
4432
4433 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4434 ///
4435 /// # Example
4436 /// ```ignore,no_run
4437 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4438 /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4439 /// ```
4440 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4441 mut self,
4442 v: T,
4443 ) -> Self {
4444 self.two_factor_public_key_pem = v.into();
4445 self
4446 }
4447 }
4448
4449 impl wkt::message::Message for AddQuorumMember {
4450 fn typename() -> &'static str {
4451 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4452 }
4453 }
4454
4455 /// Remove a quorum member from the
4456 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4457 /// This will reduce
4458 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4459 /// by 1. The
4460 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4461 /// be in the
4462 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4463 /// perform this operation.
4464 ///
4465 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4466 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4467 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4468 #[derive(Clone, Default, PartialEq)]
4469 #[non_exhaustive]
4470 pub struct RemoveQuorumMember {
4471 /// Required. The public key associated with the 2FA key for the quorum
4472 /// member to remove. Public keys must be associated with RSA 2048 keys.
4473 pub two_factor_public_key_pem: std::string::String,
4474
4475 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4476 }
4477
4478 impl RemoveQuorumMember {
4479 /// Creates a new default instance.
4480 pub fn new() -> Self {
4481 std::default::Default::default()
4482 }
4483
4484 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4485 ///
4486 /// # Example
4487 /// ```ignore,no_run
4488 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4489 /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4490 /// ```
4491 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4492 mut self,
4493 v: T,
4494 ) -> Self {
4495 self.two_factor_public_key_pem = v.into();
4496 self
4497 }
4498 }
4499
4500 impl wkt::message::Message for RemoveQuorumMember {
4501 fn typename() -> &'static str {
4502 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4503 }
4504 }
4505
4506 /// Refreshes the
4507 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4508 /// This operation must be performed periodically to keep the
4509 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4510 /// active. This operation must be performed before
4511 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4512 /// has passed. The
4513 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4514 /// be in the
4515 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4516 /// perform this operation.
4517 ///
4518 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4519 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4520 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4521 #[derive(Clone, Default, PartialEq)]
4522 #[non_exhaustive]
4523 pub struct RefreshSingleTenantHsmInstance {
4524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4525 }
4526
4527 impl RefreshSingleTenantHsmInstance {
4528 /// Creates a new default instance.
4529 pub fn new() -> Self {
4530 std::default::Default::default()
4531 }
4532 }
4533
4534 impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4535 fn typename() -> &'static str {
4536 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4537 }
4538 }
4539
4540 /// The set of states of a
4541 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4542 ///
4543 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4544 ///
4545 /// # Working with unknown values
4546 ///
4547 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4548 /// additional enum variants at any time. Adding new variants is not considered
4549 /// a breaking change. Applications should write their code in anticipation of:
4550 ///
4551 /// - New values appearing in future releases of the client library, **and**
4552 /// - New values received dynamically, without application changes.
4553 ///
4554 /// Please consult the [Working with enums] section in the user guide for some
4555 /// guidelines.
4556 ///
4557 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4558 #[derive(Clone, Debug, PartialEq)]
4559 #[non_exhaustive]
4560 pub enum State {
4561 /// Not specified.
4562 Unspecified,
4563 /// The
4564 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4565 /// is being created.
4566 ///
4567 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4568 Creating,
4569 /// The
4570 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4571 /// is pending approval.
4572 ///
4573 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4574 Pending,
4575 /// The
4576 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4577 /// has been approved.
4578 ///
4579 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4580 Approved,
4581 /// The
4582 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4583 /// is being executed.
4584 ///
4585 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4586 Running,
4587 /// The
4588 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4589 /// has been executed successfully.
4590 ///
4591 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4592 Succeeded,
4593 /// The
4594 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4595 /// has failed.
4596 ///
4597 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4598 Failed,
4599 /// The
4600 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4601 /// has been deleted and will be purged after the purge_time.
4602 ///
4603 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4604 Deleted,
4605 /// If set, the enum was initialized with an unknown value.
4606 ///
4607 /// Applications can examine the value using [State::value] or
4608 /// [State::name].
4609 UnknownValue(state::UnknownValue),
4610 }
4611
4612 #[doc(hidden)]
4613 pub mod state {
4614 #[allow(unused_imports)]
4615 use super::*;
4616 #[derive(Clone, Debug, PartialEq)]
4617 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4618 }
4619
4620 impl State {
4621 /// Gets the enum value.
4622 ///
4623 /// Returns `None` if the enum contains an unknown value deserialized from
4624 /// the string representation of enums.
4625 pub fn value(&self) -> std::option::Option<i32> {
4626 match self {
4627 Self::Unspecified => std::option::Option::Some(0),
4628 Self::Creating => std::option::Option::Some(1),
4629 Self::Pending => std::option::Option::Some(2),
4630 Self::Approved => std::option::Option::Some(3),
4631 Self::Running => std::option::Option::Some(4),
4632 Self::Succeeded => std::option::Option::Some(5),
4633 Self::Failed => std::option::Option::Some(6),
4634 Self::Deleted => std::option::Option::Some(7),
4635 Self::UnknownValue(u) => u.0.value(),
4636 }
4637 }
4638
4639 /// Gets the enum value as a string.
4640 ///
4641 /// Returns `None` if the enum contains an unknown value deserialized from
4642 /// the integer representation of enums.
4643 pub fn name(&self) -> std::option::Option<&str> {
4644 match self {
4645 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4646 Self::Creating => std::option::Option::Some("CREATING"),
4647 Self::Pending => std::option::Option::Some("PENDING"),
4648 Self::Approved => std::option::Option::Some("APPROVED"),
4649 Self::Running => std::option::Option::Some("RUNNING"),
4650 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4651 Self::Failed => std::option::Option::Some("FAILED"),
4652 Self::Deleted => std::option::Option::Some("DELETED"),
4653 Self::UnknownValue(u) => u.0.name(),
4654 }
4655 }
4656 }
4657
4658 impl std::default::Default for State {
4659 fn default() -> Self {
4660 use std::convert::From;
4661 Self::from(0)
4662 }
4663 }
4664
4665 impl std::fmt::Display for State {
4666 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4667 wkt::internal::display_enum(f, self.name(), self.value())
4668 }
4669 }
4670
4671 impl std::convert::From<i32> for State {
4672 fn from(value: i32) -> Self {
4673 match value {
4674 0 => Self::Unspecified,
4675 1 => Self::Creating,
4676 2 => Self::Pending,
4677 3 => Self::Approved,
4678 4 => Self::Running,
4679 5 => Self::Succeeded,
4680 6 => Self::Failed,
4681 7 => Self::Deleted,
4682 _ => Self::UnknownValue(state::UnknownValue(
4683 wkt::internal::UnknownEnumValue::Integer(value),
4684 )),
4685 }
4686 }
4687 }
4688
4689 impl std::convert::From<&str> for State {
4690 fn from(value: &str) -> Self {
4691 use std::string::ToString;
4692 match value {
4693 "STATE_UNSPECIFIED" => Self::Unspecified,
4694 "CREATING" => Self::Creating,
4695 "PENDING" => Self::Pending,
4696 "APPROVED" => Self::Approved,
4697 "RUNNING" => Self::Running,
4698 "SUCCEEDED" => Self::Succeeded,
4699 "FAILED" => Self::Failed,
4700 "DELETED" => Self::Deleted,
4701 _ => Self::UnknownValue(state::UnknownValue(
4702 wkt::internal::UnknownEnumValue::String(value.to_string()),
4703 )),
4704 }
4705 }
4706 }
4707
4708 impl serde::ser::Serialize for State {
4709 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4710 where
4711 S: serde::Serializer,
4712 {
4713 match self {
4714 Self::Unspecified => serializer.serialize_i32(0),
4715 Self::Creating => serializer.serialize_i32(1),
4716 Self::Pending => serializer.serialize_i32(2),
4717 Self::Approved => serializer.serialize_i32(3),
4718 Self::Running => serializer.serialize_i32(4),
4719 Self::Succeeded => serializer.serialize_i32(5),
4720 Self::Failed => serializer.serialize_i32(6),
4721 Self::Deleted => serializer.serialize_i32(7),
4722 Self::UnknownValue(u) => u.0.serialize(serializer),
4723 }
4724 }
4725 }
4726
4727 impl<'de> serde::de::Deserialize<'de> for State {
4728 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4729 where
4730 D: serde::Deserializer<'de>,
4731 {
4732 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4733 ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4734 ))
4735 }
4736 }
4737
4738 /// The approval parameters for the
4739 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4740 /// The type of parameters is determined by the operation being proposed.
4741 ///
4742 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4743 #[derive(Clone, Debug, PartialEq)]
4744 #[non_exhaustive]
4745 pub enum ApprovalParameters {
4746 /// Output only. The quorum approval parameters for the
4747 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4748 ///
4749 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4750 QuorumParameters(
4751 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4752 ),
4753 /// Output only. Parameters for an approval of a
4754 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4755 /// that has both required challenges and a quorum.
4756 ///
4757 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4758 RequiredActionQuorumParameters(
4759 std::boxed::Box<
4760 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4761 >,
4762 ),
4763 }
4764
4765 /// The expiration of the
4766 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4767 /// If not set, the
4768 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4769 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4770 /// time is 5 minutes.
4771 ///
4772 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4773 #[derive(Clone, Debug, PartialEq)]
4774 #[non_exhaustive]
4775 pub enum Expiration {
4776 /// The time at which the
4777 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4778 /// will expire if not approved and executed.
4779 ///
4780 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4781 ExpireTime(std::boxed::Box<wkt::Timestamp>),
4782 /// Input only. The TTL for the
4783 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4784 /// Proposals will expire after this duration.
4785 ///
4786 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4787 Ttl(std::boxed::Box<wkt::Duration>),
4788 }
4789
4790 /// The operation to perform on the
4791 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4792 ///
4793 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4794 #[derive(Clone, Debug, PartialEq)]
4795 #[non_exhaustive]
4796 pub enum Operation {
4797 /// Register 2FA keys for the
4798 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4799 /// This operation requires all N Challenges to be signed by 2FA keys. The
4800 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4801 /// must be in the
4802 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4803 /// state to perform this operation.
4804 ///
4805 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4806 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4807 RegisterTwoFactorAuthKeys(
4808 std::boxed::Box<
4809 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4810 >,
4811 ),
4812 /// Disable the
4813 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4814 /// The
4815 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4816 /// must be in the
4817 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4818 /// to perform this operation.
4819 ///
4820 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4821 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4822 DisableSingleTenantHsmInstance(
4823 std::boxed::Box<
4824 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4825 >,
4826 ),
4827 /// Enable the
4828 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4829 /// The
4830 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4831 /// must be in the
4832 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4833 /// state to perform this operation.
4834 ///
4835 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4836 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4837 EnableSingleTenantHsmInstance(
4838 std::boxed::Box<
4839 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4840 >,
4841 ),
4842 /// Delete the
4843 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4844 /// Deleting a
4845 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4846 /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4847 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4848 /// unusable. The
4849 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4850 /// must be in the
4851 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
4852 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4853 /// state to perform this operation.
4854 ///
4855 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4856 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4857 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4858 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4859 DeleteSingleTenantHsmInstance(
4860 std::boxed::Box<
4861 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
4862 >,
4863 ),
4864 /// Add a quorum member to the
4865 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4866 /// This will increase the
4867 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4868 /// by 1. The
4869 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4870 /// must be in the
4871 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4872 /// to perform this operation.
4873 ///
4874 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4875 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4876 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4877 AddQuorumMember(
4878 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
4879 ),
4880 /// Remove a quorum member from the
4881 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4882 /// This will reduce
4883 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4884 /// by 1. The
4885 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4886 /// must be in the
4887 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4888 /// to perform this operation.
4889 ///
4890 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4891 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4892 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4893 RemoveQuorumMember(
4894 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
4895 ),
4896 /// Refreshes the
4897 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4898 /// This operation must be performed periodically to keep the
4899 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4900 /// active. This operation must be performed before
4901 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4902 /// has passed. The
4903 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4904 /// must be in the
4905 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4906 /// to perform this operation.
4907 ///
4908 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4909 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4910 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4911 RefreshSingleTenantHsmInstance(
4912 std::boxed::Box<
4913 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4914 >,
4915 ),
4916 }
4917}
4918
4919/// A challenge to be signed by a 2FA key.
4920#[derive(Clone, Default, PartialEq)]
4921#[non_exhaustive]
4922pub struct Challenge {
4923 /// Output only. The challenge to be signed by the 2FA key indicated by the
4924 /// public key.
4925 pub challenge: ::bytes::Bytes,
4926
4927 /// Output only. The public key associated with the 2FA key that should sign
4928 /// the challenge.
4929 pub public_key_pem: std::string::String,
4930
4931 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4932}
4933
4934impl Challenge {
4935 /// Creates a new default instance.
4936 pub fn new() -> Self {
4937 std::default::Default::default()
4938 }
4939
4940 /// Sets the value of [challenge][crate::model::Challenge::challenge].
4941 ///
4942 /// # Example
4943 /// ```ignore,no_run
4944 /// # use google_cloud_kms_v1::model::Challenge;
4945 /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
4946 /// ```
4947 pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4948 self.challenge = v.into();
4949 self
4950 }
4951
4952 /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
4953 ///
4954 /// # Example
4955 /// ```ignore,no_run
4956 /// # use google_cloud_kms_v1::model::Challenge;
4957 /// let x = Challenge::new().set_public_key_pem("example");
4958 /// ```
4959 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4960 self.public_key_pem = v.into();
4961 self
4962 }
4963}
4964
4965impl wkt::message::Message for Challenge {
4966 fn typename() -> &'static str {
4967 "type.googleapis.com/google.cloud.kms.v1.Challenge"
4968 }
4969}
4970
4971/// A reply to a challenge signed by a 2FA key.
4972#[derive(Clone, Default, PartialEq)]
4973#[non_exhaustive]
4974pub struct ChallengeReply {
4975 /// Required. The signed challenge associated with the 2FA key.
4976 /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
4977 pub signed_challenge: ::bytes::Bytes,
4978
4979 /// Required. The public key associated with the 2FA key.
4980 pub public_key_pem: std::string::String,
4981
4982 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4983}
4984
4985impl ChallengeReply {
4986 /// Creates a new default instance.
4987 pub fn new() -> Self {
4988 std::default::Default::default()
4989 }
4990
4991 /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
4992 ///
4993 /// # Example
4994 /// ```ignore,no_run
4995 /// # use google_cloud_kms_v1::model::ChallengeReply;
4996 /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
4997 /// ```
4998 pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4999 self.signed_challenge = v.into();
5000 self
5001 }
5002
5003 /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
5004 ///
5005 /// # Example
5006 /// ```ignore,no_run
5007 /// # use google_cloud_kms_v1::model::ChallengeReply;
5008 /// let x = ChallengeReply::new().set_public_key_pem("example");
5009 /// ```
5010 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5011 self.public_key_pem = v.into();
5012 self
5013 }
5014}
5015
5016impl wkt::message::Message for ChallengeReply {
5017 fn typename() -> &'static str {
5018 "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
5019 }
5020}
5021
5022/// Request message for
5023/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5024///
5025/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5026#[derive(Clone, Default, PartialEq)]
5027#[non_exhaustive]
5028pub struct ListSingleTenantHsmInstancesRequest {
5029 /// Required. The resource name of the location associated with the
5030 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5031 /// list, in the format `projects/*/locations/*`.
5032 ///
5033 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5034 pub parent: std::string::String,
5035
5036 /// Optional. Optional limit on the number of
5037 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5038 /// include in the response. Further
5039 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
5040 /// subsequently be
5041 /// obtained by including the
5042 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
5043 /// in a subsequent request. If unspecified, the server will pick an
5044 /// appropriate default.
5045 ///
5046 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5047 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5048 pub page_size: i32,
5049
5050 /// Optional. Optional pagination token, returned earlier via
5051 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
5052 ///
5053 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5054 pub page_token: std::string::String,
5055
5056 /// Optional. Only include resources that match the filter in the response. For
5057 /// more information, see
5058 /// [Sorting and filtering list
5059 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5060 pub filter: std::string::String,
5061
5062 /// Optional. Specify how the results should be sorted. If not specified, the
5063 /// results will be sorted in the default order. For more information, see
5064 /// [Sorting and filtering list
5065 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5066 pub order_by: std::string::String,
5067
5068 /// Optional. If set to true,
5069 /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
5070 /// will also return
5071 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
5072 /// DELETED state.
5073 ///
5074 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5075 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5076 pub show_deleted: bool,
5077
5078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5079}
5080
5081impl ListSingleTenantHsmInstancesRequest {
5082 /// Creates a new default instance.
5083 pub fn new() -> Self {
5084 std::default::Default::default()
5085 }
5086
5087 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
5088 ///
5089 /// # Example
5090 /// ```ignore,no_run
5091 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5092 /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
5093 /// ```
5094 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5095 self.parent = v.into();
5096 self
5097 }
5098
5099 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
5100 ///
5101 /// # Example
5102 /// ```ignore,no_run
5103 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5104 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
5105 /// ```
5106 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5107 self.page_size = v.into();
5108 self
5109 }
5110
5111 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
5112 ///
5113 /// # Example
5114 /// ```ignore,no_run
5115 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5116 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
5117 /// ```
5118 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5119 self.page_token = v.into();
5120 self
5121 }
5122
5123 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
5124 ///
5125 /// # Example
5126 /// ```ignore,no_run
5127 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5128 /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
5129 /// ```
5130 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5131 self.filter = v.into();
5132 self
5133 }
5134
5135 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
5136 ///
5137 /// # Example
5138 /// ```ignore,no_run
5139 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5140 /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
5141 /// ```
5142 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5143 self.order_by = v.into();
5144 self
5145 }
5146
5147 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
5148 ///
5149 /// # Example
5150 /// ```ignore,no_run
5151 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5152 /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
5153 /// ```
5154 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5155 self.show_deleted = v.into();
5156 self
5157 }
5158}
5159
5160impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
5161 fn typename() -> &'static str {
5162 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
5163 }
5164}
5165
5166/// Response message for
5167/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5168///
5169/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5170#[derive(Clone, Default, PartialEq)]
5171#[non_exhaustive]
5172pub struct ListSingleTenantHsmInstancesResponse {
5173 /// The list of
5174 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
5175 ///
5176 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5177 pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
5178
5179 /// A token to retrieve next page of results. Pass this value in
5180 /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
5181 /// to retrieve the next page of results.
5182 ///
5183 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
5184 pub next_page_token: std::string::String,
5185
5186 /// The total number of
5187 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
5188 /// that matched the query.
5189 ///
5190 /// This field is not populated if
5191 /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
5192 /// is applied.
5193 ///
5194 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
5195 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5196 pub total_size: i32,
5197
5198 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5199}
5200
5201impl ListSingleTenantHsmInstancesResponse {
5202 /// Creates a new default instance.
5203 pub fn new() -> Self {
5204 std::default::Default::default()
5205 }
5206
5207 /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
5208 ///
5209 /// # Example
5210 /// ```ignore,no_run
5211 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5212 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5213 /// let x = ListSingleTenantHsmInstancesResponse::new()
5214 /// .set_single_tenant_hsm_instances([
5215 /// SingleTenantHsmInstance::default()/* use setters */,
5216 /// SingleTenantHsmInstance::default()/* use (different) setters */,
5217 /// ]);
5218 /// ```
5219 pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
5220 where
5221 T: std::iter::IntoIterator<Item = V>,
5222 V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5223 {
5224 use std::iter::Iterator;
5225 self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
5226 self
5227 }
5228
5229 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
5230 ///
5231 /// # Example
5232 /// ```ignore,no_run
5233 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5234 /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
5235 /// ```
5236 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5237 self.next_page_token = v.into();
5238 self
5239 }
5240
5241 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
5242 ///
5243 /// # Example
5244 /// ```ignore,no_run
5245 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5246 /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
5247 /// ```
5248 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5249 self.total_size = v.into();
5250 self
5251 }
5252}
5253
5254impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
5255 fn typename() -> &'static str {
5256 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
5257 }
5258}
5259
5260#[doc(hidden)]
5261impl google_cloud_gax::paginator::internal::PageableResponse
5262 for ListSingleTenantHsmInstancesResponse
5263{
5264 type PageItem = crate::model::SingleTenantHsmInstance;
5265
5266 fn items(self) -> std::vec::Vec<Self::PageItem> {
5267 self.single_tenant_hsm_instances
5268 }
5269
5270 fn next_page_token(&self) -> std::string::String {
5271 use std::clone::Clone;
5272 self.next_page_token.clone()
5273 }
5274}
5275
5276/// Request message for
5277/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5278///
5279/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5280#[derive(Clone, Default, PartialEq)]
5281#[non_exhaustive]
5282pub struct GetSingleTenantHsmInstanceRequest {
5283 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5284 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5285 /// to get.
5286 ///
5287 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5288 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5289 pub name: std::string::String,
5290
5291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5292}
5293
5294impl GetSingleTenantHsmInstanceRequest {
5295 /// Creates a new default instance.
5296 pub fn new() -> Self {
5297 std::default::Default::default()
5298 }
5299
5300 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5301 ///
5302 /// # Example
5303 /// ```ignore,no_run
5304 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5305 /// let x = GetSingleTenantHsmInstanceRequest::new().set_name("example");
5306 /// ```
5307 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5308 self.name = v.into();
5309 self
5310 }
5311}
5312
5313impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5314 fn typename() -> &'static str {
5315 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5316 }
5317}
5318
5319/// Request message for
5320/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5321///
5322/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5323#[derive(Clone, Default, PartialEq)]
5324#[non_exhaustive]
5325pub struct CreateSingleTenantHsmInstanceRequest {
5326 /// Required. The resource name of the location associated with the
5327 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5328 /// the format `projects/*/locations/*`.
5329 ///
5330 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5331 pub parent: std::string::String,
5332
5333 /// Optional. It must be unique within a location and match the regular
5334 /// expression `[a-zA-Z0-9_-]{1,63}`.
5335 pub single_tenant_hsm_instance_id: std::string::String,
5336
5337 /// Required. An
5338 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5339 /// initial field values.
5340 ///
5341 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5342 pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5343
5344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5345}
5346
5347impl CreateSingleTenantHsmInstanceRequest {
5348 /// Creates a new default instance.
5349 pub fn new() -> Self {
5350 std::default::Default::default()
5351 }
5352
5353 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5354 ///
5355 /// # Example
5356 /// ```ignore,no_run
5357 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5358 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5359 /// ```
5360 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5361 self.parent = v.into();
5362 self
5363 }
5364
5365 /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5366 ///
5367 /// # Example
5368 /// ```ignore,no_run
5369 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5370 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5371 /// ```
5372 pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5373 mut self,
5374 v: T,
5375 ) -> Self {
5376 self.single_tenant_hsm_instance_id = v.into();
5377 self
5378 }
5379
5380 /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5381 ///
5382 /// # Example
5383 /// ```ignore,no_run
5384 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5385 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5386 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5387 /// ```
5388 pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5389 where
5390 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5391 {
5392 self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5393 self
5394 }
5395
5396 /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5397 ///
5398 /// # Example
5399 /// ```ignore,no_run
5400 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5401 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5402 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5403 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5404 /// ```
5405 pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5406 where
5407 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5408 {
5409 self.single_tenant_hsm_instance = v.map(|x| x.into());
5410 self
5411 }
5412}
5413
5414impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5415 fn typename() -> &'static str {
5416 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5417 }
5418}
5419
5420/// Metadata message for
5421/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5422/// long-running operation response.
5423///
5424/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5425#[derive(Clone, Default, PartialEq)]
5426#[non_exhaustive]
5427pub struct CreateSingleTenantHsmInstanceMetadata {
5428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5429}
5430
5431impl CreateSingleTenantHsmInstanceMetadata {
5432 /// Creates a new default instance.
5433 pub fn new() -> Self {
5434 std::default::Default::default()
5435 }
5436}
5437
5438impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5439 fn typename() -> &'static str {
5440 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5441 }
5442}
5443
5444/// Request message for
5445/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5446///
5447/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5448#[derive(Clone, Default, PartialEq)]
5449#[non_exhaustive]
5450pub struct CreateSingleTenantHsmInstanceProposalRequest {
5451 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5452 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5453 /// associated with the
5454 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5455 ///
5456 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5457 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5458 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5459 pub parent: std::string::String,
5460
5461 /// Optional. It must be unique within a location and match the regular
5462 /// expression `[a-zA-Z0-9_-]{1,63}`.
5463 pub single_tenant_hsm_instance_proposal_id: std::string::String,
5464
5465 /// Required. The
5466 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5467 /// to create.
5468 ///
5469 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5470 pub single_tenant_hsm_instance_proposal:
5471 std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5472
5473 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5474}
5475
5476impl CreateSingleTenantHsmInstanceProposalRequest {
5477 /// Creates a new default instance.
5478 pub fn new() -> Self {
5479 std::default::Default::default()
5480 }
5481
5482 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5483 ///
5484 /// # Example
5485 /// ```ignore,no_run
5486 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5487 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent("example");
5488 /// ```
5489 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5490 self.parent = v.into();
5491 self
5492 }
5493
5494 /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5495 ///
5496 /// # Example
5497 /// ```ignore,no_run
5498 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5499 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5500 /// ```
5501 pub fn set_single_tenant_hsm_instance_proposal_id<
5502 T: std::convert::Into<std::string::String>,
5503 >(
5504 mut self,
5505 v: T,
5506 ) -> Self {
5507 self.single_tenant_hsm_instance_proposal_id = v.into();
5508 self
5509 }
5510
5511 /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5512 ///
5513 /// # Example
5514 /// ```ignore,no_run
5515 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5516 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5517 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5518 /// ```
5519 pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5520 where
5521 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5522 {
5523 self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5524 self
5525 }
5526
5527 /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5528 ///
5529 /// # Example
5530 /// ```ignore,no_run
5531 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5532 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5533 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5534 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5535 /// ```
5536 pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5537 mut self,
5538 v: std::option::Option<T>,
5539 ) -> Self
5540 where
5541 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5542 {
5543 self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5544 self
5545 }
5546}
5547
5548impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5549 fn typename() -> &'static str {
5550 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5551 }
5552}
5553
5554/// Metadata message for
5555/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5556/// long-running operation response.
5557///
5558/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5559#[derive(Clone, Default, PartialEq)]
5560#[non_exhaustive]
5561pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5563}
5564
5565impl CreateSingleTenantHsmInstanceProposalMetadata {
5566 /// Creates a new default instance.
5567 pub fn new() -> Self {
5568 std::default::Default::default()
5569 }
5570}
5571
5572impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5573 fn typename() -> &'static str {
5574 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5575 }
5576}
5577
5578/// Request message for
5579/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5580///
5581/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5582#[derive(Clone, Default, PartialEq)]
5583#[non_exhaustive]
5584pub struct GetSingleTenantHsmInstanceProposalRequest {
5585 /// Required. The
5586 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5587 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5588 /// to get.
5589 ///
5590 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5591 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5592 pub name: std::string::String,
5593
5594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5595}
5596
5597impl GetSingleTenantHsmInstanceProposalRequest {
5598 /// Creates a new default instance.
5599 pub fn new() -> Self {
5600 std::default::Default::default()
5601 }
5602
5603 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5604 ///
5605 /// # Example
5606 /// ```ignore,no_run
5607 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5608 /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5609 /// ```
5610 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5611 self.name = v.into();
5612 self
5613 }
5614}
5615
5616impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5617 fn typename() -> &'static str {
5618 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5619 }
5620}
5621
5622/// Request message for
5623/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5624///
5625/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5626#[derive(Clone, Default, PartialEq)]
5627#[non_exhaustive]
5628pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5629 /// Required. The
5630 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5631 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5632 /// to approve.
5633 ///
5634 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5635 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5636 pub name: std::string::String,
5637
5638 /// The approval payload. The type of approval payload must correspond to the
5639 /// type of approval_parameters in the proposal.
5640 pub approval_payload: std::option::Option<
5641 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5642 >,
5643
5644 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5645}
5646
5647impl ApproveSingleTenantHsmInstanceProposalRequest {
5648 /// Creates a new default instance.
5649 pub fn new() -> Self {
5650 std::default::Default::default()
5651 }
5652
5653 /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5654 ///
5655 /// # Example
5656 /// ```ignore,no_run
5657 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5658 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5659 /// ```
5660 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5661 self.name = v.into();
5662 self
5663 }
5664
5665 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5666 ///
5667 /// Note that all the setters affecting `approval_payload` are mutually
5668 /// exclusive.
5669 ///
5670 /// # Example
5671 /// ```ignore,no_run
5672 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5673 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5674 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5675 /// google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5676 /// ```
5677 pub fn set_approval_payload<T: std::convert::Into<std::option::Option<crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload>>>(mut self, v: T) -> Self
5678 {
5679 self.approval_payload = v.into();
5680 self
5681 }
5682
5683 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5684 /// if it holds a `QuorumReply`, `None` if the field is not set or
5685 /// holds a different branch.
5686 pub fn quorum_reply(
5687 &self,
5688 ) -> std::option::Option<
5689 &std::boxed::Box<
5690 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5691 >,
5692 > {
5693 #[allow(unreachable_patterns)]
5694 self.approval_payload.as_ref().and_then(|v| match v {
5695 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5696 _ => std::option::Option::None,
5697 })
5698 }
5699
5700 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5701 /// to hold a `QuorumReply`.
5702 ///
5703 /// Note that all the setters affecting `approval_payload` are
5704 /// mutually exclusive.
5705 ///
5706 /// # Example
5707 /// ```ignore,no_run
5708 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5709 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5710 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5711 /// assert!(x.quorum_reply().is_some());
5712 /// assert!(x.required_action_quorum_reply().is_none());
5713 /// ```
5714 pub fn set_quorum_reply<
5715 T: std::convert::Into<
5716 std::boxed::Box<
5717 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5718 >,
5719 >,
5720 >(
5721 mut self,
5722 v: T,
5723 ) -> Self {
5724 self.approval_payload = std::option::Option::Some(
5725 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5726 v.into()
5727 )
5728 );
5729 self
5730 }
5731
5732 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5733 /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5734 /// holds a different branch.
5735 pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5736 #[allow(unreachable_patterns)]
5737 self.approval_payload.as_ref().and_then(|v| match v {
5738 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5739 _ => std::option::Option::None,
5740 })
5741 }
5742
5743 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5744 /// to hold a `RequiredActionQuorumReply`.
5745 ///
5746 /// Note that all the setters affecting `approval_payload` are
5747 /// mutually exclusive.
5748 ///
5749 /// # Example
5750 /// ```ignore,no_run
5751 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5752 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5753 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5754 /// assert!(x.required_action_quorum_reply().is_some());
5755 /// assert!(x.quorum_reply().is_none());
5756 /// ```
5757 pub fn set_required_action_quorum_reply<T: std::convert::Into<std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>>(mut self, v: T) -> Self{
5758 self.approval_payload = std::option::Option::Some(
5759 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5760 v.into()
5761 )
5762 );
5763 self
5764 }
5765}
5766
5767impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5768 fn typename() -> &'static str {
5769 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5770 }
5771}
5772
5773/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5774pub mod approve_single_tenant_hsm_instance_proposal_request {
5775 #[allow(unused_imports)]
5776 use super::*;
5777
5778 /// The reply to
5779 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5780 /// for approving the proposal.
5781 ///
5782 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5783 #[derive(Clone, Default, PartialEq)]
5784 #[non_exhaustive]
5785 pub struct QuorumReply {
5786 /// Required. The challenge replies to approve the proposal. Challenge
5787 /// replies can be sent across multiple requests. The proposal will be
5788 /// approved when
5789 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5790 /// challenge replies are provided.
5791 ///
5792 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5793 pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5794
5795 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5796 }
5797
5798 impl QuorumReply {
5799 /// Creates a new default instance.
5800 pub fn new() -> Self {
5801 std::default::Default::default()
5802 }
5803
5804 /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5805 ///
5806 /// # Example
5807 /// ```ignore,no_run
5808 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5809 /// use google_cloud_kms_v1::model::ChallengeReply;
5810 /// let x = QuorumReply::new()
5811 /// .set_challenge_replies([
5812 /// ChallengeReply::default()/* use setters */,
5813 /// ChallengeReply::default()/* use (different) setters */,
5814 /// ]);
5815 /// ```
5816 pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5817 where
5818 T: std::iter::IntoIterator<Item = V>,
5819 V: std::convert::Into<crate::model::ChallengeReply>,
5820 {
5821 use std::iter::Iterator;
5822 self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5823 self
5824 }
5825 }
5826
5827 impl wkt::message::Message for QuorumReply {
5828 fn typename() -> &'static str {
5829 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
5830 }
5831 }
5832
5833 /// The reply to
5834 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5835 /// for approving the proposal.
5836 ///
5837 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5838 #[derive(Clone, Default, PartialEq)]
5839 #[non_exhaustive]
5840 pub struct RequiredActionQuorumReply {
5841 /// Required. All required challenges must be signed for the proposal to be
5842 /// approved. These can be sent across multiple requests.
5843 pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5844
5845 /// Required. Quorum members' signed challenge replies. These can be provided
5846 /// across multiple requests. The proposal will be approved when
5847 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
5848 /// quorum_challenge_replies are provided and when all
5849 /// required_challenge_replies are provided.
5850 ///
5851 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
5852 pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5853
5854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5855 }
5856
5857 impl RequiredActionQuorumReply {
5858 /// Creates a new default instance.
5859 pub fn new() -> Self {
5860 std::default::Default::default()
5861 }
5862
5863 /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
5864 ///
5865 /// # Example
5866 /// ```ignore,no_run
5867 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5868 /// use google_cloud_kms_v1::model::ChallengeReply;
5869 /// let x = RequiredActionQuorumReply::new()
5870 /// .set_required_challenge_replies([
5871 /// ChallengeReply::default()/* use setters */,
5872 /// ChallengeReply::default()/* use (different) setters */,
5873 /// ]);
5874 /// ```
5875 pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
5876 where
5877 T: std::iter::IntoIterator<Item = V>,
5878 V: std::convert::Into<crate::model::ChallengeReply>,
5879 {
5880 use std::iter::Iterator;
5881 self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5882 self
5883 }
5884
5885 /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
5886 ///
5887 /// # Example
5888 /// ```ignore,no_run
5889 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5890 /// use google_cloud_kms_v1::model::ChallengeReply;
5891 /// let x = RequiredActionQuorumReply::new()
5892 /// .set_quorum_challenge_replies([
5893 /// ChallengeReply::default()/* use setters */,
5894 /// ChallengeReply::default()/* use (different) setters */,
5895 /// ]);
5896 /// ```
5897 pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
5898 where
5899 T: std::iter::IntoIterator<Item = V>,
5900 V: std::convert::Into<crate::model::ChallengeReply>,
5901 {
5902 use std::iter::Iterator;
5903 self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5904 self
5905 }
5906 }
5907
5908 impl wkt::message::Message for RequiredActionQuorumReply {
5909 fn typename() -> &'static str {
5910 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
5911 }
5912 }
5913
5914 /// The approval payload. The type of approval payload must correspond to the
5915 /// type of approval_parameters in the proposal.
5916 #[derive(Clone, Debug, PartialEq)]
5917 #[non_exhaustive]
5918 pub enum ApprovalPayload {
5919 /// Required. The reply to
5920 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5921 /// for approving the proposal.
5922 ///
5923 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5924 QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
5925 /// Required. The reply to
5926 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5927 /// for approving the proposal.
5928 ///
5929 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5930 RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
5931 }
5932}
5933
5934/// Response message for
5935/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5936///
5937/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5938#[derive(Clone, Default, PartialEq)]
5939#[non_exhaustive]
5940pub struct ApproveSingleTenantHsmInstanceProposalResponse {
5941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5942}
5943
5944impl ApproveSingleTenantHsmInstanceProposalResponse {
5945 /// Creates a new default instance.
5946 pub fn new() -> Self {
5947 std::default::Default::default()
5948 }
5949}
5950
5951impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
5952 fn typename() -> &'static str {
5953 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
5954 }
5955}
5956
5957/// Request message for
5958/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5959///
5960/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5961#[derive(Clone, Default, PartialEq)]
5962#[non_exhaustive]
5963pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
5964 /// Required. The
5965 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5966 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5967 /// to execute.
5968 ///
5969 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5970 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5971 pub name: std::string::String,
5972
5973 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5974}
5975
5976impl ExecuteSingleTenantHsmInstanceProposalRequest {
5977 /// Creates a new default instance.
5978 pub fn new() -> Self {
5979 std::default::Default::default()
5980 }
5981
5982 /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
5983 ///
5984 /// # Example
5985 /// ```ignore,no_run
5986 /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
5987 /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5988 /// ```
5989 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5990 self.name = v.into();
5991 self
5992 }
5993}
5994
5995impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
5996 fn typename() -> &'static str {
5997 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
5998 }
5999}
6000
6001/// Response message for
6002/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
6003///
6004/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6005#[derive(Clone, Default, PartialEq)]
6006#[non_exhaustive]
6007pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
6008 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6009}
6010
6011impl ExecuteSingleTenantHsmInstanceProposalResponse {
6012 /// Creates a new default instance.
6013 pub fn new() -> Self {
6014 std::default::Default::default()
6015 }
6016}
6017
6018impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
6019 fn typename() -> &'static str {
6020 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
6021 }
6022}
6023
6024/// Metadata message for
6025/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
6026/// long-running operation response.
6027///
6028/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6029#[derive(Clone, Default, PartialEq)]
6030#[non_exhaustive]
6031pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
6032 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6033}
6034
6035impl ExecuteSingleTenantHsmInstanceProposalMetadata {
6036 /// Creates a new default instance.
6037 pub fn new() -> Self {
6038 std::default::Default::default()
6039 }
6040}
6041
6042impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
6043 fn typename() -> &'static str {
6044 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
6045 }
6046}
6047
6048/// Request message for
6049/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6050///
6051/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6052#[derive(Clone, Default, PartialEq)]
6053#[non_exhaustive]
6054pub struct ListSingleTenantHsmInstanceProposalsRequest {
6055 /// Required. The resource name of the single tenant HSM instance associated
6056 /// with the
6057 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6058 /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
6059 ///
6060 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6061 pub parent: std::string::String,
6062
6063 /// Optional. Optional limit on the number of
6064 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6065 /// to include in the response. Further
6066 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6067 /// can subsequently be obtained by including the
6068 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
6069 /// in a subsequent request. If unspecified, the server will pick an
6070 /// appropriate default.
6071 ///
6072 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6073 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6074 pub page_size: i32,
6075
6076 /// Optional. Optional pagination token, returned earlier via
6077 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
6078 ///
6079 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6080 pub page_token: std::string::String,
6081
6082 /// Optional. Only include resources that match the filter in the response. For
6083 /// more information, see
6084 /// [Sorting and filtering list
6085 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6086 pub filter: std::string::String,
6087
6088 /// Optional. Specify how the results should be sorted. If not specified, the
6089 /// results will be sorted in the default order. For more information, see
6090 /// [Sorting and filtering list
6091 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6092 pub order_by: std::string::String,
6093
6094 /// Optional. If set to true,
6095 /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
6096 /// will also return
6097 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6098 /// in DELETED state.
6099 ///
6100 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6101 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6102 pub show_deleted: bool,
6103
6104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6105}
6106
6107impl ListSingleTenantHsmInstanceProposalsRequest {
6108 /// Creates a new default instance.
6109 pub fn new() -> Self {
6110 std::default::Default::default()
6111 }
6112
6113 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
6114 ///
6115 /// # Example
6116 /// ```ignore,no_run
6117 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6118 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent("example");
6119 /// ```
6120 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6121 self.parent = v.into();
6122 self
6123 }
6124
6125 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
6126 ///
6127 /// # Example
6128 /// ```ignore,no_run
6129 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6130 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
6131 /// ```
6132 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6133 self.page_size = v.into();
6134 self
6135 }
6136
6137 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
6138 ///
6139 /// # Example
6140 /// ```ignore,no_run
6141 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6142 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
6143 /// ```
6144 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6145 self.page_token = v.into();
6146 self
6147 }
6148
6149 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
6150 ///
6151 /// # Example
6152 /// ```ignore,no_run
6153 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6154 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
6155 /// ```
6156 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6157 self.filter = v.into();
6158 self
6159 }
6160
6161 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
6162 ///
6163 /// # Example
6164 /// ```ignore,no_run
6165 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6166 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
6167 /// ```
6168 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6169 self.order_by = v.into();
6170 self
6171 }
6172
6173 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
6174 ///
6175 /// # Example
6176 /// ```ignore,no_run
6177 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6178 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
6179 /// ```
6180 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6181 self.show_deleted = v.into();
6182 self
6183 }
6184}
6185
6186impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
6187 fn typename() -> &'static str {
6188 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
6189 }
6190}
6191
6192/// Response message for
6193/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6194///
6195/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6196#[derive(Clone, Default, PartialEq)]
6197#[non_exhaustive]
6198pub struct ListSingleTenantHsmInstanceProposalsResponse {
6199 /// The list of
6200 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
6201 ///
6202 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6203 pub single_tenant_hsm_instance_proposals:
6204 std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
6205
6206 /// A token to retrieve next page of results. Pass this value in
6207 /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
6208 /// to retrieve the next page of results.
6209 ///
6210 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
6211 pub next_page_token: std::string::String,
6212
6213 /// The total number of
6214 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6215 /// that matched the query.
6216 ///
6217 /// This field is not populated if
6218 /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
6219 /// is applied.
6220 ///
6221 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
6222 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6223 pub total_size: i32,
6224
6225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6226}
6227
6228impl ListSingleTenantHsmInstanceProposalsResponse {
6229 /// Creates a new default instance.
6230 pub fn new() -> Self {
6231 std::default::Default::default()
6232 }
6233
6234 /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
6235 ///
6236 /// # Example
6237 /// ```ignore,no_run
6238 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6239 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
6240 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
6241 /// .set_single_tenant_hsm_instance_proposals([
6242 /// SingleTenantHsmInstanceProposal::default()/* use setters */,
6243 /// SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
6244 /// ]);
6245 /// ```
6246 pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
6247 where
6248 T: std::iter::IntoIterator<Item = V>,
6249 V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
6250 {
6251 use std::iter::Iterator;
6252 self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
6253 self
6254 }
6255
6256 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
6257 ///
6258 /// # Example
6259 /// ```ignore,no_run
6260 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6261 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
6262 /// ```
6263 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6264 self.next_page_token = v.into();
6265 self
6266 }
6267
6268 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
6269 ///
6270 /// # Example
6271 /// ```ignore,no_run
6272 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6273 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6274 /// ```
6275 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6276 self.total_size = v.into();
6277 self
6278 }
6279}
6280
6281impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6282 fn typename() -> &'static str {
6283 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6284 }
6285}
6286
6287#[doc(hidden)]
6288impl google_cloud_gax::paginator::internal::PageableResponse
6289 for ListSingleTenantHsmInstanceProposalsResponse
6290{
6291 type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6292
6293 fn items(self) -> std::vec::Vec<Self::PageItem> {
6294 self.single_tenant_hsm_instance_proposals
6295 }
6296
6297 fn next_page_token(&self) -> std::string::String {
6298 use std::clone::Clone;
6299 self.next_page_token.clone()
6300 }
6301}
6302
6303/// Request message for
6304/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6305///
6306/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6307#[derive(Clone, Default, PartialEq)]
6308#[non_exhaustive]
6309pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6310 /// Required. The
6311 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6312 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6313 /// to delete.
6314 ///
6315 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6316 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6317 pub name: std::string::String,
6318
6319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6320}
6321
6322impl DeleteSingleTenantHsmInstanceProposalRequest {
6323 /// Creates a new default instance.
6324 pub fn new() -> Self {
6325 std::default::Default::default()
6326 }
6327
6328 /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6329 ///
6330 /// # Example
6331 /// ```ignore,no_run
6332 /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6333 /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
6334 /// ```
6335 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6336 self.name = v.into();
6337 self
6338 }
6339}
6340
6341impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6342 fn typename() -> &'static str {
6343 "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6344 }
6345}
6346
6347/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6348/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6349///
6350/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6351/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6352#[derive(Clone, Default, PartialEq)]
6353#[non_exhaustive]
6354pub struct KeyRing {
6355 /// Output only. The resource name for the
6356 /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6357 /// `projects/*/locations/*/keyRings/*`.
6358 ///
6359 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6360 pub name: std::string::String,
6361
6362 /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6363 /// was created.
6364 ///
6365 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6366 pub create_time: std::option::Option<wkt::Timestamp>,
6367
6368 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6369}
6370
6371impl KeyRing {
6372 /// Creates a new default instance.
6373 pub fn new() -> Self {
6374 std::default::Default::default()
6375 }
6376
6377 /// Sets the value of [name][crate::model::KeyRing::name].
6378 ///
6379 /// # Example
6380 /// ```ignore,no_run
6381 /// # use google_cloud_kms_v1::model::KeyRing;
6382 /// let x = KeyRing::new().set_name("example");
6383 /// ```
6384 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6385 self.name = v.into();
6386 self
6387 }
6388
6389 /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6390 ///
6391 /// # Example
6392 /// ```ignore,no_run
6393 /// # use google_cloud_kms_v1::model::KeyRing;
6394 /// use wkt::Timestamp;
6395 /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6396 /// ```
6397 pub fn set_create_time<T>(mut self, v: T) -> Self
6398 where
6399 T: std::convert::Into<wkt::Timestamp>,
6400 {
6401 self.create_time = std::option::Option::Some(v.into());
6402 self
6403 }
6404
6405 /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6406 ///
6407 /// # Example
6408 /// ```ignore,no_run
6409 /// # use google_cloud_kms_v1::model::KeyRing;
6410 /// use wkt::Timestamp;
6411 /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6412 /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6413 /// ```
6414 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6415 where
6416 T: std::convert::Into<wkt::Timestamp>,
6417 {
6418 self.create_time = v.map(|x| x.into());
6419 self
6420 }
6421}
6422
6423impl wkt::message::Message for KeyRing {
6424 fn typename() -> &'static str {
6425 "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6426 }
6427}
6428
6429/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6430/// can be used for cryptographic operations.
6431///
6432/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6433/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6434/// key material used in cryptographic operations.
6435///
6436/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6437/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6438#[derive(Clone, Default, PartialEq)]
6439#[non_exhaustive]
6440pub struct CryptoKey {
6441 /// Output only. The resource name for this
6442 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6443 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6444 ///
6445 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6446 pub name: std::string::String,
6447
6448 /// Output only. A copy of the "primary"
6449 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6450 /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6451 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6452 /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6453 ///
6454 /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6455 /// updated via
6456 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6457 ///
6458 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6459 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6460 /// may have a primary. For other keys, this field will be omitted.
6461 ///
6462 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6463 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6464 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6465 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6466 /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6467 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6468 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6469 pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6470
6471 /// Immutable. The immutable purpose of this
6472 /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6473 ///
6474 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6475 pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6476
6477 /// Output only. The time at which this
6478 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6479 ///
6480 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6481 pub create_time: std::option::Option<wkt::Timestamp>,
6482
6483 /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6484 /// the Key Management Service will automatically:
6485 ///
6486 /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6487 /// 1. Mark the new version as primary.
6488 ///
6489 /// Key rotations performed manually via
6490 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6491 /// and
6492 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6493 /// do not affect
6494 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6495 ///
6496 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6497 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6498 /// support automatic rotation. For other keys, this field must be omitted.
6499 ///
6500 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6501 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6502 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6503 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6504 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6505 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6506 pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6507
6508 /// A template describing settings for new
6509 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6510 /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6511 /// instances created by either
6512 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6513 /// or auto-rotation are controlled by this template.
6514 ///
6515 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6516 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6517 pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6518
6519 /// Labels with user-defined metadata. For more information, see
6520 /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6521 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6522
6523 /// Immutable. Whether this key may contain imported versions only.
6524 pub import_only: bool,
6525
6526 /// Immutable. The period of time that versions of this key spend in the
6527 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6528 /// state before transitioning to
6529 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6530 /// If not specified at creation time, the default duration is 30 days.
6531 ///
6532 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6533 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6534 pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6535
6536 /// Immutable. The resource name of the backend environment where the key
6537 /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6538 /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6539 /// where all related cryptographic operations are performed. Only applicable
6540 /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6541 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6542 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6543 /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6544 /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6545 /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6546 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6547 /// with the resource name in the format
6548 /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6549 /// Note, this list is non-exhaustive and may apply to additional
6550 /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6551 ///
6552 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6553 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6554 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6555 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6556 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6557 pub crypto_key_backend: std::string::String,
6558
6559 /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6560 /// If this field is present and this key is enrolled in Key Access
6561 /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6562 /// decrypt, and sign operations, and the operation will fail if rejected by
6563 /// the policy. The policy is defined by specifying zero or more allowed
6564 /// justification codes.
6565 /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6566 /// By default, this field is absent, and all justification codes are allowed.
6567 /// If the
6568 /// `key_access_justifications_policy.allowed_access_reasons`
6569 /// is empty (zero allowed justification code), all encrypt, decrypt, and sign
6570 /// operations will fail.
6571 pub key_access_justifications_policy:
6572 std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6573
6574 /// Controls the rate of automatic rotation.
6575 pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6576
6577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6578}
6579
6580impl CryptoKey {
6581 /// Creates a new default instance.
6582 pub fn new() -> Self {
6583 std::default::Default::default()
6584 }
6585
6586 /// Sets the value of [name][crate::model::CryptoKey::name].
6587 ///
6588 /// # Example
6589 /// ```ignore,no_run
6590 /// # use google_cloud_kms_v1::model::CryptoKey;
6591 /// let x = CryptoKey::new().set_name("example");
6592 /// ```
6593 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6594 self.name = v.into();
6595 self
6596 }
6597
6598 /// Sets the value of [primary][crate::model::CryptoKey::primary].
6599 ///
6600 /// # Example
6601 /// ```ignore,no_run
6602 /// # use google_cloud_kms_v1::model::CryptoKey;
6603 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6604 /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6605 /// ```
6606 pub fn set_primary<T>(mut self, v: T) -> Self
6607 where
6608 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6609 {
6610 self.primary = std::option::Option::Some(v.into());
6611 self
6612 }
6613
6614 /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6615 ///
6616 /// # Example
6617 /// ```ignore,no_run
6618 /// # use google_cloud_kms_v1::model::CryptoKey;
6619 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6620 /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6621 /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6622 /// ```
6623 pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6624 where
6625 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6626 {
6627 self.primary = v.map(|x| x.into());
6628 self
6629 }
6630
6631 /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6632 ///
6633 /// # Example
6634 /// ```ignore,no_run
6635 /// # use google_cloud_kms_v1::model::CryptoKey;
6636 /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6637 /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6638 /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6639 /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6640 /// ```
6641 pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6642 mut self,
6643 v: T,
6644 ) -> Self {
6645 self.purpose = v.into();
6646 self
6647 }
6648
6649 /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6650 ///
6651 /// # Example
6652 /// ```ignore,no_run
6653 /// # use google_cloud_kms_v1::model::CryptoKey;
6654 /// use wkt::Timestamp;
6655 /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6656 /// ```
6657 pub fn set_create_time<T>(mut self, v: T) -> Self
6658 where
6659 T: std::convert::Into<wkt::Timestamp>,
6660 {
6661 self.create_time = std::option::Option::Some(v.into());
6662 self
6663 }
6664
6665 /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6666 ///
6667 /// # Example
6668 /// ```ignore,no_run
6669 /// # use google_cloud_kms_v1::model::CryptoKey;
6670 /// use wkt::Timestamp;
6671 /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6672 /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6673 /// ```
6674 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6675 where
6676 T: std::convert::Into<wkt::Timestamp>,
6677 {
6678 self.create_time = v.map(|x| x.into());
6679 self
6680 }
6681
6682 /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6683 ///
6684 /// # Example
6685 /// ```ignore,no_run
6686 /// # use google_cloud_kms_v1::model::CryptoKey;
6687 /// use wkt::Timestamp;
6688 /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6689 /// ```
6690 pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6691 where
6692 T: std::convert::Into<wkt::Timestamp>,
6693 {
6694 self.next_rotation_time = std::option::Option::Some(v.into());
6695 self
6696 }
6697
6698 /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6699 ///
6700 /// # Example
6701 /// ```ignore,no_run
6702 /// # use google_cloud_kms_v1::model::CryptoKey;
6703 /// use wkt::Timestamp;
6704 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6705 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6706 /// ```
6707 pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6708 where
6709 T: std::convert::Into<wkt::Timestamp>,
6710 {
6711 self.next_rotation_time = v.map(|x| x.into());
6712 self
6713 }
6714
6715 /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6716 ///
6717 /// # Example
6718 /// ```ignore,no_run
6719 /// # use google_cloud_kms_v1::model::CryptoKey;
6720 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6721 /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6722 /// ```
6723 pub fn set_version_template<T>(mut self, v: T) -> Self
6724 where
6725 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6726 {
6727 self.version_template = std::option::Option::Some(v.into());
6728 self
6729 }
6730
6731 /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6732 ///
6733 /// # Example
6734 /// ```ignore,no_run
6735 /// # use google_cloud_kms_v1::model::CryptoKey;
6736 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6737 /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6738 /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6739 /// ```
6740 pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6741 where
6742 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6743 {
6744 self.version_template = v.map(|x| x.into());
6745 self
6746 }
6747
6748 /// Sets the value of [labels][crate::model::CryptoKey::labels].
6749 ///
6750 /// # Example
6751 /// ```ignore,no_run
6752 /// # use google_cloud_kms_v1::model::CryptoKey;
6753 /// let x = CryptoKey::new().set_labels([
6754 /// ("key0", "abc"),
6755 /// ("key1", "xyz"),
6756 /// ]);
6757 /// ```
6758 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6759 where
6760 T: std::iter::IntoIterator<Item = (K, V)>,
6761 K: std::convert::Into<std::string::String>,
6762 V: std::convert::Into<std::string::String>,
6763 {
6764 use std::iter::Iterator;
6765 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6766 self
6767 }
6768
6769 /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6770 ///
6771 /// # Example
6772 /// ```ignore,no_run
6773 /// # use google_cloud_kms_v1::model::CryptoKey;
6774 /// let x = CryptoKey::new().set_import_only(true);
6775 /// ```
6776 pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6777 self.import_only = v.into();
6778 self
6779 }
6780
6781 /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6782 ///
6783 /// # Example
6784 /// ```ignore,no_run
6785 /// # use google_cloud_kms_v1::model::CryptoKey;
6786 /// use wkt::Duration;
6787 /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6788 /// ```
6789 pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6790 where
6791 T: std::convert::Into<wkt::Duration>,
6792 {
6793 self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6794 self
6795 }
6796
6797 /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6798 ///
6799 /// # Example
6800 /// ```ignore,no_run
6801 /// # use google_cloud_kms_v1::model::CryptoKey;
6802 /// use wkt::Duration;
6803 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6804 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6805 /// ```
6806 pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
6807 where
6808 T: std::convert::Into<wkt::Duration>,
6809 {
6810 self.destroy_scheduled_duration = v.map(|x| x.into());
6811 self
6812 }
6813
6814 /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
6815 ///
6816 /// # Example
6817 /// ```ignore,no_run
6818 /// # use google_cloud_kms_v1::model::CryptoKey;
6819 /// let x = CryptoKey::new().set_crypto_key_backend("example");
6820 /// ```
6821 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
6822 mut self,
6823 v: T,
6824 ) -> Self {
6825 self.crypto_key_backend = v.into();
6826 self
6827 }
6828
6829 /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6830 ///
6831 /// # Example
6832 /// ```ignore,no_run
6833 /// # use google_cloud_kms_v1::model::CryptoKey;
6834 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6835 /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
6836 /// ```
6837 pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
6838 where
6839 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6840 {
6841 self.key_access_justifications_policy = std::option::Option::Some(v.into());
6842 self
6843 }
6844
6845 /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6846 ///
6847 /// # Example
6848 /// ```ignore,no_run
6849 /// # use google_cloud_kms_v1::model::CryptoKey;
6850 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6851 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
6852 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
6853 /// ```
6854 pub fn set_or_clear_key_access_justifications_policy<T>(
6855 mut self,
6856 v: std::option::Option<T>,
6857 ) -> Self
6858 where
6859 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6860 {
6861 self.key_access_justifications_policy = v.map(|x| x.into());
6862 self
6863 }
6864
6865 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
6866 ///
6867 /// Note that all the setters affecting `rotation_schedule` are mutually
6868 /// exclusive.
6869 ///
6870 /// # Example
6871 /// ```ignore,no_run
6872 /// # use google_cloud_kms_v1::model::CryptoKey;
6873 /// use wkt::Duration;
6874 /// let x = CryptoKey::new().set_rotation_schedule(Some(
6875 /// google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
6876 /// ```
6877 pub fn set_rotation_schedule<
6878 T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
6879 >(
6880 mut self,
6881 v: T,
6882 ) -> Self {
6883 self.rotation_schedule = v.into();
6884 self
6885 }
6886
6887 /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6888 /// if it holds a `RotationPeriod`, `None` if the field is not set or
6889 /// holds a different branch.
6890 pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6891 #[allow(unreachable_patterns)]
6892 self.rotation_schedule.as_ref().and_then(|v| match v {
6893 crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
6894 std::option::Option::Some(v)
6895 }
6896 _ => std::option::Option::None,
6897 })
6898 }
6899
6900 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6901 /// to hold a `RotationPeriod`.
6902 ///
6903 /// Note that all the setters affecting `rotation_schedule` are
6904 /// mutually exclusive.
6905 ///
6906 /// # Example
6907 /// ```ignore,no_run
6908 /// # use google_cloud_kms_v1::model::CryptoKey;
6909 /// use wkt::Duration;
6910 /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
6911 /// assert!(x.rotation_period().is_some());
6912 /// ```
6913 pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
6914 mut self,
6915 v: T,
6916 ) -> Self {
6917 self.rotation_schedule = std::option::Option::Some(
6918 crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
6919 );
6920 self
6921 }
6922}
6923
6924impl wkt::message::Message for CryptoKey {
6925 fn typename() -> &'static str {
6926 "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
6927 }
6928}
6929
6930/// Defines additional types related to [CryptoKey].
6931pub mod crypto_key {
6932 #[allow(unused_imports)]
6933 use super::*;
6934
6935 /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
6936 /// describes the cryptographic capabilities of a
6937 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
6938 /// for the operations allowed by its purpose. For more information, see [Key
6939 /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
6940 ///
6941 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6942 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
6943 ///
6944 /// # Working with unknown values
6945 ///
6946 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6947 /// additional enum variants at any time. Adding new variants is not considered
6948 /// a breaking change. Applications should write their code in anticipation of:
6949 ///
6950 /// - New values appearing in future releases of the client library, **and**
6951 /// - New values received dynamically, without application changes.
6952 ///
6953 /// Please consult the [Working with enums] section in the user guide for some
6954 /// guidelines.
6955 ///
6956 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6957 #[derive(Clone, Debug, PartialEq)]
6958 #[non_exhaustive]
6959 pub enum CryptoKeyPurpose {
6960 /// Not specified.
6961 Unspecified,
6962 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6963 /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
6964 /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
6965 ///
6966 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6967 /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
6968 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6969 EncryptDecrypt,
6970 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6971 /// with
6972 /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
6973 /// and
6974 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6975 ///
6976 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6977 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
6978 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6979 AsymmetricSign,
6980 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6981 /// with
6982 /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
6983 /// and
6984 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6985 ///
6986 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6987 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
6988 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6989 AsymmetricDecrypt,
6990 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6991 /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
6992 /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
6993 /// This purpose is meant to be used for interoperable symmetric
6994 /// encryption and does not support automatic CryptoKey rotation.
6995 ///
6996 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6997 /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
6998 /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
6999 RawEncryptDecrypt,
7000 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7001 /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
7002 ///
7003 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7004 /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
7005 Mac,
7006 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7007 /// with
7008 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
7009 /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
7010 ///
7011 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7012 /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
7013 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7014 KeyEncapsulation,
7015 /// If set, the enum was initialized with an unknown value.
7016 ///
7017 /// Applications can examine the value using [CryptoKeyPurpose::value] or
7018 /// [CryptoKeyPurpose::name].
7019 UnknownValue(crypto_key_purpose::UnknownValue),
7020 }
7021
7022 #[doc(hidden)]
7023 pub mod crypto_key_purpose {
7024 #[allow(unused_imports)]
7025 use super::*;
7026 #[derive(Clone, Debug, PartialEq)]
7027 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7028 }
7029
7030 impl CryptoKeyPurpose {
7031 /// Gets the enum value.
7032 ///
7033 /// Returns `None` if the enum contains an unknown value deserialized from
7034 /// the string representation of enums.
7035 pub fn value(&self) -> std::option::Option<i32> {
7036 match self {
7037 Self::Unspecified => std::option::Option::Some(0),
7038 Self::EncryptDecrypt => std::option::Option::Some(1),
7039 Self::AsymmetricSign => std::option::Option::Some(5),
7040 Self::AsymmetricDecrypt => std::option::Option::Some(6),
7041 Self::RawEncryptDecrypt => std::option::Option::Some(7),
7042 Self::Mac => std::option::Option::Some(9),
7043 Self::KeyEncapsulation => std::option::Option::Some(10),
7044 Self::UnknownValue(u) => u.0.value(),
7045 }
7046 }
7047
7048 /// Gets the enum value as a string.
7049 ///
7050 /// Returns `None` if the enum contains an unknown value deserialized from
7051 /// the integer representation of enums.
7052 pub fn name(&self) -> std::option::Option<&str> {
7053 match self {
7054 Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
7055 Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
7056 Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
7057 Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
7058 Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
7059 Self::Mac => std::option::Option::Some("MAC"),
7060 Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
7061 Self::UnknownValue(u) => u.0.name(),
7062 }
7063 }
7064 }
7065
7066 impl std::default::Default for CryptoKeyPurpose {
7067 fn default() -> Self {
7068 use std::convert::From;
7069 Self::from(0)
7070 }
7071 }
7072
7073 impl std::fmt::Display for CryptoKeyPurpose {
7074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7075 wkt::internal::display_enum(f, self.name(), self.value())
7076 }
7077 }
7078
7079 impl std::convert::From<i32> for CryptoKeyPurpose {
7080 fn from(value: i32) -> Self {
7081 match value {
7082 0 => Self::Unspecified,
7083 1 => Self::EncryptDecrypt,
7084 5 => Self::AsymmetricSign,
7085 6 => Self::AsymmetricDecrypt,
7086 7 => Self::RawEncryptDecrypt,
7087 9 => Self::Mac,
7088 10 => Self::KeyEncapsulation,
7089 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7090 wkt::internal::UnknownEnumValue::Integer(value),
7091 )),
7092 }
7093 }
7094 }
7095
7096 impl std::convert::From<&str> for CryptoKeyPurpose {
7097 fn from(value: &str) -> Self {
7098 use std::string::ToString;
7099 match value {
7100 "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
7101 "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
7102 "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
7103 "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
7104 "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
7105 "MAC" => Self::Mac,
7106 "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
7107 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7108 wkt::internal::UnknownEnumValue::String(value.to_string()),
7109 )),
7110 }
7111 }
7112 }
7113
7114 impl serde::ser::Serialize for CryptoKeyPurpose {
7115 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7116 where
7117 S: serde::Serializer,
7118 {
7119 match self {
7120 Self::Unspecified => serializer.serialize_i32(0),
7121 Self::EncryptDecrypt => serializer.serialize_i32(1),
7122 Self::AsymmetricSign => serializer.serialize_i32(5),
7123 Self::AsymmetricDecrypt => serializer.serialize_i32(6),
7124 Self::RawEncryptDecrypt => serializer.serialize_i32(7),
7125 Self::Mac => serializer.serialize_i32(9),
7126 Self::KeyEncapsulation => serializer.serialize_i32(10),
7127 Self::UnknownValue(u) => u.0.serialize(serializer),
7128 }
7129 }
7130 }
7131
7132 impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
7133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7134 where
7135 D: serde::Deserializer<'de>,
7136 {
7137 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
7138 ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
7139 ))
7140 }
7141 }
7142
7143 /// Controls the rate of automatic rotation.
7144 #[derive(Clone, Debug, PartialEq)]
7145 #[non_exhaustive]
7146 pub enum RotationSchedule {
7147 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7148 /// will be advanced by this period when the service automatically rotates a
7149 /// key. Must be at least 24 hours and at most 876,000 hours.
7150 ///
7151 /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
7152 /// set,
7153 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7154 /// must also be set.
7155 ///
7156 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
7157 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
7158 /// support automatic rotation. For other keys, this field must be omitted.
7159 ///
7160 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7161 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
7162 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7163 /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
7164 RotationPeriod(std::boxed::Box<wkt::Duration>),
7165 }
7166}
7167
7168/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
7169/// specifies the properties to use when creating a new
7170/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
7171/// with
7172/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
7173/// or automatically as a result of auto-rotation.
7174///
7175/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7176/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
7177/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7178#[derive(Clone, Default, PartialEq)]
7179#[non_exhaustive]
7180pub struct CryptoKeyVersionTemplate {
7181 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
7182 /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7183 /// template. Immutable. Defaults to
7184 /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
7185 ///
7186 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7187 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7188 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7189 pub protection_level: crate::model::ProtectionLevel,
7190
7191 /// Required.
7192 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7193 /// to use when creating a
7194 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7195 /// template.
7196 ///
7197 /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
7198 /// this field is omitted and
7199 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
7200 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7201 ///
7202 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7203 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7204 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7205 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7206 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7207
7208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7209}
7210
7211impl CryptoKeyVersionTemplate {
7212 /// Creates a new default instance.
7213 pub fn new() -> Self {
7214 std::default::Default::default()
7215 }
7216
7217 /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
7218 ///
7219 /// # Example
7220 /// ```ignore,no_run
7221 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7222 /// use google_cloud_kms_v1::model::ProtectionLevel;
7223 /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
7224 /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
7225 /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
7226 /// ```
7227 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7228 mut self,
7229 v: T,
7230 ) -> Self {
7231 self.protection_level = v.into();
7232 self
7233 }
7234
7235 /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
7236 ///
7237 /// # Example
7238 /// ```ignore,no_run
7239 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7240 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7241 /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7242 /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7243 /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7244 /// ```
7245 pub fn set_algorithm<
7246 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7247 >(
7248 mut self,
7249 v: T,
7250 ) -> Self {
7251 self.algorithm = v.into();
7252 self
7253 }
7254}
7255
7256impl wkt::message::Message for CryptoKeyVersionTemplate {
7257 fn typename() -> &'static str {
7258 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
7259 }
7260}
7261
7262/// Contains an HSM-generated attestation about a key operation. For more
7263/// information, see [Verifying attestations]
7264/// (<https://cloud.google.com/kms/docs/attest-key>).
7265#[derive(Clone, Default, PartialEq)]
7266#[non_exhaustive]
7267pub struct KeyOperationAttestation {
7268 /// Output only. The format of the attestation data.
7269 pub format: crate::model::key_operation_attestation::AttestationFormat,
7270
7271 /// Output only. The attestation data provided by the HSM when the key
7272 /// operation was performed.
7273 pub content: ::bytes::Bytes,
7274
7275 /// Output only. The certificate chains needed to validate the attestation
7276 pub cert_chains:
7277 std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
7278
7279 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7280}
7281
7282impl KeyOperationAttestation {
7283 /// Creates a new default instance.
7284 pub fn new() -> Self {
7285 std::default::Default::default()
7286 }
7287
7288 /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7289 ///
7290 /// # Example
7291 /// ```ignore,no_run
7292 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7293 /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7294 /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7295 /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7296 /// ```
7297 pub fn set_format<
7298 T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7299 >(
7300 mut self,
7301 v: T,
7302 ) -> Self {
7303 self.format = v.into();
7304 self
7305 }
7306
7307 /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7308 ///
7309 /// # Example
7310 /// ```ignore,no_run
7311 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7312 /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7313 /// ```
7314 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7315 self.content = v.into();
7316 self
7317 }
7318
7319 /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7320 ///
7321 /// # Example
7322 /// ```ignore,no_run
7323 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7324 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7325 /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7326 /// ```
7327 pub fn set_cert_chains<T>(mut self, v: T) -> Self
7328 where
7329 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7330 {
7331 self.cert_chains = std::option::Option::Some(v.into());
7332 self
7333 }
7334
7335 /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7336 ///
7337 /// # Example
7338 /// ```ignore,no_run
7339 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7340 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7341 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7342 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7343 /// ```
7344 pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7345 where
7346 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7347 {
7348 self.cert_chains = v.map(|x| x.into());
7349 self
7350 }
7351}
7352
7353impl wkt::message::Message for KeyOperationAttestation {
7354 fn typename() -> &'static str {
7355 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7356 }
7357}
7358
7359/// Defines additional types related to [KeyOperationAttestation].
7360pub mod key_operation_attestation {
7361 #[allow(unused_imports)]
7362 use super::*;
7363
7364 /// Certificate chains needed to verify the attestation.
7365 /// Certificates in chains are PEM-encoded and are ordered based on
7366 /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7367 #[derive(Clone, Default, PartialEq)]
7368 #[non_exhaustive]
7369 pub struct CertificateChains {
7370 /// Cavium certificate chain corresponding to the attestation.
7371 pub cavium_certs: std::vec::Vec<std::string::String>,
7372
7373 /// Google card certificate chain corresponding to the attestation.
7374 pub google_card_certs: std::vec::Vec<std::string::String>,
7375
7376 /// Google partition certificate chain corresponding to the attestation.
7377 pub google_partition_certs: std::vec::Vec<std::string::String>,
7378
7379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7380 }
7381
7382 impl CertificateChains {
7383 /// Creates a new default instance.
7384 pub fn new() -> Self {
7385 std::default::Default::default()
7386 }
7387
7388 /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7389 ///
7390 /// # Example
7391 /// ```ignore,no_run
7392 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7393 /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7394 /// ```
7395 pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7396 where
7397 T: std::iter::IntoIterator<Item = V>,
7398 V: std::convert::Into<std::string::String>,
7399 {
7400 use std::iter::Iterator;
7401 self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7402 self
7403 }
7404
7405 /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7406 ///
7407 /// # Example
7408 /// ```ignore,no_run
7409 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7410 /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7411 /// ```
7412 pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7413 where
7414 T: std::iter::IntoIterator<Item = V>,
7415 V: std::convert::Into<std::string::String>,
7416 {
7417 use std::iter::Iterator;
7418 self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7419 self
7420 }
7421
7422 /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7423 ///
7424 /// # Example
7425 /// ```ignore,no_run
7426 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7427 /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7428 /// ```
7429 pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7430 where
7431 T: std::iter::IntoIterator<Item = V>,
7432 V: std::convert::Into<std::string::String>,
7433 {
7434 use std::iter::Iterator;
7435 self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7436 self
7437 }
7438 }
7439
7440 impl wkt::message::Message for CertificateChains {
7441 fn typename() -> &'static str {
7442 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7443 }
7444 }
7445
7446 /// Attestation formats provided by the HSM.
7447 ///
7448 /// # Working with unknown values
7449 ///
7450 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7451 /// additional enum variants at any time. Adding new variants is not considered
7452 /// a breaking change. Applications should write their code in anticipation of:
7453 ///
7454 /// - New values appearing in future releases of the client library, **and**
7455 /// - New values received dynamically, without application changes.
7456 ///
7457 /// Please consult the [Working with enums] section in the user guide for some
7458 /// guidelines.
7459 ///
7460 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7461 #[derive(Clone, Debug, PartialEq)]
7462 #[non_exhaustive]
7463 pub enum AttestationFormat {
7464 /// Not specified.
7465 Unspecified,
7466 /// Cavium HSM attestation compressed with gzip. Note that this format is
7467 /// defined by Cavium and subject to change at any time.
7468 ///
7469 /// See
7470 /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7471 CaviumV1Compressed,
7472 /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7473 /// introduced in Cavium's version 3.2-08.
7474 CaviumV2Compressed,
7475 /// If set, the enum was initialized with an unknown value.
7476 ///
7477 /// Applications can examine the value using [AttestationFormat::value] or
7478 /// [AttestationFormat::name].
7479 UnknownValue(attestation_format::UnknownValue),
7480 }
7481
7482 #[doc(hidden)]
7483 pub mod attestation_format {
7484 #[allow(unused_imports)]
7485 use super::*;
7486 #[derive(Clone, Debug, PartialEq)]
7487 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7488 }
7489
7490 impl AttestationFormat {
7491 /// Gets the enum value.
7492 ///
7493 /// Returns `None` if the enum contains an unknown value deserialized from
7494 /// the string representation of enums.
7495 pub fn value(&self) -> std::option::Option<i32> {
7496 match self {
7497 Self::Unspecified => std::option::Option::Some(0),
7498 Self::CaviumV1Compressed => std::option::Option::Some(3),
7499 Self::CaviumV2Compressed => std::option::Option::Some(4),
7500 Self::UnknownValue(u) => u.0.value(),
7501 }
7502 }
7503
7504 /// Gets the enum value as a string.
7505 ///
7506 /// Returns `None` if the enum contains an unknown value deserialized from
7507 /// the integer representation of enums.
7508 pub fn name(&self) -> std::option::Option<&str> {
7509 match self {
7510 Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7511 Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7512 Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7513 Self::UnknownValue(u) => u.0.name(),
7514 }
7515 }
7516 }
7517
7518 impl std::default::Default for AttestationFormat {
7519 fn default() -> Self {
7520 use std::convert::From;
7521 Self::from(0)
7522 }
7523 }
7524
7525 impl std::fmt::Display for AttestationFormat {
7526 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7527 wkt::internal::display_enum(f, self.name(), self.value())
7528 }
7529 }
7530
7531 impl std::convert::From<i32> for AttestationFormat {
7532 fn from(value: i32) -> Self {
7533 match value {
7534 0 => Self::Unspecified,
7535 3 => Self::CaviumV1Compressed,
7536 4 => Self::CaviumV2Compressed,
7537 _ => Self::UnknownValue(attestation_format::UnknownValue(
7538 wkt::internal::UnknownEnumValue::Integer(value),
7539 )),
7540 }
7541 }
7542 }
7543
7544 impl std::convert::From<&str> for AttestationFormat {
7545 fn from(value: &str) -> Self {
7546 use std::string::ToString;
7547 match value {
7548 "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7549 "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7550 "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7551 _ => Self::UnknownValue(attestation_format::UnknownValue(
7552 wkt::internal::UnknownEnumValue::String(value.to_string()),
7553 )),
7554 }
7555 }
7556 }
7557
7558 impl serde::ser::Serialize for AttestationFormat {
7559 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7560 where
7561 S: serde::Serializer,
7562 {
7563 match self {
7564 Self::Unspecified => serializer.serialize_i32(0),
7565 Self::CaviumV1Compressed => serializer.serialize_i32(3),
7566 Self::CaviumV2Compressed => serializer.serialize_i32(4),
7567 Self::UnknownValue(u) => u.0.serialize(serializer),
7568 }
7569 }
7570 }
7571
7572 impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7573 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7574 where
7575 D: serde::Deserializer<'de>,
7576 {
7577 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7578 ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7579 ))
7580 }
7581 }
7582}
7583
7584/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7585/// individual cryptographic key, and the associated key material.
7586///
7587/// An
7588/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7589/// version can be used for cryptographic operations.
7590///
7591/// For security reasons, the raw cryptographic key material represented by a
7592/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7593/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7594/// authorized user or application invokes Cloud KMS.
7595///
7596/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7597/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7598#[derive(Clone, Default, PartialEq)]
7599#[non_exhaustive]
7600pub struct CryptoKeyVersion {
7601 /// Output only. The resource name for this
7602 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7603 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7604 ///
7605 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7606 pub name: std::string::String,
7607
7608 /// The current state of the
7609 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7610 ///
7611 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7612 pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7613
7614 /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7615 /// describing how crypto operations are performed with this
7616 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7617 ///
7618 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7619 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7620 pub protection_level: crate::model::ProtectionLevel,
7621
7622 /// Output only. The
7623 /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7624 /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7625 /// supports.
7626 ///
7627 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7628 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7629 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7630
7631 /// Output only. Statement that was generated and signed by the HSM at key
7632 /// creation time. Use this statement to verify attributes of the key as stored
7633 /// on the HSM, independently of Google. Only provided for key versions with
7634 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7635 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7636 ///
7637 /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7638 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7639 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7640
7641 /// Output only. The time at which this
7642 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7643 ///
7644 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7645 pub create_time: std::option::Option<wkt::Timestamp>,
7646
7647 /// Output only. The time this
7648 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7649 /// generated.
7650 ///
7651 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7652 pub generate_time: std::option::Option<wkt::Timestamp>,
7653
7654 /// Output only. The time this
7655 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7656 /// scheduled for destruction. Only present if
7657 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7658 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7659 ///
7660 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7661 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7662 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7663 pub destroy_time: std::option::Option<wkt::Timestamp>,
7664
7665 /// Output only. The time this CryptoKeyVersion's key material was
7666 /// destroyed. Only present if
7667 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7668 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7669 ///
7670 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7671 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7672 pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7673
7674 /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7675 /// used in the most recent import of this
7676 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7677 /// the underlying key material was imported.
7678 ///
7679 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7680 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7681 pub import_job: std::string::String,
7682
7683 /// Output only. The time at which this
7684 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7685 /// most recently imported.
7686 ///
7687 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7688 pub import_time: std::option::Option<wkt::Timestamp>,
7689
7690 /// Output only. The root cause of the most recent import failure. Only present
7691 /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7692 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7693 ///
7694 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7695 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7696 pub import_failure_reason: std::string::String,
7697
7698 /// Output only. The root cause of the most recent generation failure. Only
7699 /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7700 /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7701 ///
7702 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7703 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7704 pub generation_failure_reason: std::string::String,
7705
7706 /// Output only. The root cause of the most recent external destruction
7707 /// failure. Only present if
7708 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7709 /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7710 ///
7711 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7712 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7713 pub external_destruction_failure_reason: std::string::String,
7714
7715 /// ExternalProtectionLevelOptions stores a group of additional fields for
7716 /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7717 /// are specific to the
7718 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7719 /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7720 /// protection levels.
7721 ///
7722 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7723 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7724 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7725 pub external_protection_level_options:
7726 std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7727
7728 /// Output only. Whether or not this key version is eligible for reimport, by
7729 /// being specified as a target in
7730 /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7731 ///
7732 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7733 pub reimport_eligible: bool,
7734
7735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7736}
7737
7738impl CryptoKeyVersion {
7739 /// Creates a new default instance.
7740 pub fn new() -> Self {
7741 std::default::Default::default()
7742 }
7743
7744 /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7745 ///
7746 /// # Example
7747 /// ```ignore,no_run
7748 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7749 /// let x = CryptoKeyVersion::new().set_name("example");
7750 /// ```
7751 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7752 self.name = v.into();
7753 self
7754 }
7755
7756 /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7757 ///
7758 /// # Example
7759 /// ```ignore,no_run
7760 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7761 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7762 /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7763 /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7764 /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7765 /// ```
7766 pub fn set_state<
7767 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
7768 >(
7769 mut self,
7770 v: T,
7771 ) -> Self {
7772 self.state = v.into();
7773 self
7774 }
7775
7776 /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
7777 ///
7778 /// # Example
7779 /// ```ignore,no_run
7780 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7781 /// use google_cloud_kms_v1::model::ProtectionLevel;
7782 /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
7783 /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
7784 /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
7785 /// ```
7786 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7787 mut self,
7788 v: T,
7789 ) -> Self {
7790 self.protection_level = v.into();
7791 self
7792 }
7793
7794 /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
7795 ///
7796 /// # Example
7797 /// ```ignore,no_run
7798 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7799 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7800 /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7801 /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7802 /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7803 /// ```
7804 pub fn set_algorithm<
7805 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7806 >(
7807 mut self,
7808 v: T,
7809 ) -> Self {
7810 self.algorithm = v.into();
7811 self
7812 }
7813
7814 /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7815 ///
7816 /// # Example
7817 /// ```ignore,no_run
7818 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7819 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7820 /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
7821 /// ```
7822 pub fn set_attestation<T>(mut self, v: T) -> Self
7823 where
7824 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7825 {
7826 self.attestation = std::option::Option::Some(v.into());
7827 self
7828 }
7829
7830 /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7831 ///
7832 /// # Example
7833 /// ```ignore,no_run
7834 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7835 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7836 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
7837 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
7838 /// ```
7839 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
7840 where
7841 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7842 {
7843 self.attestation = v.map(|x| x.into());
7844 self
7845 }
7846
7847 /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7848 ///
7849 /// # Example
7850 /// ```ignore,no_run
7851 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7852 /// use wkt::Timestamp;
7853 /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
7854 /// ```
7855 pub fn set_create_time<T>(mut self, v: T) -> Self
7856 where
7857 T: std::convert::Into<wkt::Timestamp>,
7858 {
7859 self.create_time = std::option::Option::Some(v.into());
7860 self
7861 }
7862
7863 /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7864 ///
7865 /// # Example
7866 /// ```ignore,no_run
7867 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7868 /// use wkt::Timestamp;
7869 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7870 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
7871 /// ```
7872 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7873 where
7874 T: std::convert::Into<wkt::Timestamp>,
7875 {
7876 self.create_time = v.map(|x| x.into());
7877 self
7878 }
7879
7880 /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7881 ///
7882 /// # Example
7883 /// ```ignore,no_run
7884 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7885 /// use wkt::Timestamp;
7886 /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
7887 /// ```
7888 pub fn set_generate_time<T>(mut self, v: T) -> Self
7889 where
7890 T: std::convert::Into<wkt::Timestamp>,
7891 {
7892 self.generate_time = std::option::Option::Some(v.into());
7893 self
7894 }
7895
7896 /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7897 ///
7898 /// # Example
7899 /// ```ignore,no_run
7900 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7901 /// use wkt::Timestamp;
7902 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
7903 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
7904 /// ```
7905 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
7906 where
7907 T: std::convert::Into<wkt::Timestamp>,
7908 {
7909 self.generate_time = v.map(|x| x.into());
7910 self
7911 }
7912
7913 /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7914 ///
7915 /// # Example
7916 /// ```ignore,no_run
7917 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7918 /// use wkt::Timestamp;
7919 /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
7920 /// ```
7921 pub fn set_destroy_time<T>(mut self, v: T) -> Self
7922 where
7923 T: std::convert::Into<wkt::Timestamp>,
7924 {
7925 self.destroy_time = std::option::Option::Some(v.into());
7926 self
7927 }
7928
7929 /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7930 ///
7931 /// # Example
7932 /// ```ignore,no_run
7933 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7934 /// use wkt::Timestamp;
7935 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
7936 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
7937 /// ```
7938 pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
7939 where
7940 T: std::convert::Into<wkt::Timestamp>,
7941 {
7942 self.destroy_time = v.map(|x| x.into());
7943 self
7944 }
7945
7946 /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7947 ///
7948 /// # Example
7949 /// ```ignore,no_run
7950 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7951 /// use wkt::Timestamp;
7952 /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
7953 /// ```
7954 pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
7955 where
7956 T: std::convert::Into<wkt::Timestamp>,
7957 {
7958 self.destroy_event_time = std::option::Option::Some(v.into());
7959 self
7960 }
7961
7962 /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7963 ///
7964 /// # Example
7965 /// ```ignore,no_run
7966 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7967 /// use wkt::Timestamp;
7968 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
7969 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
7970 /// ```
7971 pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
7972 where
7973 T: std::convert::Into<wkt::Timestamp>,
7974 {
7975 self.destroy_event_time = v.map(|x| x.into());
7976 self
7977 }
7978
7979 /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
7980 ///
7981 /// # Example
7982 /// ```ignore,no_run
7983 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7984 /// let x = CryptoKeyVersion::new().set_import_job("example");
7985 /// ```
7986 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7987 self.import_job = v.into();
7988 self
7989 }
7990
7991 /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7992 ///
7993 /// # Example
7994 /// ```ignore,no_run
7995 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7996 /// use wkt::Timestamp;
7997 /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
7998 /// ```
7999 pub fn set_import_time<T>(mut self, v: T) -> Self
8000 where
8001 T: std::convert::Into<wkt::Timestamp>,
8002 {
8003 self.import_time = std::option::Option::Some(v.into());
8004 self
8005 }
8006
8007 /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
8008 ///
8009 /// # Example
8010 /// ```ignore,no_run
8011 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8012 /// use wkt::Timestamp;
8013 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
8014 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
8015 /// ```
8016 pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
8017 where
8018 T: std::convert::Into<wkt::Timestamp>,
8019 {
8020 self.import_time = v.map(|x| x.into());
8021 self
8022 }
8023
8024 /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
8025 ///
8026 /// # Example
8027 /// ```ignore,no_run
8028 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8029 /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
8030 /// ```
8031 pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
8032 mut self,
8033 v: T,
8034 ) -> Self {
8035 self.import_failure_reason = v.into();
8036 self
8037 }
8038
8039 /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
8040 ///
8041 /// # Example
8042 /// ```ignore,no_run
8043 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8044 /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
8045 /// ```
8046 pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
8047 mut self,
8048 v: T,
8049 ) -> Self {
8050 self.generation_failure_reason = v.into();
8051 self
8052 }
8053
8054 /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
8055 ///
8056 /// # Example
8057 /// ```ignore,no_run
8058 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8059 /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
8060 /// ```
8061 pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
8062 mut self,
8063 v: T,
8064 ) -> Self {
8065 self.external_destruction_failure_reason = v.into();
8066 self
8067 }
8068
8069 /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8070 ///
8071 /// # Example
8072 /// ```ignore,no_run
8073 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8074 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8075 /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
8076 /// ```
8077 pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
8078 where
8079 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8080 {
8081 self.external_protection_level_options = std::option::Option::Some(v.into());
8082 self
8083 }
8084
8085 /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8086 ///
8087 /// # Example
8088 /// ```ignore,no_run
8089 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8090 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8091 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
8092 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
8093 /// ```
8094 pub fn set_or_clear_external_protection_level_options<T>(
8095 mut self,
8096 v: std::option::Option<T>,
8097 ) -> Self
8098 where
8099 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8100 {
8101 self.external_protection_level_options = v.map(|x| x.into());
8102 self
8103 }
8104
8105 /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
8106 ///
8107 /// # Example
8108 /// ```ignore,no_run
8109 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8110 /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
8111 /// ```
8112 pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8113 self.reimport_eligible = v.into();
8114 self
8115 }
8116}
8117
8118impl wkt::message::Message for CryptoKeyVersion {
8119 fn typename() -> &'static str {
8120 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
8121 }
8122}
8123
8124/// Defines additional types related to [CryptoKeyVersion].
8125pub mod crypto_key_version {
8126 #[allow(unused_imports)]
8127 use super::*;
8128
8129 /// The algorithm of the
8130 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
8131 /// parameters must be used for each cryptographic operation.
8132 ///
8133 /// The
8134 /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
8135 /// algorithm is usable with
8136 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8137 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
8138 ///
8139 /// Algorithms beginning with `RSA_SIGN_` are usable with
8140 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8141 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8142 ///
8143 /// The fields in the name after `RSA_SIGN_` correspond to the following
8144 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8145 ///
8146 /// For PSS, the salt length used is equal to the length of digest
8147 /// algorithm. For example,
8148 /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
8149 /// will use PSS with a salt length of 256 bits or 32 bytes.
8150 ///
8151 /// Algorithms beginning with `RSA_DECRYPT_` are usable with
8152 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8153 /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
8154 ///
8155 /// The fields in the name after `RSA_DECRYPT_` correspond to the following
8156 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8157 ///
8158 /// Algorithms beginning with `EC_SIGN_` are usable with
8159 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8160 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8161 ///
8162 /// The fields in the name after `EC_SIGN_` correspond to the following
8163 /// parameters: elliptic curve, digest algorithm.
8164 ///
8165 /// Algorithms beginning with `HMAC_` are usable with
8166 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8167 /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
8168 ///
8169 /// The suffix following `HMAC_` corresponds to the hash algorithm being used
8170 /// (eg. SHA256).
8171 ///
8172 /// Algorithms beginning with `PQ_` are post-quantum.
8173 ///
8174 /// For more information, see [Key purposes and algorithms]
8175 /// (<https://cloud.google.com/kms/docs/algorithms>).
8176 ///
8177 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
8178 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
8179 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
8180 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
8181 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
8182 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8183 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
8184 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
8185 ///
8186 /// # Working with unknown values
8187 ///
8188 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8189 /// additional enum variants at any time. Adding new variants is not considered
8190 /// a breaking change. Applications should write their code in anticipation of:
8191 ///
8192 /// - New values appearing in future releases of the client library, **and**
8193 /// - New values received dynamically, without application changes.
8194 ///
8195 /// Please consult the [Working with enums] section in the user guide for some
8196 /// guidelines.
8197 ///
8198 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8199 #[derive(Clone, Debug, PartialEq)]
8200 #[non_exhaustive]
8201 pub enum CryptoKeyVersionAlgorithm {
8202 /// Not specified.
8203 Unspecified,
8204 /// Creates symmetric encryption keys.
8205 GoogleSymmetricEncryption,
8206 /// AES-GCM (Galois Counter Mode) using 128-bit keys.
8207 Aes128Gcm,
8208 /// AES-GCM (Galois Counter Mode) using 256-bit keys.
8209 Aes256Gcm,
8210 /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
8211 Aes128Cbc,
8212 /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
8213 Aes256Cbc,
8214 /// AES-CTR (Counter Mode) using 128-bit keys.
8215 Aes128Ctr,
8216 /// AES-CTR (Counter Mode) using 256-bit keys.
8217 Aes256Ctr,
8218 /// RSASSA-PSS 2048 bit key with a SHA256 digest.
8219 RsaSignPss2048Sha256,
8220 /// RSASSA-PSS 3072 bit key with a SHA256 digest.
8221 RsaSignPss3072Sha256,
8222 /// RSASSA-PSS 4096 bit key with a SHA256 digest.
8223 RsaSignPss4096Sha256,
8224 /// RSASSA-PSS 4096 bit key with a SHA512 digest.
8225 RsaSignPss4096Sha512,
8226 /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
8227 RsaSignPkcs12048Sha256,
8228 /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
8229 RsaSignPkcs13072Sha256,
8230 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
8231 RsaSignPkcs14096Sha256,
8232 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
8233 RsaSignPkcs14096Sha512,
8234 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
8235 RsaSignRawPkcs12048,
8236 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
8237 RsaSignRawPkcs13072,
8238 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
8239 RsaSignRawPkcs14096,
8240 /// RSAES-OAEP 2048 bit key with a SHA256 digest.
8241 RsaDecryptOaep2048Sha256,
8242 /// RSAES-OAEP 3072 bit key with a SHA256 digest.
8243 RsaDecryptOaep3072Sha256,
8244 /// RSAES-OAEP 4096 bit key with a SHA256 digest.
8245 RsaDecryptOaep4096Sha256,
8246 /// RSAES-OAEP 4096 bit key with a SHA512 digest.
8247 RsaDecryptOaep4096Sha512,
8248 /// RSAES-OAEP 2048 bit key with a SHA1 digest.
8249 RsaDecryptOaep2048Sha1,
8250 /// RSAES-OAEP 3072 bit key with a SHA1 digest.
8251 RsaDecryptOaep3072Sha1,
8252 /// RSAES-OAEP 4096 bit key with a SHA1 digest.
8253 RsaDecryptOaep4096Sha1,
8254 /// ECDSA on the NIST P-256 curve with a SHA256 digest.
8255 /// Other hash functions can also be used:
8256 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8257 EcSignP256Sha256,
8258 /// ECDSA on the NIST P-384 curve with a SHA384 digest.
8259 /// Other hash functions can also be used:
8260 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8261 EcSignP384Sha384,
8262 /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
8263 /// HSM protection level.
8264 /// Other hash functions can also be used:
8265 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8266 EcSignSecp256K1Sha256,
8267 /// EdDSA on the Curve25519 in pure mode (taking data as input).
8268 EcSignEd25519,
8269 /// HMAC-SHA256 signing with a 256 bit key.
8270 HmacSha256,
8271 /// HMAC-SHA1 signing with a 160 bit key.
8272 HmacSha1,
8273 /// HMAC-SHA384 signing with a 384 bit key.
8274 HmacSha384,
8275 /// HMAC-SHA512 signing with a 512 bit key.
8276 HmacSha512,
8277 /// HMAC-SHA224 signing with a 224 bit key.
8278 HmacSha224,
8279 /// Algorithm representing symmetric encryption by an external key manager.
8280 ExternalSymmetricEncryption,
8281 /// ML-KEM-768 (FIPS 203)
8282 MlKem768,
8283 /// ML-KEM-1024 (FIPS 203)
8284 MlKem1024,
8285 /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
8286 /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8287 KemXwing,
8288 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8289 /// security level 1. Randomized version.
8290 PqSignMlDsa44,
8291 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8292 /// security level 3. Randomized version.
8293 PqSignMlDsa65,
8294 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8295 /// security level 5. Randomized version.
8296 PqSignMlDsa87,
8297 /// The post-quantum stateless hash-based digital signature algorithm, at
8298 /// security level 1. Randomized version.
8299 PqSignSlhDsaSha2128S,
8300 /// The post-quantum stateless hash-based digital signature algorithm, at
8301 /// security level 1. Randomized pre-hash version supporting SHA256 digests.
8302 PqSignHashSlhDsaSha2128SSha256,
8303 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8304 /// security level 1. Randomized version supporting externally-computed
8305 /// message representatives.
8306 PqSignMlDsa44ExternalMu,
8307 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8308 /// security level 3. Randomized version supporting externally-computed
8309 /// message representatives.
8310 PqSignMlDsa65ExternalMu,
8311 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8312 /// security level 5. Randomized version supporting externally-computed
8313 /// message representatives.
8314 PqSignMlDsa87ExternalMu,
8315 /// If set, the enum was initialized with an unknown value.
8316 ///
8317 /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8318 /// [CryptoKeyVersionAlgorithm::name].
8319 UnknownValue(crypto_key_version_algorithm::UnknownValue),
8320 }
8321
8322 #[doc(hidden)]
8323 pub mod crypto_key_version_algorithm {
8324 #[allow(unused_imports)]
8325 use super::*;
8326 #[derive(Clone, Debug, PartialEq)]
8327 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8328 }
8329
8330 impl CryptoKeyVersionAlgorithm {
8331 /// Gets the enum value.
8332 ///
8333 /// Returns `None` if the enum contains an unknown value deserialized from
8334 /// the string representation of enums.
8335 pub fn value(&self) -> std::option::Option<i32> {
8336 match self {
8337 Self::Unspecified => std::option::Option::Some(0),
8338 Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8339 Self::Aes128Gcm => std::option::Option::Some(41),
8340 Self::Aes256Gcm => std::option::Option::Some(19),
8341 Self::Aes128Cbc => std::option::Option::Some(42),
8342 Self::Aes256Cbc => std::option::Option::Some(43),
8343 Self::Aes128Ctr => std::option::Option::Some(44),
8344 Self::Aes256Ctr => std::option::Option::Some(45),
8345 Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8346 Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8347 Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8348 Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8349 Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8350 Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8351 Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8352 Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8353 Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8354 Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8355 Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8356 Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8357 Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8358 Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8359 Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8360 Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8361 Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8362 Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8363 Self::EcSignP256Sha256 => std::option::Option::Some(12),
8364 Self::EcSignP384Sha384 => std::option::Option::Some(13),
8365 Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8366 Self::EcSignEd25519 => std::option::Option::Some(40),
8367 Self::HmacSha256 => std::option::Option::Some(32),
8368 Self::HmacSha1 => std::option::Option::Some(33),
8369 Self::HmacSha384 => std::option::Option::Some(34),
8370 Self::HmacSha512 => std::option::Option::Some(35),
8371 Self::HmacSha224 => std::option::Option::Some(36),
8372 Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8373 Self::MlKem768 => std::option::Option::Some(47),
8374 Self::MlKem1024 => std::option::Option::Some(48),
8375 Self::KemXwing => std::option::Option::Some(63),
8376 Self::PqSignMlDsa44 => std::option::Option::Some(68),
8377 Self::PqSignMlDsa65 => std::option::Option::Some(56),
8378 Self::PqSignMlDsa87 => std::option::Option::Some(69),
8379 Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8380 Self::PqSignHashSlhDsaSha2128SSha256 => std::option::Option::Some(60),
8381 Self::PqSignMlDsa44ExternalMu => std::option::Option::Some(70),
8382 Self::PqSignMlDsa65ExternalMu => std::option::Option::Some(67),
8383 Self::PqSignMlDsa87ExternalMu => std::option::Option::Some(71),
8384 Self::UnknownValue(u) => u.0.value(),
8385 }
8386 }
8387
8388 /// Gets the enum value as a string.
8389 ///
8390 /// Returns `None` if the enum contains an unknown value deserialized from
8391 /// the integer representation of enums.
8392 pub fn name(&self) -> std::option::Option<&str> {
8393 match self {
8394 Self::Unspecified => {
8395 std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8396 }
8397 Self::GoogleSymmetricEncryption => {
8398 std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8399 }
8400 Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8401 Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8402 Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8403 Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8404 Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8405 Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8406 Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8407 Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8408 Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8409 Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8410 Self::RsaSignPkcs12048Sha256 => {
8411 std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8412 }
8413 Self::RsaSignPkcs13072Sha256 => {
8414 std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8415 }
8416 Self::RsaSignPkcs14096Sha256 => {
8417 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8418 }
8419 Self::RsaSignPkcs14096Sha512 => {
8420 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8421 }
8422 Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8423 Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8424 Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8425 Self::RsaDecryptOaep2048Sha256 => {
8426 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8427 }
8428 Self::RsaDecryptOaep3072Sha256 => {
8429 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8430 }
8431 Self::RsaDecryptOaep4096Sha256 => {
8432 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8433 }
8434 Self::RsaDecryptOaep4096Sha512 => {
8435 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8436 }
8437 Self::RsaDecryptOaep2048Sha1 => {
8438 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8439 }
8440 Self::RsaDecryptOaep3072Sha1 => {
8441 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8442 }
8443 Self::RsaDecryptOaep4096Sha1 => {
8444 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8445 }
8446 Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8447 Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8448 Self::EcSignSecp256K1Sha256 => {
8449 std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8450 }
8451 Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8452 Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8453 Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8454 Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8455 Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8456 Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8457 Self::ExternalSymmetricEncryption => {
8458 std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8459 }
8460 Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8461 Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8462 Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8463 Self::PqSignMlDsa44 => std::option::Option::Some("PQ_SIGN_ML_DSA_44"),
8464 Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8465 Self::PqSignMlDsa87 => std::option::Option::Some("PQ_SIGN_ML_DSA_87"),
8466 Self::PqSignSlhDsaSha2128S => {
8467 std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8468 }
8469 Self::PqSignHashSlhDsaSha2128SSha256 => {
8470 std::option::Option::Some("PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256")
8471 }
8472 Self::PqSignMlDsa44ExternalMu => {
8473 std::option::Option::Some("PQ_SIGN_ML_DSA_44_EXTERNAL_MU")
8474 }
8475 Self::PqSignMlDsa65ExternalMu => {
8476 std::option::Option::Some("PQ_SIGN_ML_DSA_65_EXTERNAL_MU")
8477 }
8478 Self::PqSignMlDsa87ExternalMu => {
8479 std::option::Option::Some("PQ_SIGN_ML_DSA_87_EXTERNAL_MU")
8480 }
8481 Self::UnknownValue(u) => u.0.name(),
8482 }
8483 }
8484 }
8485
8486 impl std::default::Default for CryptoKeyVersionAlgorithm {
8487 fn default() -> Self {
8488 use std::convert::From;
8489 Self::from(0)
8490 }
8491 }
8492
8493 impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8494 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8495 wkt::internal::display_enum(f, self.name(), self.value())
8496 }
8497 }
8498
8499 impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8500 fn from(value: i32) -> Self {
8501 match value {
8502 0 => Self::Unspecified,
8503 1 => Self::GoogleSymmetricEncryption,
8504 2 => Self::RsaSignPss2048Sha256,
8505 3 => Self::RsaSignPss3072Sha256,
8506 4 => Self::RsaSignPss4096Sha256,
8507 5 => Self::RsaSignPkcs12048Sha256,
8508 6 => Self::RsaSignPkcs13072Sha256,
8509 7 => Self::RsaSignPkcs14096Sha256,
8510 8 => Self::RsaDecryptOaep2048Sha256,
8511 9 => Self::RsaDecryptOaep3072Sha256,
8512 10 => Self::RsaDecryptOaep4096Sha256,
8513 12 => Self::EcSignP256Sha256,
8514 13 => Self::EcSignP384Sha384,
8515 15 => Self::RsaSignPss4096Sha512,
8516 16 => Self::RsaSignPkcs14096Sha512,
8517 17 => Self::RsaDecryptOaep4096Sha512,
8518 18 => Self::ExternalSymmetricEncryption,
8519 19 => Self::Aes256Gcm,
8520 28 => Self::RsaSignRawPkcs12048,
8521 29 => Self::RsaSignRawPkcs13072,
8522 30 => Self::RsaSignRawPkcs14096,
8523 31 => Self::EcSignSecp256K1Sha256,
8524 32 => Self::HmacSha256,
8525 33 => Self::HmacSha1,
8526 34 => Self::HmacSha384,
8527 35 => Self::HmacSha512,
8528 36 => Self::HmacSha224,
8529 37 => Self::RsaDecryptOaep2048Sha1,
8530 38 => Self::RsaDecryptOaep3072Sha1,
8531 39 => Self::RsaDecryptOaep4096Sha1,
8532 40 => Self::EcSignEd25519,
8533 41 => Self::Aes128Gcm,
8534 42 => Self::Aes128Cbc,
8535 43 => Self::Aes256Cbc,
8536 44 => Self::Aes128Ctr,
8537 45 => Self::Aes256Ctr,
8538 47 => Self::MlKem768,
8539 48 => Self::MlKem1024,
8540 56 => Self::PqSignMlDsa65,
8541 57 => Self::PqSignSlhDsaSha2128S,
8542 60 => Self::PqSignHashSlhDsaSha2128SSha256,
8543 63 => Self::KemXwing,
8544 67 => Self::PqSignMlDsa65ExternalMu,
8545 68 => Self::PqSignMlDsa44,
8546 69 => Self::PqSignMlDsa87,
8547 70 => Self::PqSignMlDsa44ExternalMu,
8548 71 => Self::PqSignMlDsa87ExternalMu,
8549 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8550 wkt::internal::UnknownEnumValue::Integer(value),
8551 )),
8552 }
8553 }
8554 }
8555
8556 impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8557 fn from(value: &str) -> Self {
8558 use std::string::ToString;
8559 match value {
8560 "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8561 "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8562 "AES_128_GCM" => Self::Aes128Gcm,
8563 "AES_256_GCM" => Self::Aes256Gcm,
8564 "AES_128_CBC" => Self::Aes128Cbc,
8565 "AES_256_CBC" => Self::Aes256Cbc,
8566 "AES_128_CTR" => Self::Aes128Ctr,
8567 "AES_256_CTR" => Self::Aes256Ctr,
8568 "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8569 "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8570 "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8571 "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8572 "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8573 "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8574 "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8575 "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8576 "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8577 "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8578 "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8579 "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8580 "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8581 "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8582 "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8583 "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8584 "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8585 "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8586 "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8587 "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8588 "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8589 "EC_SIGN_ED25519" => Self::EcSignEd25519,
8590 "HMAC_SHA256" => Self::HmacSha256,
8591 "HMAC_SHA1" => Self::HmacSha1,
8592 "HMAC_SHA384" => Self::HmacSha384,
8593 "HMAC_SHA512" => Self::HmacSha512,
8594 "HMAC_SHA224" => Self::HmacSha224,
8595 "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8596 "ML_KEM_768" => Self::MlKem768,
8597 "ML_KEM_1024" => Self::MlKem1024,
8598 "KEM_XWING" => Self::KemXwing,
8599 "PQ_SIGN_ML_DSA_44" => Self::PqSignMlDsa44,
8600 "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8601 "PQ_SIGN_ML_DSA_87" => Self::PqSignMlDsa87,
8602 "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8603 "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256" => Self::PqSignHashSlhDsaSha2128SSha256,
8604 "PQ_SIGN_ML_DSA_44_EXTERNAL_MU" => Self::PqSignMlDsa44ExternalMu,
8605 "PQ_SIGN_ML_DSA_65_EXTERNAL_MU" => Self::PqSignMlDsa65ExternalMu,
8606 "PQ_SIGN_ML_DSA_87_EXTERNAL_MU" => Self::PqSignMlDsa87ExternalMu,
8607 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8608 wkt::internal::UnknownEnumValue::String(value.to_string()),
8609 )),
8610 }
8611 }
8612 }
8613
8614 impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8615 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8616 where
8617 S: serde::Serializer,
8618 {
8619 match self {
8620 Self::Unspecified => serializer.serialize_i32(0),
8621 Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8622 Self::Aes128Gcm => serializer.serialize_i32(41),
8623 Self::Aes256Gcm => serializer.serialize_i32(19),
8624 Self::Aes128Cbc => serializer.serialize_i32(42),
8625 Self::Aes256Cbc => serializer.serialize_i32(43),
8626 Self::Aes128Ctr => serializer.serialize_i32(44),
8627 Self::Aes256Ctr => serializer.serialize_i32(45),
8628 Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8629 Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8630 Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8631 Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8632 Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8633 Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8634 Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8635 Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8636 Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8637 Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8638 Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8639 Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8640 Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8641 Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8642 Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8643 Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8644 Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8645 Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8646 Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8647 Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8648 Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8649 Self::EcSignEd25519 => serializer.serialize_i32(40),
8650 Self::HmacSha256 => serializer.serialize_i32(32),
8651 Self::HmacSha1 => serializer.serialize_i32(33),
8652 Self::HmacSha384 => serializer.serialize_i32(34),
8653 Self::HmacSha512 => serializer.serialize_i32(35),
8654 Self::HmacSha224 => serializer.serialize_i32(36),
8655 Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8656 Self::MlKem768 => serializer.serialize_i32(47),
8657 Self::MlKem1024 => serializer.serialize_i32(48),
8658 Self::KemXwing => serializer.serialize_i32(63),
8659 Self::PqSignMlDsa44 => serializer.serialize_i32(68),
8660 Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8661 Self::PqSignMlDsa87 => serializer.serialize_i32(69),
8662 Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8663 Self::PqSignHashSlhDsaSha2128SSha256 => serializer.serialize_i32(60),
8664 Self::PqSignMlDsa44ExternalMu => serializer.serialize_i32(70),
8665 Self::PqSignMlDsa65ExternalMu => serializer.serialize_i32(67),
8666 Self::PqSignMlDsa87ExternalMu => serializer.serialize_i32(71),
8667 Self::UnknownValue(u) => u.0.serialize(serializer),
8668 }
8669 }
8670 }
8671
8672 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8673 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8674 where
8675 D: serde::Deserializer<'de>,
8676 {
8677 deserializer.deserialize_any(
8678 wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8679 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8680 ),
8681 )
8682 }
8683 }
8684
8685 /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8686 /// indicating if it can be used.
8687 ///
8688 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8689 ///
8690 /// # Working with unknown values
8691 ///
8692 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8693 /// additional enum variants at any time. Adding new variants is not considered
8694 /// a breaking change. Applications should write their code in anticipation of:
8695 ///
8696 /// - New values appearing in future releases of the client library, **and**
8697 /// - New values received dynamically, without application changes.
8698 ///
8699 /// Please consult the [Working with enums] section in the user guide for some
8700 /// guidelines.
8701 ///
8702 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8703 #[derive(Clone, Debug, PartialEq)]
8704 #[non_exhaustive]
8705 pub enum CryptoKeyVersionState {
8706 /// Not specified.
8707 Unspecified,
8708 /// This version is still being generated. It may not be used, enabled,
8709 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8710 /// version
8711 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8712 /// as soon as the version is ready.
8713 ///
8714 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8715 PendingGeneration,
8716 /// This version may be used for cryptographic operations.
8717 Enabled,
8718 /// This version may not be used, but the key material is still available,
8719 /// and the version can be placed back into the
8720 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8721 /// state.
8722 ///
8723 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8724 Disabled,
8725 /// The key material of this version is destroyed and no longer stored.
8726 /// This version may only become
8727 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8728 /// again if this version is
8729 /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8730 /// and the original key material is reimported with a call to
8731 /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8732 ///
8733 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8734 /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
8735 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8736 Destroyed,
8737 /// This version is scheduled for destruction, and will be destroyed soon.
8738 /// Call
8739 /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
8740 /// to put it back into the
8741 /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
8742 /// state.
8743 ///
8744 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
8745 /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8746 DestroyScheduled,
8747 /// This version is still being imported. It may not be used, enabled,
8748 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8749 /// version
8750 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8751 /// as soon as the version is ready.
8752 ///
8753 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8754 PendingImport,
8755 /// This version was not imported successfully. It may not be used, enabled,
8756 /// disabled, or destroyed. The submitted key material has been discarded.
8757 /// Additional details can be found in
8758 /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
8759 ///
8760 /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
8761 ImportFailed,
8762 /// This version was not generated successfully. It may not be used, enabled,
8763 /// disabled, or destroyed. Additional details can be found in
8764 /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
8765 ///
8766 /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
8767 GenerationFailed,
8768 /// This version was destroyed, and it may not be used or enabled again.
8769 /// Cloud KMS is waiting for the corresponding key material residing in an
8770 /// external key manager to be destroyed.
8771 PendingExternalDestruction,
8772 /// This version was destroyed, and it may not be used or enabled again.
8773 /// However, Cloud KMS could not confirm that the corresponding key material
8774 /// residing in an external key manager was destroyed. Additional details can
8775 /// be found in
8776 /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
8777 ///
8778 /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
8779 ExternalDestructionFailed,
8780 /// If set, the enum was initialized with an unknown value.
8781 ///
8782 /// Applications can examine the value using [CryptoKeyVersionState::value] or
8783 /// [CryptoKeyVersionState::name].
8784 UnknownValue(crypto_key_version_state::UnknownValue),
8785 }
8786
8787 #[doc(hidden)]
8788 pub mod crypto_key_version_state {
8789 #[allow(unused_imports)]
8790 use super::*;
8791 #[derive(Clone, Debug, PartialEq)]
8792 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8793 }
8794
8795 impl CryptoKeyVersionState {
8796 /// Gets the enum value.
8797 ///
8798 /// Returns `None` if the enum contains an unknown value deserialized from
8799 /// the string representation of enums.
8800 pub fn value(&self) -> std::option::Option<i32> {
8801 match self {
8802 Self::Unspecified => std::option::Option::Some(0),
8803 Self::PendingGeneration => std::option::Option::Some(5),
8804 Self::Enabled => std::option::Option::Some(1),
8805 Self::Disabled => std::option::Option::Some(2),
8806 Self::Destroyed => std::option::Option::Some(3),
8807 Self::DestroyScheduled => std::option::Option::Some(4),
8808 Self::PendingImport => std::option::Option::Some(6),
8809 Self::ImportFailed => std::option::Option::Some(7),
8810 Self::GenerationFailed => std::option::Option::Some(8),
8811 Self::PendingExternalDestruction => std::option::Option::Some(9),
8812 Self::ExternalDestructionFailed => std::option::Option::Some(10),
8813 Self::UnknownValue(u) => u.0.value(),
8814 }
8815 }
8816
8817 /// Gets the enum value as a string.
8818 ///
8819 /// Returns `None` if the enum contains an unknown value deserialized from
8820 /// the integer representation of enums.
8821 pub fn name(&self) -> std::option::Option<&str> {
8822 match self {
8823 Self::Unspecified => {
8824 std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
8825 }
8826 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
8827 Self::Enabled => std::option::Option::Some("ENABLED"),
8828 Self::Disabled => std::option::Option::Some("DISABLED"),
8829 Self::Destroyed => std::option::Option::Some("DESTROYED"),
8830 Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
8831 Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
8832 Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
8833 Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
8834 Self::PendingExternalDestruction => {
8835 std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
8836 }
8837 Self::ExternalDestructionFailed => {
8838 std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
8839 }
8840 Self::UnknownValue(u) => u.0.name(),
8841 }
8842 }
8843 }
8844
8845 impl std::default::Default for CryptoKeyVersionState {
8846 fn default() -> Self {
8847 use std::convert::From;
8848 Self::from(0)
8849 }
8850 }
8851
8852 impl std::fmt::Display for CryptoKeyVersionState {
8853 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8854 wkt::internal::display_enum(f, self.name(), self.value())
8855 }
8856 }
8857
8858 impl std::convert::From<i32> for CryptoKeyVersionState {
8859 fn from(value: i32) -> Self {
8860 match value {
8861 0 => Self::Unspecified,
8862 1 => Self::Enabled,
8863 2 => Self::Disabled,
8864 3 => Self::Destroyed,
8865 4 => Self::DestroyScheduled,
8866 5 => Self::PendingGeneration,
8867 6 => Self::PendingImport,
8868 7 => Self::ImportFailed,
8869 8 => Self::GenerationFailed,
8870 9 => Self::PendingExternalDestruction,
8871 10 => Self::ExternalDestructionFailed,
8872 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8873 wkt::internal::UnknownEnumValue::Integer(value),
8874 )),
8875 }
8876 }
8877 }
8878
8879 impl std::convert::From<&str> for CryptoKeyVersionState {
8880 fn from(value: &str) -> Self {
8881 use std::string::ToString;
8882 match value {
8883 "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
8884 "PENDING_GENERATION" => Self::PendingGeneration,
8885 "ENABLED" => Self::Enabled,
8886 "DISABLED" => Self::Disabled,
8887 "DESTROYED" => Self::Destroyed,
8888 "DESTROY_SCHEDULED" => Self::DestroyScheduled,
8889 "PENDING_IMPORT" => Self::PendingImport,
8890 "IMPORT_FAILED" => Self::ImportFailed,
8891 "GENERATION_FAILED" => Self::GenerationFailed,
8892 "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
8893 "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
8894 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8895 wkt::internal::UnknownEnumValue::String(value.to_string()),
8896 )),
8897 }
8898 }
8899 }
8900
8901 impl serde::ser::Serialize for CryptoKeyVersionState {
8902 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8903 where
8904 S: serde::Serializer,
8905 {
8906 match self {
8907 Self::Unspecified => serializer.serialize_i32(0),
8908 Self::PendingGeneration => serializer.serialize_i32(5),
8909 Self::Enabled => serializer.serialize_i32(1),
8910 Self::Disabled => serializer.serialize_i32(2),
8911 Self::Destroyed => serializer.serialize_i32(3),
8912 Self::DestroyScheduled => serializer.serialize_i32(4),
8913 Self::PendingImport => serializer.serialize_i32(6),
8914 Self::ImportFailed => serializer.serialize_i32(7),
8915 Self::GenerationFailed => serializer.serialize_i32(8),
8916 Self::PendingExternalDestruction => serializer.serialize_i32(9),
8917 Self::ExternalDestructionFailed => serializer.serialize_i32(10),
8918 Self::UnknownValue(u) => u.0.serialize(serializer),
8919 }
8920 }
8921 }
8922
8923 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
8924 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8925 where
8926 D: serde::Deserializer<'de>,
8927 {
8928 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
8929 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
8930 ))
8931 }
8932 }
8933
8934 /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
8935 /// Controls the level of detail returned for
8936 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
8937 /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
8938 /// and
8939 /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
8940 ///
8941 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8942 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
8943 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
8944 ///
8945 /// # Working with unknown values
8946 ///
8947 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8948 /// additional enum variants at any time. Adding new variants is not considered
8949 /// a breaking change. Applications should write their code in anticipation of:
8950 ///
8951 /// - New values appearing in future releases of the client library, **and**
8952 /// - New values received dynamically, without application changes.
8953 ///
8954 /// Please consult the [Working with enums] section in the user guide for some
8955 /// guidelines.
8956 ///
8957 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8958 #[derive(Clone, Debug, PartialEq)]
8959 #[non_exhaustive]
8960 pub enum CryptoKeyVersionView {
8961 /// Default view for each
8962 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
8963 /// include the
8964 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
8965 ///
8966 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8967 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8968 Unspecified,
8969 /// Provides all fields in each
8970 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
8971 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
8972 ///
8973 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8974 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8975 Full,
8976 /// If set, the enum was initialized with an unknown value.
8977 ///
8978 /// Applications can examine the value using [CryptoKeyVersionView::value] or
8979 /// [CryptoKeyVersionView::name].
8980 UnknownValue(crypto_key_version_view::UnknownValue),
8981 }
8982
8983 #[doc(hidden)]
8984 pub mod crypto_key_version_view {
8985 #[allow(unused_imports)]
8986 use super::*;
8987 #[derive(Clone, Debug, PartialEq)]
8988 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8989 }
8990
8991 impl CryptoKeyVersionView {
8992 /// Gets the enum value.
8993 ///
8994 /// Returns `None` if the enum contains an unknown value deserialized from
8995 /// the string representation of enums.
8996 pub fn value(&self) -> std::option::Option<i32> {
8997 match self {
8998 Self::Unspecified => std::option::Option::Some(0),
8999 Self::Full => std::option::Option::Some(1),
9000 Self::UnknownValue(u) => u.0.value(),
9001 }
9002 }
9003
9004 /// Gets the enum value as a string.
9005 ///
9006 /// Returns `None` if the enum contains an unknown value deserialized from
9007 /// the integer representation of enums.
9008 pub fn name(&self) -> std::option::Option<&str> {
9009 match self {
9010 Self::Unspecified => {
9011 std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
9012 }
9013 Self::Full => std::option::Option::Some("FULL"),
9014 Self::UnknownValue(u) => u.0.name(),
9015 }
9016 }
9017 }
9018
9019 impl std::default::Default for CryptoKeyVersionView {
9020 fn default() -> Self {
9021 use std::convert::From;
9022 Self::from(0)
9023 }
9024 }
9025
9026 impl std::fmt::Display for CryptoKeyVersionView {
9027 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9028 wkt::internal::display_enum(f, self.name(), self.value())
9029 }
9030 }
9031
9032 impl std::convert::From<i32> for CryptoKeyVersionView {
9033 fn from(value: i32) -> Self {
9034 match value {
9035 0 => Self::Unspecified,
9036 1 => Self::Full,
9037 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9038 wkt::internal::UnknownEnumValue::Integer(value),
9039 )),
9040 }
9041 }
9042 }
9043
9044 impl std::convert::From<&str> for CryptoKeyVersionView {
9045 fn from(value: &str) -> Self {
9046 use std::string::ToString;
9047 match value {
9048 "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
9049 "FULL" => Self::Full,
9050 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9051 wkt::internal::UnknownEnumValue::String(value.to_string()),
9052 )),
9053 }
9054 }
9055 }
9056
9057 impl serde::ser::Serialize for CryptoKeyVersionView {
9058 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9059 where
9060 S: serde::Serializer,
9061 {
9062 match self {
9063 Self::Unspecified => serializer.serialize_i32(0),
9064 Self::Full => serializer.serialize_i32(1),
9065 Self::UnknownValue(u) => u.0.serialize(serializer),
9066 }
9067 }
9068 }
9069
9070 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
9071 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9072 where
9073 D: serde::Deserializer<'de>,
9074 {
9075 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
9076 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
9077 ))
9078 }
9079 }
9080}
9081
9082/// Data with integrity verification field.
9083#[derive(Clone, Default, PartialEq)]
9084#[non_exhaustive]
9085pub struct ChecksummedData {
9086 /// Raw Data.
9087 pub data: ::bytes::Bytes,
9088
9089 /// Integrity verification field. A CRC32C
9090 /// checksum of the returned
9091 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
9092 /// integrity check of
9093 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
9094 /// performed by computing the CRC32C checksum of
9095 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
9096 /// comparing your results to this field. Discard the response in case of
9097 /// non-matching checksum values, and perform a limited number of retries. A
9098 /// persistent mismatch may indicate an issue in your computation of the CRC32C
9099 /// checksum. Note: This field is defined as int64 for reasons of compatibility
9100 /// across different languages. However, it is a non-negative integer, which
9101 /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
9102 /// languages that support this type.
9103 ///
9104 /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
9105 pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
9106
9107 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9108}
9109
9110impl ChecksummedData {
9111 /// Creates a new default instance.
9112 pub fn new() -> Self {
9113 std::default::Default::default()
9114 }
9115
9116 /// Sets the value of [data][crate::model::ChecksummedData::data].
9117 ///
9118 /// # Example
9119 /// ```ignore,no_run
9120 /// # use google_cloud_kms_v1::model::ChecksummedData;
9121 /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
9122 /// ```
9123 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9124 self.data = v.into();
9125 self
9126 }
9127
9128 /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9129 ///
9130 /// # Example
9131 /// ```ignore,no_run
9132 /// # use google_cloud_kms_v1::model::ChecksummedData;
9133 /// use wkt::Int64Value;
9134 /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
9135 /// ```
9136 pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
9137 where
9138 T: std::convert::Into<wkt::Int64Value>,
9139 {
9140 self.crc32c_checksum = std::option::Option::Some(v.into());
9141 self
9142 }
9143
9144 /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9145 ///
9146 /// # Example
9147 /// ```ignore,no_run
9148 /// # use google_cloud_kms_v1::model::ChecksummedData;
9149 /// use wkt::Int64Value;
9150 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
9151 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
9152 /// ```
9153 pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
9154 where
9155 T: std::convert::Into<wkt::Int64Value>,
9156 {
9157 self.crc32c_checksum = v.map(|x| x.into());
9158 self
9159 }
9160}
9161
9162impl wkt::message::Message for ChecksummedData {
9163 fn typename() -> &'static str {
9164 "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
9165 }
9166}
9167
9168/// The public keys for a given
9169/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
9170/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
9171///
9172/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9173/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
9174#[derive(Clone, Default, PartialEq)]
9175#[non_exhaustive]
9176pub struct PublicKey {
9177 /// The public key, encoded in PEM format. For more information, see the
9178 /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
9179 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9180 /// [Textual Encoding of Subject Public Key Info]
9181 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9182 pub pem: std::string::String,
9183
9184 /// The
9185 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
9186 /// associated with this key.
9187 ///
9188 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
9189 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
9190
9191 /// Integrity verification field. A CRC32C checksum of the returned
9192 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
9193 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
9194 /// computing the CRC32C checksum of
9195 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
9196 /// results to this field. Discard the response in case of non-matching
9197 /// checksum values, and perform a limited number of retries. A persistent
9198 /// mismatch may indicate an issue in your computation of the CRC32C checksum.
9199 /// Note: This field is defined as int64 for reasons of compatibility across
9200 /// different languages. However, it is a non-negative integer, which will
9201 /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
9202 /// languages that support this type.
9203 ///
9204 /// NOTE: This field is in Beta.
9205 ///
9206 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9207 pub pem_crc32c: std::option::Option<wkt::Int64Value>,
9208
9209 /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
9210 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9211 /// Provided here for verification.
9212 ///
9213 /// NOTE: This field is in Beta.
9214 ///
9215 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9216 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
9217 pub name: std::string::String,
9218
9219 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9220 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9221 ///
9222 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9223 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9224 pub protection_level: crate::model::ProtectionLevel,
9225
9226 /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
9227 /// customer through the
9228 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9229 /// field.
9230 ///
9231 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9232 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9233 pub public_key_format: crate::model::public_key::PublicKeyFormat,
9234
9235 /// This field contains the public key (with integrity verification), formatted
9236 /// according to the
9237 /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
9238 ///
9239 /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
9240 pub public_key: std::option::Option<crate::model::ChecksummedData>,
9241
9242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9243}
9244
9245impl PublicKey {
9246 /// Creates a new default instance.
9247 pub fn new() -> Self {
9248 std::default::Default::default()
9249 }
9250
9251 /// Sets the value of [pem][crate::model::PublicKey::pem].
9252 ///
9253 /// # Example
9254 /// ```ignore,no_run
9255 /// # use google_cloud_kms_v1::model::PublicKey;
9256 /// let x = PublicKey::new().set_pem("example");
9257 /// ```
9258 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9259 self.pem = v.into();
9260 self
9261 }
9262
9263 /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
9264 ///
9265 /// # Example
9266 /// ```ignore,no_run
9267 /// # use google_cloud_kms_v1::model::PublicKey;
9268 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
9269 /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
9270 /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
9271 /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
9272 /// ```
9273 pub fn set_algorithm<
9274 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
9275 >(
9276 mut self,
9277 v: T,
9278 ) -> Self {
9279 self.algorithm = v.into();
9280 self
9281 }
9282
9283 /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9284 ///
9285 /// # Example
9286 /// ```ignore,no_run
9287 /// # use google_cloud_kms_v1::model::PublicKey;
9288 /// use wkt::Int64Value;
9289 /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
9290 /// ```
9291 pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
9292 where
9293 T: std::convert::Into<wkt::Int64Value>,
9294 {
9295 self.pem_crc32c = std::option::Option::Some(v.into());
9296 self
9297 }
9298
9299 /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9300 ///
9301 /// # Example
9302 /// ```ignore,no_run
9303 /// # use google_cloud_kms_v1::model::PublicKey;
9304 /// use wkt::Int64Value;
9305 /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
9306 /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
9307 /// ```
9308 pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9309 where
9310 T: std::convert::Into<wkt::Int64Value>,
9311 {
9312 self.pem_crc32c = v.map(|x| x.into());
9313 self
9314 }
9315
9316 /// Sets the value of [name][crate::model::PublicKey::name].
9317 ///
9318 /// # Example
9319 /// ```ignore,no_run
9320 /// # use google_cloud_kms_v1::model::PublicKey;
9321 /// let x = PublicKey::new().set_name("example");
9322 /// ```
9323 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9324 self.name = v.into();
9325 self
9326 }
9327
9328 /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
9329 ///
9330 /// # Example
9331 /// ```ignore,no_run
9332 /// # use google_cloud_kms_v1::model::PublicKey;
9333 /// use google_cloud_kms_v1::model::ProtectionLevel;
9334 /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
9335 /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
9336 /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
9337 /// ```
9338 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9339 mut self,
9340 v: T,
9341 ) -> Self {
9342 self.protection_level = v.into();
9343 self
9344 }
9345
9346 /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
9347 ///
9348 /// # Example
9349 /// ```ignore,no_run
9350 /// # use google_cloud_kms_v1::model::PublicKey;
9351 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9352 /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9353 /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9354 /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9355 /// ```
9356 pub fn set_public_key_format<
9357 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9358 >(
9359 mut self,
9360 v: T,
9361 ) -> Self {
9362 self.public_key_format = v.into();
9363 self
9364 }
9365
9366 /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9367 ///
9368 /// # Example
9369 /// ```ignore,no_run
9370 /// # use google_cloud_kms_v1::model::PublicKey;
9371 /// use google_cloud_kms_v1::model::ChecksummedData;
9372 /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9373 /// ```
9374 pub fn set_public_key<T>(mut self, v: T) -> Self
9375 where
9376 T: std::convert::Into<crate::model::ChecksummedData>,
9377 {
9378 self.public_key = std::option::Option::Some(v.into());
9379 self
9380 }
9381
9382 /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9383 ///
9384 /// # Example
9385 /// ```ignore,no_run
9386 /// # use google_cloud_kms_v1::model::PublicKey;
9387 /// use google_cloud_kms_v1::model::ChecksummedData;
9388 /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9389 /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9390 /// ```
9391 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9392 where
9393 T: std::convert::Into<crate::model::ChecksummedData>,
9394 {
9395 self.public_key = v.map(|x| x.into());
9396 self
9397 }
9398}
9399
9400impl wkt::message::Message for PublicKey {
9401 fn typename() -> &'static str {
9402 "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9403 }
9404}
9405
9406/// Defines additional types related to [PublicKey].
9407pub mod public_key {
9408 #[allow(unused_imports)]
9409 use super::*;
9410
9411 /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9412 ///
9413 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9414 ///
9415 /// # Working with unknown values
9416 ///
9417 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9418 /// additional enum variants at any time. Adding new variants is not considered
9419 /// a breaking change. Applications should write their code in anticipation of:
9420 ///
9421 /// - New values appearing in future releases of the client library, **and**
9422 /// - New values received dynamically, without application changes.
9423 ///
9424 /// Please consult the [Working with enums] section in the user guide for some
9425 /// guidelines.
9426 ///
9427 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9428 #[derive(Clone, Debug, PartialEq)]
9429 #[non_exhaustive]
9430 pub enum PublicKeyFormat {
9431 /// If the
9432 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9433 /// field is not specified:
9434 ///
9435 /// - For PQC algorithms, an error will be returned.
9436 /// - For non-PQC algorithms, the default format is PEM, and the field
9437 /// [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9438 ///
9439 /// Otherwise, the public key will be exported through the
9440 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9441 /// requested format.
9442 ///
9443 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9444 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9445 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9446 Unspecified,
9447 /// The returned public key will be encoded in PEM format.
9448 /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9449 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9450 /// and [Textual Encoding of Subject Public Key Info]
9451 /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9452 Pem,
9453 /// The returned public key will be encoded in DER format (the
9454 /// PrivateKeyInfo structure from RFC 5208).
9455 Der,
9456 /// This is supported only for PQC algorithms.
9457 /// The key material is returned in the format defined by NIST PQC
9458 /// standards (FIPS 203, FIPS 204, and FIPS 205).
9459 NistPqc,
9460 /// The returned public key is in raw bytes format defined in its standard
9461 /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9462 XwingRawBytes,
9463 /// If set, the enum was initialized with an unknown value.
9464 ///
9465 /// Applications can examine the value using [PublicKeyFormat::value] or
9466 /// [PublicKeyFormat::name].
9467 UnknownValue(public_key_format::UnknownValue),
9468 }
9469
9470 #[doc(hidden)]
9471 pub mod public_key_format {
9472 #[allow(unused_imports)]
9473 use super::*;
9474 #[derive(Clone, Debug, PartialEq)]
9475 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9476 }
9477
9478 impl PublicKeyFormat {
9479 /// Gets the enum value.
9480 ///
9481 /// Returns `None` if the enum contains an unknown value deserialized from
9482 /// the string representation of enums.
9483 pub fn value(&self) -> std::option::Option<i32> {
9484 match self {
9485 Self::Unspecified => std::option::Option::Some(0),
9486 Self::Pem => std::option::Option::Some(1),
9487 Self::Der => std::option::Option::Some(2),
9488 Self::NistPqc => std::option::Option::Some(3),
9489 Self::XwingRawBytes => std::option::Option::Some(4),
9490 Self::UnknownValue(u) => u.0.value(),
9491 }
9492 }
9493
9494 /// Gets the enum value as a string.
9495 ///
9496 /// Returns `None` if the enum contains an unknown value deserialized from
9497 /// the integer representation of enums.
9498 pub fn name(&self) -> std::option::Option<&str> {
9499 match self {
9500 Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9501 Self::Pem => std::option::Option::Some("PEM"),
9502 Self::Der => std::option::Option::Some("DER"),
9503 Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9504 Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9505 Self::UnknownValue(u) => u.0.name(),
9506 }
9507 }
9508 }
9509
9510 impl std::default::Default for PublicKeyFormat {
9511 fn default() -> Self {
9512 use std::convert::From;
9513 Self::from(0)
9514 }
9515 }
9516
9517 impl std::fmt::Display for PublicKeyFormat {
9518 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9519 wkt::internal::display_enum(f, self.name(), self.value())
9520 }
9521 }
9522
9523 impl std::convert::From<i32> for PublicKeyFormat {
9524 fn from(value: i32) -> Self {
9525 match value {
9526 0 => Self::Unspecified,
9527 1 => Self::Pem,
9528 2 => Self::Der,
9529 3 => Self::NistPqc,
9530 4 => Self::XwingRawBytes,
9531 _ => Self::UnknownValue(public_key_format::UnknownValue(
9532 wkt::internal::UnknownEnumValue::Integer(value),
9533 )),
9534 }
9535 }
9536 }
9537
9538 impl std::convert::From<&str> for PublicKeyFormat {
9539 fn from(value: &str) -> Self {
9540 use std::string::ToString;
9541 match value {
9542 "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9543 "PEM" => Self::Pem,
9544 "DER" => Self::Der,
9545 "NIST_PQC" => Self::NistPqc,
9546 "XWING_RAW_BYTES" => Self::XwingRawBytes,
9547 _ => Self::UnknownValue(public_key_format::UnknownValue(
9548 wkt::internal::UnknownEnumValue::String(value.to_string()),
9549 )),
9550 }
9551 }
9552 }
9553
9554 impl serde::ser::Serialize for PublicKeyFormat {
9555 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9556 where
9557 S: serde::Serializer,
9558 {
9559 match self {
9560 Self::Unspecified => serializer.serialize_i32(0),
9561 Self::Pem => serializer.serialize_i32(1),
9562 Self::Der => serializer.serialize_i32(2),
9563 Self::NistPqc => serializer.serialize_i32(3),
9564 Self::XwingRawBytes => serializer.serialize_i32(4),
9565 Self::UnknownValue(u) => u.0.serialize(serializer),
9566 }
9567 }
9568 }
9569
9570 impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9571 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9572 where
9573 D: serde::Deserializer<'de>,
9574 {
9575 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9576 ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9577 ))
9578 }
9579 }
9580}
9581
9582/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9583/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9584/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9585/// key material, generated outside of Cloud KMS.
9586///
9587/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9588/// generate a "wrapping key", which is a public/private key pair. You use the
9589/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9590/// protect it during the import process. The nature of the wrapping key depends
9591/// on the choice of
9592/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9593/// wrapping key generation is complete, the
9594/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9595/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9596/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9597/// fetched public key can then be used to wrap your pre-existing key material.
9598///
9599/// Once the key material is wrapped, it can be imported into a new
9600/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9601/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9602/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9603/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9604/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9605/// uses the private key portion of the wrapping key to unwrap the key material.
9606/// Only Cloud KMS has access to the private key.
9607///
9608/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9609/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9610/// any key material that was wrapped with the
9611/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9612///
9613/// For more information, see
9614/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9615///
9616/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9617/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9618/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9619/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9620/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9621/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9622/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9623/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9624#[derive(Clone, Default, PartialEq)]
9625#[non_exhaustive]
9626pub struct ImportJob {
9627 /// Output only. The resource name for this
9628 /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9629 /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9630 ///
9631 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9632 pub name: std::string::String,
9633
9634 /// Required. Immutable. The wrapping method to be used for incoming key
9635 /// material.
9636 pub import_method: crate::model::import_job::ImportMethod,
9637
9638 /// Required. Immutable. The protection level of the
9639 /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9640 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9641 /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9642 /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9643 /// into.
9644 ///
9645 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9646 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9647 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9648 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9649 pub protection_level: crate::model::ProtectionLevel,
9650
9651 /// Output only. The time at which this
9652 /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9653 ///
9654 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9655 pub create_time: std::option::Option<wkt::Timestamp>,
9656
9657 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9658 /// material was generated.
9659 ///
9660 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9661 pub generate_time: std::option::Option<wkt::Timestamp>,
9662
9663 /// Output only. The time at which this
9664 /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9665 /// can no longer be used to import key material.
9666 ///
9667 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9668 pub expire_time: std::option::Option<wkt::Timestamp>,
9669
9670 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9671 /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9672 /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9673 ///
9674 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9675 /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9676 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9677 pub expire_event_time: std::option::Option<wkt::Timestamp>,
9678
9679 /// Output only. The current state of the
9680 /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9681 ///
9682 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9683 pub state: crate::model::import_job::ImportJobState,
9684
9685 /// Output only. The public key with which to wrap key material prior to
9686 /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9687 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9688 ///
9689 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9690 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9691 pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9692
9693 /// Output only. Statement that was generated and signed by the key creator
9694 /// (for example, an HSM) at key creation time. Use this statement to verify
9695 /// attributes of the key as stored on the HSM, independently of Google.
9696 /// Only present if the chosen
9697 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9698 /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9699 ///
9700 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9701 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9702 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9703
9704 /// Immutable. The resource name of the backend environment where the key
9705 /// material for the wrapping key resides and where all related cryptographic
9706 /// operations are performed. Currently, this field is only populated for keys
9707 /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9708 /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9709 /// in the future. Supported resources:
9710 ///
9711 /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9712 ///
9713 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9714 pub crypto_key_backend: std::string::String,
9715
9716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9717}
9718
9719impl ImportJob {
9720 /// Creates a new default instance.
9721 pub fn new() -> Self {
9722 std::default::Default::default()
9723 }
9724
9725 /// Sets the value of [name][crate::model::ImportJob::name].
9726 ///
9727 /// # Example
9728 /// ```ignore,no_run
9729 /// # use google_cloud_kms_v1::model::ImportJob;
9730 /// let x = ImportJob::new().set_name("example");
9731 /// ```
9732 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9733 self.name = v.into();
9734 self
9735 }
9736
9737 /// Sets the value of [import_method][crate::model::ImportJob::import_method].
9738 ///
9739 /// # Example
9740 /// ```ignore,no_run
9741 /// # use google_cloud_kms_v1::model::ImportJob;
9742 /// use google_cloud_kms_v1::model::import_job::ImportMethod;
9743 /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
9744 /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
9745 /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
9746 /// ```
9747 pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
9748 mut self,
9749 v: T,
9750 ) -> Self {
9751 self.import_method = v.into();
9752 self
9753 }
9754
9755 /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
9756 ///
9757 /// # Example
9758 /// ```ignore,no_run
9759 /// # use google_cloud_kms_v1::model::ImportJob;
9760 /// use google_cloud_kms_v1::model::ProtectionLevel;
9761 /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
9762 /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
9763 /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
9764 /// ```
9765 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9766 mut self,
9767 v: T,
9768 ) -> Self {
9769 self.protection_level = v.into();
9770 self
9771 }
9772
9773 /// Sets the value of [create_time][crate::model::ImportJob::create_time].
9774 ///
9775 /// # Example
9776 /// ```ignore,no_run
9777 /// # use google_cloud_kms_v1::model::ImportJob;
9778 /// use wkt::Timestamp;
9779 /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
9780 /// ```
9781 pub fn set_create_time<T>(mut self, v: T) -> Self
9782 where
9783 T: std::convert::Into<wkt::Timestamp>,
9784 {
9785 self.create_time = std::option::Option::Some(v.into());
9786 self
9787 }
9788
9789 /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
9790 ///
9791 /// # Example
9792 /// ```ignore,no_run
9793 /// # use google_cloud_kms_v1::model::ImportJob;
9794 /// use wkt::Timestamp;
9795 /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9796 /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
9797 /// ```
9798 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9799 where
9800 T: std::convert::Into<wkt::Timestamp>,
9801 {
9802 self.create_time = v.map(|x| x.into());
9803 self
9804 }
9805
9806 /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
9807 ///
9808 /// # Example
9809 /// ```ignore,no_run
9810 /// # use google_cloud_kms_v1::model::ImportJob;
9811 /// use wkt::Timestamp;
9812 /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
9813 /// ```
9814 pub fn set_generate_time<T>(mut self, v: T) -> Self
9815 where
9816 T: std::convert::Into<wkt::Timestamp>,
9817 {
9818 self.generate_time = std::option::Option::Some(v.into());
9819 self
9820 }
9821
9822 /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
9823 ///
9824 /// # Example
9825 /// ```ignore,no_run
9826 /// # use google_cloud_kms_v1::model::ImportJob;
9827 /// use wkt::Timestamp;
9828 /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
9829 /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
9830 /// ```
9831 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
9832 where
9833 T: std::convert::Into<wkt::Timestamp>,
9834 {
9835 self.generate_time = v.map(|x| x.into());
9836 self
9837 }
9838
9839 /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
9840 ///
9841 /// # Example
9842 /// ```ignore,no_run
9843 /// # use google_cloud_kms_v1::model::ImportJob;
9844 /// use wkt::Timestamp;
9845 /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
9846 /// ```
9847 pub fn set_expire_time<T>(mut self, v: T) -> Self
9848 where
9849 T: std::convert::Into<wkt::Timestamp>,
9850 {
9851 self.expire_time = std::option::Option::Some(v.into());
9852 self
9853 }
9854
9855 /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
9856 ///
9857 /// # Example
9858 /// ```ignore,no_run
9859 /// # use google_cloud_kms_v1::model::ImportJob;
9860 /// use wkt::Timestamp;
9861 /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9862 /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
9863 /// ```
9864 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9865 where
9866 T: std::convert::Into<wkt::Timestamp>,
9867 {
9868 self.expire_time = v.map(|x| x.into());
9869 self
9870 }
9871
9872 /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9873 ///
9874 /// # Example
9875 /// ```ignore,no_run
9876 /// # use google_cloud_kms_v1::model::ImportJob;
9877 /// use wkt::Timestamp;
9878 /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
9879 /// ```
9880 pub fn set_expire_event_time<T>(mut self, v: T) -> Self
9881 where
9882 T: std::convert::Into<wkt::Timestamp>,
9883 {
9884 self.expire_event_time = std::option::Option::Some(v.into());
9885 self
9886 }
9887
9888 /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9889 ///
9890 /// # Example
9891 /// ```ignore,no_run
9892 /// # use google_cloud_kms_v1::model::ImportJob;
9893 /// use wkt::Timestamp;
9894 /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
9895 /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
9896 /// ```
9897 pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
9898 where
9899 T: std::convert::Into<wkt::Timestamp>,
9900 {
9901 self.expire_event_time = v.map(|x| x.into());
9902 self
9903 }
9904
9905 /// Sets the value of [state][crate::model::ImportJob::state].
9906 ///
9907 /// # Example
9908 /// ```ignore,no_run
9909 /// # use google_cloud_kms_v1::model::ImportJob;
9910 /// use google_cloud_kms_v1::model::import_job::ImportJobState;
9911 /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
9912 /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
9913 /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
9914 /// ```
9915 pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
9916 mut self,
9917 v: T,
9918 ) -> Self {
9919 self.state = v.into();
9920 self
9921 }
9922
9923 /// Sets the value of [public_key][crate::model::ImportJob::public_key].
9924 ///
9925 /// # Example
9926 /// ```ignore,no_run
9927 /// # use google_cloud_kms_v1::model::ImportJob;
9928 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9929 /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
9930 /// ```
9931 pub fn set_public_key<T>(mut self, v: T) -> Self
9932 where
9933 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9934 {
9935 self.public_key = std::option::Option::Some(v.into());
9936 self
9937 }
9938
9939 /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
9940 ///
9941 /// # Example
9942 /// ```ignore,no_run
9943 /// # use google_cloud_kms_v1::model::ImportJob;
9944 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9945 /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
9946 /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
9947 /// ```
9948 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9949 where
9950 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9951 {
9952 self.public_key = v.map(|x| x.into());
9953 self
9954 }
9955
9956 /// Sets the value of [attestation][crate::model::ImportJob::attestation].
9957 ///
9958 /// # Example
9959 /// ```ignore,no_run
9960 /// # use google_cloud_kms_v1::model::ImportJob;
9961 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9962 /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
9963 /// ```
9964 pub fn set_attestation<T>(mut self, v: T) -> Self
9965 where
9966 T: std::convert::Into<crate::model::KeyOperationAttestation>,
9967 {
9968 self.attestation = std::option::Option::Some(v.into());
9969 self
9970 }
9971
9972 /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
9973 ///
9974 /// # Example
9975 /// ```ignore,no_run
9976 /// # use google_cloud_kms_v1::model::ImportJob;
9977 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9978 /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
9979 /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
9980 /// ```
9981 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
9982 where
9983 T: std::convert::Into<crate::model::KeyOperationAttestation>,
9984 {
9985 self.attestation = v.map(|x| x.into());
9986 self
9987 }
9988
9989 /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
9990 ///
9991 /// # Example
9992 /// ```ignore,no_run
9993 /// # use google_cloud_kms_v1::model::ImportJob;
9994 /// let x = ImportJob::new().set_crypto_key_backend("example");
9995 /// ```
9996 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
9997 mut self,
9998 v: T,
9999 ) -> Self {
10000 self.crypto_key_backend = v.into();
10001 self
10002 }
10003}
10004
10005impl wkt::message::Message for ImportJob {
10006 fn typename() -> &'static str {
10007 "type.googleapis.com/google.cloud.kms.v1.ImportJob"
10008 }
10009}
10010
10011/// Defines additional types related to [ImportJob].
10012pub mod import_job {
10013 #[allow(unused_imports)]
10014 use super::*;
10015
10016 /// The public key component of the wrapping key. For details of the type of
10017 /// key this public key corresponds to, see the
10018 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
10019 ///
10020 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10021 #[derive(Clone, Default, PartialEq)]
10022 #[non_exhaustive]
10023 pub struct WrappingPublicKey {
10024 /// The public key, encoded in PEM format. For more information, see the [RFC
10025 /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
10026 /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
10027 /// [Textual Encoding of Subject Public Key Info]
10028 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
10029 pub pem: std::string::String,
10030
10031 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10032 }
10033
10034 impl WrappingPublicKey {
10035 /// Creates a new default instance.
10036 pub fn new() -> Self {
10037 std::default::Default::default()
10038 }
10039
10040 /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
10041 ///
10042 /// # Example
10043 /// ```ignore,no_run
10044 /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10045 /// let x = WrappingPublicKey::new().set_pem("example");
10046 /// ```
10047 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10048 self.pem = v.into();
10049 self
10050 }
10051 }
10052
10053 impl wkt::message::Message for WrappingPublicKey {
10054 fn typename() -> &'static str {
10055 "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
10056 }
10057 }
10058
10059 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
10060 /// key wrapping method chosen for this
10061 /// [ImportJob][google.cloud.kms.v1.ImportJob].
10062 ///
10063 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10064 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10065 ///
10066 /// # Working with unknown values
10067 ///
10068 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10069 /// additional enum variants at any time. Adding new variants is not considered
10070 /// a breaking change. Applications should write their code in anticipation of:
10071 ///
10072 /// - New values appearing in future releases of the client library, **and**
10073 /// - New values received dynamically, without application changes.
10074 ///
10075 /// Please consult the [Working with enums] section in the user guide for some
10076 /// guidelines.
10077 ///
10078 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10079 #[derive(Clone, Debug, PartialEq)]
10080 #[non_exhaustive]
10081 pub enum ImportMethod {
10082 /// Not specified.
10083 Unspecified,
10084 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10085 /// scheme defined in the PKCS #11 standard. In summary, this involves
10086 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10087 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10088 /// [RSA AES key wrap
10089 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10090 RsaOaep3072Sha1Aes256,
10091 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10092 /// scheme defined in the PKCS #11 standard. In summary, this involves
10093 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10094 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10095 /// [RSA AES key wrap
10096 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10097 RsaOaep4096Sha1Aes256,
10098 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10099 /// scheme defined in the PKCS #11 standard. In summary, this involves
10100 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10101 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10102 /// [RSA AES key wrap
10103 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10104 RsaOaep3072Sha256Aes256,
10105 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10106 /// scheme defined in the PKCS #11 standard. In summary, this involves
10107 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10108 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10109 /// [RSA AES key wrap
10110 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10111 RsaOaep4096Sha256Aes256,
10112 /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
10113 /// key material to be imported is wrapped directly with the RSA key. Due
10114 /// to technical limitations of RSA wrapping, this method cannot be used to
10115 /// wrap RSA keys for import.
10116 RsaOaep3072Sha256,
10117 /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
10118 /// key material to be imported is wrapped directly with the RSA key. Due
10119 /// to technical limitations of RSA wrapping, this method cannot be used to
10120 /// wrap RSA keys for import.
10121 RsaOaep4096Sha256,
10122 /// If set, the enum was initialized with an unknown value.
10123 ///
10124 /// Applications can examine the value using [ImportMethod::value] or
10125 /// [ImportMethod::name].
10126 UnknownValue(import_method::UnknownValue),
10127 }
10128
10129 #[doc(hidden)]
10130 pub mod import_method {
10131 #[allow(unused_imports)]
10132 use super::*;
10133 #[derive(Clone, Debug, PartialEq)]
10134 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10135 }
10136
10137 impl ImportMethod {
10138 /// Gets the enum value.
10139 ///
10140 /// Returns `None` if the enum contains an unknown value deserialized from
10141 /// the string representation of enums.
10142 pub fn value(&self) -> std::option::Option<i32> {
10143 match self {
10144 Self::Unspecified => std::option::Option::Some(0),
10145 Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
10146 Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
10147 Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
10148 Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
10149 Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
10150 Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
10151 Self::UnknownValue(u) => u.0.value(),
10152 }
10153 }
10154
10155 /// Gets the enum value as a string.
10156 ///
10157 /// Returns `None` if the enum contains an unknown value deserialized from
10158 /// the integer representation of enums.
10159 pub fn name(&self) -> std::option::Option<&str> {
10160 match self {
10161 Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
10162 Self::RsaOaep3072Sha1Aes256 => {
10163 std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
10164 }
10165 Self::RsaOaep4096Sha1Aes256 => {
10166 std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
10167 }
10168 Self::RsaOaep3072Sha256Aes256 => {
10169 std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
10170 }
10171 Self::RsaOaep4096Sha256Aes256 => {
10172 std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
10173 }
10174 Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
10175 Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
10176 Self::UnknownValue(u) => u.0.name(),
10177 }
10178 }
10179 }
10180
10181 impl std::default::Default for ImportMethod {
10182 fn default() -> Self {
10183 use std::convert::From;
10184 Self::from(0)
10185 }
10186 }
10187
10188 impl std::fmt::Display for ImportMethod {
10189 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10190 wkt::internal::display_enum(f, self.name(), self.value())
10191 }
10192 }
10193
10194 impl std::convert::From<i32> for ImportMethod {
10195 fn from(value: i32) -> Self {
10196 match value {
10197 0 => Self::Unspecified,
10198 1 => Self::RsaOaep3072Sha1Aes256,
10199 2 => Self::RsaOaep4096Sha1Aes256,
10200 3 => Self::RsaOaep3072Sha256Aes256,
10201 4 => Self::RsaOaep4096Sha256Aes256,
10202 5 => Self::RsaOaep3072Sha256,
10203 6 => Self::RsaOaep4096Sha256,
10204 _ => Self::UnknownValue(import_method::UnknownValue(
10205 wkt::internal::UnknownEnumValue::Integer(value),
10206 )),
10207 }
10208 }
10209 }
10210
10211 impl std::convert::From<&str> for ImportMethod {
10212 fn from(value: &str) -> Self {
10213 use std::string::ToString;
10214 match value {
10215 "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
10216 "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
10217 "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
10218 "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
10219 "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
10220 "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
10221 "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
10222 _ => Self::UnknownValue(import_method::UnknownValue(
10223 wkt::internal::UnknownEnumValue::String(value.to_string()),
10224 )),
10225 }
10226 }
10227 }
10228
10229 impl serde::ser::Serialize for ImportMethod {
10230 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10231 where
10232 S: serde::Serializer,
10233 {
10234 match self {
10235 Self::Unspecified => serializer.serialize_i32(0),
10236 Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
10237 Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
10238 Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
10239 Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
10240 Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
10241 Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
10242 Self::UnknownValue(u) => u.0.serialize(serializer),
10243 }
10244 }
10245 }
10246
10247 impl<'de> serde::de::Deserialize<'de> for ImportMethod {
10248 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10249 where
10250 D: serde::Deserializer<'de>,
10251 {
10252 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
10253 ".google.cloud.kms.v1.ImportJob.ImportMethod",
10254 ))
10255 }
10256 }
10257
10258 /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
10259 /// it can be used.
10260 ///
10261 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10262 ///
10263 /// # Working with unknown values
10264 ///
10265 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10266 /// additional enum variants at any time. Adding new variants is not considered
10267 /// a breaking change. Applications should write their code in anticipation of:
10268 ///
10269 /// - New values appearing in future releases of the client library, **and**
10270 /// - New values received dynamically, without application changes.
10271 ///
10272 /// Please consult the [Working with enums] section in the user guide for some
10273 /// guidelines.
10274 ///
10275 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10276 #[derive(Clone, Debug, PartialEq)]
10277 #[non_exhaustive]
10278 pub enum ImportJobState {
10279 /// Not specified.
10280 Unspecified,
10281 /// The wrapping key for this job is still being generated. It may not be
10282 /// used. Cloud KMS will automatically mark this job as
10283 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
10284 /// the wrapping key is generated.
10285 ///
10286 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
10287 PendingGeneration,
10288 /// This job may be used in
10289 /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
10290 /// and
10291 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
10292 /// requests.
10293 ///
10294 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
10295 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
10296 Active,
10297 /// This job can no longer be used and may not leave this state once entered.
10298 Expired,
10299 /// If set, the enum was initialized with an unknown value.
10300 ///
10301 /// Applications can examine the value using [ImportJobState::value] or
10302 /// [ImportJobState::name].
10303 UnknownValue(import_job_state::UnknownValue),
10304 }
10305
10306 #[doc(hidden)]
10307 pub mod import_job_state {
10308 #[allow(unused_imports)]
10309 use super::*;
10310 #[derive(Clone, Debug, PartialEq)]
10311 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10312 }
10313
10314 impl ImportJobState {
10315 /// Gets the enum value.
10316 ///
10317 /// Returns `None` if the enum contains an unknown value deserialized from
10318 /// the string representation of enums.
10319 pub fn value(&self) -> std::option::Option<i32> {
10320 match self {
10321 Self::Unspecified => std::option::Option::Some(0),
10322 Self::PendingGeneration => std::option::Option::Some(1),
10323 Self::Active => std::option::Option::Some(2),
10324 Self::Expired => std::option::Option::Some(3),
10325 Self::UnknownValue(u) => u.0.value(),
10326 }
10327 }
10328
10329 /// Gets the enum value as a string.
10330 ///
10331 /// Returns `None` if the enum contains an unknown value deserialized from
10332 /// the integer representation of enums.
10333 pub fn name(&self) -> std::option::Option<&str> {
10334 match self {
10335 Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
10336 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
10337 Self::Active => std::option::Option::Some("ACTIVE"),
10338 Self::Expired => std::option::Option::Some("EXPIRED"),
10339 Self::UnknownValue(u) => u.0.name(),
10340 }
10341 }
10342 }
10343
10344 impl std::default::Default for ImportJobState {
10345 fn default() -> Self {
10346 use std::convert::From;
10347 Self::from(0)
10348 }
10349 }
10350
10351 impl std::fmt::Display for ImportJobState {
10352 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10353 wkt::internal::display_enum(f, self.name(), self.value())
10354 }
10355 }
10356
10357 impl std::convert::From<i32> for ImportJobState {
10358 fn from(value: i32) -> Self {
10359 match value {
10360 0 => Self::Unspecified,
10361 1 => Self::PendingGeneration,
10362 2 => Self::Active,
10363 3 => Self::Expired,
10364 _ => Self::UnknownValue(import_job_state::UnknownValue(
10365 wkt::internal::UnknownEnumValue::Integer(value),
10366 )),
10367 }
10368 }
10369 }
10370
10371 impl std::convert::From<&str> for ImportJobState {
10372 fn from(value: &str) -> Self {
10373 use std::string::ToString;
10374 match value {
10375 "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10376 "PENDING_GENERATION" => Self::PendingGeneration,
10377 "ACTIVE" => Self::Active,
10378 "EXPIRED" => Self::Expired,
10379 _ => Self::UnknownValue(import_job_state::UnknownValue(
10380 wkt::internal::UnknownEnumValue::String(value.to_string()),
10381 )),
10382 }
10383 }
10384 }
10385
10386 impl serde::ser::Serialize for ImportJobState {
10387 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10388 where
10389 S: serde::Serializer,
10390 {
10391 match self {
10392 Self::Unspecified => serializer.serialize_i32(0),
10393 Self::PendingGeneration => serializer.serialize_i32(1),
10394 Self::Active => serializer.serialize_i32(2),
10395 Self::Expired => serializer.serialize_i32(3),
10396 Self::UnknownValue(u) => u.0.serialize(serializer),
10397 }
10398 }
10399 }
10400
10401 impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10402 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10403 where
10404 D: serde::Deserializer<'de>,
10405 {
10406 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10407 ".google.cloud.kms.v1.ImportJob.ImportJobState",
10408 ))
10409 }
10410 }
10411}
10412
10413/// ExternalProtectionLevelOptions stores a group of additional fields for
10414/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10415/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10416/// protection level and
10417/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10418/// levels.
10419///
10420/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10421/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10422/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10423#[derive(Clone, Default, PartialEq)]
10424#[non_exhaustive]
10425pub struct ExternalProtectionLevelOptions {
10426 /// The URI for an external resource that this
10427 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10428 ///
10429 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10430 pub external_key_uri: std::string::String,
10431
10432 /// The path to the external key material on the EKM when using
10433 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10434 /// this field instead of external_key_uri when using an
10435 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10436 ///
10437 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10438 pub ekm_connection_key_path: std::string::String,
10439
10440 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10441}
10442
10443impl ExternalProtectionLevelOptions {
10444 /// Creates a new default instance.
10445 pub fn new() -> Self {
10446 std::default::Default::default()
10447 }
10448
10449 /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10450 ///
10451 /// # Example
10452 /// ```ignore,no_run
10453 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10454 /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10455 /// ```
10456 pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10457 mut self,
10458 v: T,
10459 ) -> Self {
10460 self.external_key_uri = v.into();
10461 self
10462 }
10463
10464 /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10465 ///
10466 /// # Example
10467 /// ```ignore,no_run
10468 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10469 /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10470 /// ```
10471 pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10472 mut self,
10473 v: T,
10474 ) -> Self {
10475 self.ekm_connection_key_path = v.into();
10476 self
10477 }
10478}
10479
10480impl wkt::message::Message for ExternalProtectionLevelOptions {
10481 fn typename() -> &'static str {
10482 "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10483 }
10484}
10485
10486/// A
10487/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10488/// specifies zero or more allowed
10489/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10490/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey] or
10491/// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig]
10492/// (the default Key Access Justifications policy).
10493///
10494/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10495/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10496/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10497#[derive(Clone, Default, PartialEq)]
10498#[non_exhaustive]
10499pub struct KeyAccessJustificationsPolicy {
10500 /// The list of allowed reasons for access to a
10501 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Note that empty
10502 /// allowed_access_reasons has a different meaning depending on where this
10503 /// message appears. If this is under
10504 /// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig],
10505 /// it means allow-all. If this is under
10506 /// [CryptoKey][google.cloud.kms.v1.CryptoKey], it means deny-all.
10507 ///
10508 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10509 pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10510
10511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10512}
10513
10514impl KeyAccessJustificationsPolicy {
10515 /// Creates a new default instance.
10516 pub fn new() -> Self {
10517 std::default::Default::default()
10518 }
10519
10520 /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10521 ///
10522 /// # Example
10523 /// ```ignore,no_run
10524 /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10525 /// use google_cloud_kms_v1::model::AccessReason;
10526 /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10527 /// AccessReason::CustomerInitiatedSupport,
10528 /// AccessReason::GoogleInitiatedService,
10529 /// AccessReason::ThirdPartyDataRequest,
10530 /// ]);
10531 /// ```
10532 pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10533 where
10534 T: std::iter::IntoIterator<Item = V>,
10535 V: std::convert::Into<crate::model::AccessReason>,
10536 {
10537 use std::iter::Iterator;
10538 self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10539 self
10540 }
10541}
10542
10543impl wkt::message::Message for KeyAccessJustificationsPolicy {
10544 fn typename() -> &'static str {
10545 "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10546 }
10547}
10548
10549/// A RetiredResource resource represents the record of a deleted
10550/// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Its purpose is to provide
10551/// visibility into retained user data and to prevent reuse of these names for
10552/// new [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10553///
10554/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10555#[derive(Clone, Default, PartialEq)]
10556#[non_exhaustive]
10557pub struct RetiredResource {
10558 /// Output only. Identifier. The resource name for this
10559 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] in the format
10560 /// `projects/*/locations/*/retiredResources/*`.
10561 ///
10562 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10563 pub name: std::string::String,
10564
10565 /// Output only. The full resource name of the original
10566 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] that was deleted in the format
10567 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10568 ///
10569 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10570 pub original_resource: std::string::String,
10571
10572 /// Output only. The resource type of the original deleted resource.
10573 pub resource_type: std::string::String,
10574
10575 /// Output only. The time at which the original resource was deleted and this
10576 /// RetiredResource record was created.
10577 pub delete_time: std::option::Option<wkt::Timestamp>,
10578
10579 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10580}
10581
10582impl RetiredResource {
10583 /// Creates a new default instance.
10584 pub fn new() -> Self {
10585 std::default::Default::default()
10586 }
10587
10588 /// Sets the value of [name][crate::model::RetiredResource::name].
10589 ///
10590 /// # Example
10591 /// ```ignore,no_run
10592 /// # use google_cloud_kms_v1::model::RetiredResource;
10593 /// let x = RetiredResource::new().set_name("example");
10594 /// ```
10595 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10596 self.name = v.into();
10597 self
10598 }
10599
10600 /// Sets the value of [original_resource][crate::model::RetiredResource::original_resource].
10601 ///
10602 /// # Example
10603 /// ```ignore,no_run
10604 /// # use google_cloud_kms_v1::model::RetiredResource;
10605 /// let x = RetiredResource::new().set_original_resource("example");
10606 /// ```
10607 pub fn set_original_resource<T: std::convert::Into<std::string::String>>(
10608 mut self,
10609 v: T,
10610 ) -> Self {
10611 self.original_resource = v.into();
10612 self
10613 }
10614
10615 /// Sets the value of [resource_type][crate::model::RetiredResource::resource_type].
10616 ///
10617 /// # Example
10618 /// ```ignore,no_run
10619 /// # use google_cloud_kms_v1::model::RetiredResource;
10620 /// let x = RetiredResource::new().set_resource_type("example");
10621 /// ```
10622 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10623 self.resource_type = v.into();
10624 self
10625 }
10626
10627 /// Sets the value of [delete_time][crate::model::RetiredResource::delete_time].
10628 ///
10629 /// # Example
10630 /// ```ignore,no_run
10631 /// # use google_cloud_kms_v1::model::RetiredResource;
10632 /// use wkt::Timestamp;
10633 /// let x = RetiredResource::new().set_delete_time(Timestamp::default()/* use setters */);
10634 /// ```
10635 pub fn set_delete_time<T>(mut self, v: T) -> Self
10636 where
10637 T: std::convert::Into<wkt::Timestamp>,
10638 {
10639 self.delete_time = std::option::Option::Some(v.into());
10640 self
10641 }
10642
10643 /// Sets or clears the value of [delete_time][crate::model::RetiredResource::delete_time].
10644 ///
10645 /// # Example
10646 /// ```ignore,no_run
10647 /// # use google_cloud_kms_v1::model::RetiredResource;
10648 /// use wkt::Timestamp;
10649 /// let x = RetiredResource::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
10650 /// let x = RetiredResource::new().set_or_clear_delete_time(None::<Timestamp>);
10651 /// ```
10652 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
10653 where
10654 T: std::convert::Into<wkt::Timestamp>,
10655 {
10656 self.delete_time = v.map(|x| x.into());
10657 self
10658 }
10659}
10660
10661impl wkt::message::Message for RetiredResource {
10662 fn typename() -> &'static str {
10663 "type.googleapis.com/google.cloud.kms.v1.RetiredResource"
10664 }
10665}
10666
10667/// Request message for
10668/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10669///
10670/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10671#[derive(Clone, Default, PartialEq)]
10672#[non_exhaustive]
10673pub struct ListKeyRingsRequest {
10674 /// Required. The resource name of the location associated with the
10675 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
10676 /// `projects/*/locations/*`.
10677 ///
10678 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10679 pub parent: std::string::String,
10680
10681 /// Optional. Optional limit on the number of
10682 /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
10683 /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
10684 /// including the
10685 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
10686 /// in a subsequent request. If unspecified, the server will pick an
10687 /// appropriate default.
10688 ///
10689 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10690 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10691 pub page_size: i32,
10692
10693 /// Optional. Optional pagination token, returned earlier via
10694 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
10695 ///
10696 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10697 pub page_token: std::string::String,
10698
10699 /// Optional. Only include resources that match the filter in the response. For
10700 /// more information, see
10701 /// [Sorting and filtering list
10702 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10703 pub filter: std::string::String,
10704
10705 /// Optional. Specify how the results should be sorted. If not specified, the
10706 /// results will be sorted in the default order. For more information, see
10707 /// [Sorting and filtering list
10708 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10709 pub order_by: std::string::String,
10710
10711 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10712}
10713
10714impl ListKeyRingsRequest {
10715 /// Creates a new default instance.
10716 pub fn new() -> Self {
10717 std::default::Default::default()
10718 }
10719
10720 /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
10721 ///
10722 /// # Example
10723 /// ```ignore,no_run
10724 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10725 /// let x = ListKeyRingsRequest::new().set_parent("example");
10726 /// ```
10727 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10728 self.parent = v.into();
10729 self
10730 }
10731
10732 /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
10733 ///
10734 /// # Example
10735 /// ```ignore,no_run
10736 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10737 /// let x = ListKeyRingsRequest::new().set_page_size(42);
10738 /// ```
10739 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10740 self.page_size = v.into();
10741 self
10742 }
10743
10744 /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
10745 ///
10746 /// # Example
10747 /// ```ignore,no_run
10748 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10749 /// let x = ListKeyRingsRequest::new().set_page_token("example");
10750 /// ```
10751 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10752 self.page_token = v.into();
10753 self
10754 }
10755
10756 /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
10757 ///
10758 /// # Example
10759 /// ```ignore,no_run
10760 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10761 /// let x = ListKeyRingsRequest::new().set_filter("example");
10762 /// ```
10763 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10764 self.filter = v.into();
10765 self
10766 }
10767
10768 /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
10769 ///
10770 /// # Example
10771 /// ```ignore,no_run
10772 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10773 /// let x = ListKeyRingsRequest::new().set_order_by("example");
10774 /// ```
10775 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10776 self.order_by = v.into();
10777 self
10778 }
10779}
10780
10781impl wkt::message::Message for ListKeyRingsRequest {
10782 fn typename() -> &'static str {
10783 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
10784 }
10785}
10786
10787/// Request message for
10788/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10789///
10790/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10791#[derive(Clone, Default, PartialEq)]
10792#[non_exhaustive]
10793pub struct ListCryptoKeysRequest {
10794 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10795 /// to list, in the format `projects/*/locations/*/keyRings/*`.
10796 ///
10797 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10798 pub parent: std::string::String,
10799
10800 /// Optional. Optional limit on the number of
10801 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
10802 /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
10803 /// obtained by including the
10804 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
10805 /// in a subsequent request. If unspecified, the server will pick an
10806 /// appropriate default.
10807 ///
10808 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10809 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10810 pub page_size: i32,
10811
10812 /// Optional. Optional pagination token, returned earlier via
10813 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
10814 ///
10815 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10816 pub page_token: std::string::String,
10817
10818 /// The fields of the primary version to include in the response.
10819 pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
10820
10821 /// Optional. Only include resources that match the filter in the response. For
10822 /// more information, see
10823 /// [Sorting and filtering list
10824 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10825 pub filter: std::string::String,
10826
10827 /// Optional. Specify how the results should be sorted. If not specified, the
10828 /// results will be sorted in the default order. For more information, see
10829 /// [Sorting and filtering list
10830 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10831 pub order_by: std::string::String,
10832
10833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10834}
10835
10836impl ListCryptoKeysRequest {
10837 /// Creates a new default instance.
10838 pub fn new() -> Self {
10839 std::default::Default::default()
10840 }
10841
10842 /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
10843 ///
10844 /// # Example
10845 /// ```ignore,no_run
10846 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10847 /// let x = ListCryptoKeysRequest::new().set_parent("example");
10848 /// ```
10849 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10850 self.parent = v.into();
10851 self
10852 }
10853
10854 /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
10855 ///
10856 /// # Example
10857 /// ```ignore,no_run
10858 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10859 /// let x = ListCryptoKeysRequest::new().set_page_size(42);
10860 /// ```
10861 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10862 self.page_size = v.into();
10863 self
10864 }
10865
10866 /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
10867 ///
10868 /// # Example
10869 /// ```ignore,no_run
10870 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10871 /// let x = ListCryptoKeysRequest::new().set_page_token("example");
10872 /// ```
10873 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10874 self.page_token = v.into();
10875 self
10876 }
10877
10878 /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
10879 ///
10880 /// # Example
10881 /// ```ignore,no_run
10882 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10883 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10884 /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
10885 /// ```
10886 pub fn set_version_view<
10887 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10888 >(
10889 mut self,
10890 v: T,
10891 ) -> Self {
10892 self.version_view = v.into();
10893 self
10894 }
10895
10896 /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
10897 ///
10898 /// # Example
10899 /// ```ignore,no_run
10900 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10901 /// let x = ListCryptoKeysRequest::new().set_filter("example");
10902 /// ```
10903 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10904 self.filter = v.into();
10905 self
10906 }
10907
10908 /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
10909 ///
10910 /// # Example
10911 /// ```ignore,no_run
10912 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10913 /// let x = ListCryptoKeysRequest::new().set_order_by("example");
10914 /// ```
10915 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10916 self.order_by = v.into();
10917 self
10918 }
10919}
10920
10921impl wkt::message::Message for ListCryptoKeysRequest {
10922 fn typename() -> &'static str {
10923 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
10924 }
10925}
10926
10927/// Request message for
10928/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
10929///
10930/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
10931#[derive(Clone, Default, PartialEq)]
10932#[non_exhaustive]
10933pub struct ListCryptoKeyVersionsRequest {
10934 /// Required. The resource name of the
10935 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
10936 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10937 ///
10938 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10939 pub parent: std::string::String,
10940
10941 /// Optional. Optional limit on the number of
10942 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
10943 /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
10944 /// can subsequently be obtained by including the
10945 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
10946 /// in a subsequent request. If unspecified, the server will pick an
10947 /// appropriate default.
10948 ///
10949 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10950 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10951 pub page_size: i32,
10952
10953 /// Optional. Optional pagination token, returned earlier via
10954 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
10955 ///
10956 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10957 pub page_token: std::string::String,
10958
10959 /// The fields to include in the response.
10960 pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
10961
10962 /// Optional. Only include resources that match the filter in the response. For
10963 /// more information, see
10964 /// [Sorting and filtering list
10965 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10966 pub filter: std::string::String,
10967
10968 /// Optional. Specify how the results should be sorted. If not specified, the
10969 /// results will be sorted in the default order. For more information, see
10970 /// [Sorting and filtering list
10971 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10972 pub order_by: std::string::String,
10973
10974 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10975}
10976
10977impl ListCryptoKeyVersionsRequest {
10978 /// Creates a new default instance.
10979 pub fn new() -> Self {
10980 std::default::Default::default()
10981 }
10982
10983 /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
10984 ///
10985 /// # Example
10986 /// ```ignore,no_run
10987 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10988 /// let x = ListCryptoKeyVersionsRequest::new().set_parent("example");
10989 /// ```
10990 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10991 self.parent = v.into();
10992 self
10993 }
10994
10995 /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
10996 ///
10997 /// # Example
10998 /// ```ignore,no_run
10999 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11000 /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
11001 /// ```
11002 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11003 self.page_size = v.into();
11004 self
11005 }
11006
11007 /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
11008 ///
11009 /// # Example
11010 /// ```ignore,no_run
11011 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11012 /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
11013 /// ```
11014 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11015 self.page_token = v.into();
11016 self
11017 }
11018
11019 /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
11020 ///
11021 /// # Example
11022 /// ```ignore,no_run
11023 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11024 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
11025 /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
11026 /// ```
11027 pub fn set_view<
11028 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
11029 >(
11030 mut self,
11031 v: T,
11032 ) -> Self {
11033 self.view = v.into();
11034 self
11035 }
11036
11037 /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
11038 ///
11039 /// # Example
11040 /// ```ignore,no_run
11041 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11042 /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
11043 /// ```
11044 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11045 self.filter = v.into();
11046 self
11047 }
11048
11049 /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
11050 ///
11051 /// # Example
11052 /// ```ignore,no_run
11053 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11054 /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
11055 /// ```
11056 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11057 self.order_by = v.into();
11058 self
11059 }
11060}
11061
11062impl wkt::message::Message for ListCryptoKeyVersionsRequest {
11063 fn typename() -> &'static str {
11064 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
11065 }
11066}
11067
11068/// Request message for
11069/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11070///
11071/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11072#[derive(Clone, Default, PartialEq)]
11073#[non_exhaustive]
11074pub struct ListImportJobsRequest {
11075 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
11076 /// to list, in the format `projects/*/locations/*/keyRings/*`.
11077 ///
11078 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11079 pub parent: std::string::String,
11080
11081 /// Optional. Optional limit on the number of
11082 /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
11083 /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
11084 /// obtained by including the
11085 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
11086 /// in a subsequent request. If unspecified, the server will pick an
11087 /// appropriate default.
11088 ///
11089 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11090 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11091 pub page_size: i32,
11092
11093 /// Optional. Optional pagination token, returned earlier via
11094 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
11095 ///
11096 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11097 pub page_token: std::string::String,
11098
11099 /// Optional. Only include resources that match the filter in the response. For
11100 /// more information, see
11101 /// [Sorting and filtering list
11102 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11103 pub filter: std::string::String,
11104
11105 /// Optional. Specify how the results should be sorted. If not specified, the
11106 /// results will be sorted in the default order. For more information, see
11107 /// [Sorting and filtering list
11108 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11109 pub order_by: std::string::String,
11110
11111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11112}
11113
11114impl ListImportJobsRequest {
11115 /// Creates a new default instance.
11116 pub fn new() -> Self {
11117 std::default::Default::default()
11118 }
11119
11120 /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
11121 ///
11122 /// # Example
11123 /// ```ignore,no_run
11124 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11125 /// let x = ListImportJobsRequest::new().set_parent("example");
11126 /// ```
11127 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11128 self.parent = v.into();
11129 self
11130 }
11131
11132 /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
11133 ///
11134 /// # Example
11135 /// ```ignore,no_run
11136 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11137 /// let x = ListImportJobsRequest::new().set_page_size(42);
11138 /// ```
11139 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11140 self.page_size = v.into();
11141 self
11142 }
11143
11144 /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
11145 ///
11146 /// # Example
11147 /// ```ignore,no_run
11148 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11149 /// let x = ListImportJobsRequest::new().set_page_token("example");
11150 /// ```
11151 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11152 self.page_token = v.into();
11153 self
11154 }
11155
11156 /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
11157 ///
11158 /// # Example
11159 /// ```ignore,no_run
11160 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11161 /// let x = ListImportJobsRequest::new().set_filter("example");
11162 /// ```
11163 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11164 self.filter = v.into();
11165 self
11166 }
11167
11168 /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
11169 ///
11170 /// # Example
11171 /// ```ignore,no_run
11172 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11173 /// let x = ListImportJobsRequest::new().set_order_by("example");
11174 /// ```
11175 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11176 self.order_by = v.into();
11177 self
11178 }
11179}
11180
11181impl wkt::message::Message for ListImportJobsRequest {
11182 fn typename() -> &'static str {
11183 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
11184 }
11185}
11186
11187/// Request message for
11188/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11189///
11190/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11191#[derive(Clone, Default, PartialEq)]
11192#[non_exhaustive]
11193pub struct ListRetiredResourcesRequest {
11194 /// Required. The project-specific location holding the
11195 /// [RetiredResources][google.cloud.kms.v1.RetiredResource], in the format
11196 /// `projects/*/locations/*`.
11197 ///
11198 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11199 pub parent: std::string::String,
11200
11201 /// Optional. Optional limit on the number of
11202 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] to be included in
11203 /// the response. Further
11204 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] can subsequently be
11205 /// obtained by including the
11206 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]
11207 /// in a subsequent request. If unspecified, the server will pick an
11208 /// appropriate default.
11209 ///
11210 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11211 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11212 pub page_size: i32,
11213
11214 /// Optional. Optional pagination token, returned earlier via
11215 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token].
11216 ///
11217 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11218 pub page_token: std::string::String,
11219
11220 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11221}
11222
11223impl ListRetiredResourcesRequest {
11224 /// Creates a new default instance.
11225 pub fn new() -> Self {
11226 std::default::Default::default()
11227 }
11228
11229 /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
11230 ///
11231 /// # Example
11232 /// ```ignore,no_run
11233 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11234 /// let x = ListRetiredResourcesRequest::new().set_parent("example");
11235 /// ```
11236 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11237 self.parent = v.into();
11238 self
11239 }
11240
11241 /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
11242 ///
11243 /// # Example
11244 /// ```ignore,no_run
11245 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11246 /// let x = ListRetiredResourcesRequest::new().set_page_size(42);
11247 /// ```
11248 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11249 self.page_size = v.into();
11250 self
11251 }
11252
11253 /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
11254 ///
11255 /// # Example
11256 /// ```ignore,no_run
11257 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11258 /// let x = ListRetiredResourcesRequest::new().set_page_token("example");
11259 /// ```
11260 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11261 self.page_token = v.into();
11262 self
11263 }
11264}
11265
11266impl wkt::message::Message for ListRetiredResourcesRequest {
11267 fn typename() -> &'static str {
11268 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesRequest"
11269 }
11270}
11271
11272/// Response message for
11273/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
11274///
11275/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
11276#[derive(Clone, Default, PartialEq)]
11277#[non_exhaustive]
11278pub struct ListKeyRingsResponse {
11279 /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
11280 ///
11281 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11282 pub key_rings: std::vec::Vec<crate::model::KeyRing>,
11283
11284 /// A token to retrieve next page of results. Pass this value in
11285 /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
11286 /// to retrieve the next page of results.
11287 ///
11288 /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
11289 pub next_page_token: std::string::String,
11290
11291 /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
11292 /// the query.
11293 ///
11294 /// This field is not populated if
11295 /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
11296 /// is applied.
11297 ///
11298 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11299 /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
11300 pub total_size: i32,
11301
11302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11303}
11304
11305impl ListKeyRingsResponse {
11306 /// Creates a new default instance.
11307 pub fn new() -> Self {
11308 std::default::Default::default()
11309 }
11310
11311 /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
11312 ///
11313 /// # Example
11314 /// ```ignore,no_run
11315 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11316 /// use google_cloud_kms_v1::model::KeyRing;
11317 /// let x = ListKeyRingsResponse::new()
11318 /// .set_key_rings([
11319 /// KeyRing::default()/* use setters */,
11320 /// KeyRing::default()/* use (different) setters */,
11321 /// ]);
11322 /// ```
11323 pub fn set_key_rings<T, V>(mut self, v: T) -> Self
11324 where
11325 T: std::iter::IntoIterator<Item = V>,
11326 V: std::convert::Into<crate::model::KeyRing>,
11327 {
11328 use std::iter::Iterator;
11329 self.key_rings = v.into_iter().map(|i| i.into()).collect();
11330 self
11331 }
11332
11333 /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
11334 ///
11335 /// # Example
11336 /// ```ignore,no_run
11337 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11338 /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
11339 /// ```
11340 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11341 self.next_page_token = v.into();
11342 self
11343 }
11344
11345 /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
11346 ///
11347 /// # Example
11348 /// ```ignore,no_run
11349 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11350 /// let x = ListKeyRingsResponse::new().set_total_size(42);
11351 /// ```
11352 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11353 self.total_size = v.into();
11354 self
11355 }
11356}
11357
11358impl wkt::message::Message for ListKeyRingsResponse {
11359 fn typename() -> &'static str {
11360 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
11361 }
11362}
11363
11364#[doc(hidden)]
11365impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
11366 type PageItem = crate::model::KeyRing;
11367
11368 fn items(self) -> std::vec::Vec<Self::PageItem> {
11369 self.key_rings
11370 }
11371
11372 fn next_page_token(&self) -> std::string::String {
11373 use std::clone::Clone;
11374 self.next_page_token.clone()
11375 }
11376}
11377
11378/// Response message for
11379/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11380///
11381/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11382#[derive(Clone, Default, PartialEq)]
11383#[non_exhaustive]
11384pub struct ListCryptoKeysResponse {
11385 /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11386 ///
11387 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11388 pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
11389
11390 /// A token to retrieve next page of results. Pass this value in
11391 /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
11392 /// to retrieve the next page of results.
11393 ///
11394 /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
11395 pub next_page_token: std::string::String,
11396
11397 /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
11398 /// matched the query.
11399 ///
11400 /// This field is not populated if
11401 /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
11402 /// is applied.
11403 ///
11404 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11405 /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
11406 pub total_size: i32,
11407
11408 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11409}
11410
11411impl ListCryptoKeysResponse {
11412 /// Creates a new default instance.
11413 pub fn new() -> Self {
11414 std::default::Default::default()
11415 }
11416
11417 /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
11418 ///
11419 /// # Example
11420 /// ```ignore,no_run
11421 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11422 /// use google_cloud_kms_v1::model::CryptoKey;
11423 /// let x = ListCryptoKeysResponse::new()
11424 /// .set_crypto_keys([
11425 /// CryptoKey::default()/* use setters */,
11426 /// CryptoKey::default()/* use (different) setters */,
11427 /// ]);
11428 /// ```
11429 pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
11430 where
11431 T: std::iter::IntoIterator<Item = V>,
11432 V: std::convert::Into<crate::model::CryptoKey>,
11433 {
11434 use std::iter::Iterator;
11435 self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
11436 self
11437 }
11438
11439 /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
11440 ///
11441 /// # Example
11442 /// ```ignore,no_run
11443 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11444 /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
11445 /// ```
11446 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11447 self.next_page_token = v.into();
11448 self
11449 }
11450
11451 /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
11452 ///
11453 /// # Example
11454 /// ```ignore,no_run
11455 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11456 /// let x = ListCryptoKeysResponse::new().set_total_size(42);
11457 /// ```
11458 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11459 self.total_size = v.into();
11460 self
11461 }
11462}
11463
11464impl wkt::message::Message for ListCryptoKeysResponse {
11465 fn typename() -> &'static str {
11466 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
11467 }
11468}
11469
11470#[doc(hidden)]
11471impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
11472 type PageItem = crate::model::CryptoKey;
11473
11474 fn items(self) -> std::vec::Vec<Self::PageItem> {
11475 self.crypto_keys
11476 }
11477
11478 fn next_page_token(&self) -> std::string::String {
11479 use std::clone::Clone;
11480 self.next_page_token.clone()
11481 }
11482}
11483
11484/// Response message for
11485/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11486///
11487/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11488#[derive(Clone, Default, PartialEq)]
11489#[non_exhaustive]
11490pub struct ListCryptoKeyVersionsResponse {
11491 /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11492 ///
11493 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11494 pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
11495
11496 /// A token to retrieve next page of results. Pass this value in
11497 /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
11498 /// to retrieve the next page of results.
11499 ///
11500 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
11501 pub next_page_token: std::string::String,
11502
11503 /// The total number of
11504 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
11505 /// query.
11506 ///
11507 /// This field is not populated if
11508 /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
11509 /// is applied.
11510 ///
11511 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11512 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
11513 pub total_size: i32,
11514
11515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11516}
11517
11518impl ListCryptoKeyVersionsResponse {
11519 /// Creates a new default instance.
11520 pub fn new() -> Self {
11521 std::default::Default::default()
11522 }
11523
11524 /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
11525 ///
11526 /// # Example
11527 /// ```ignore,no_run
11528 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11529 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11530 /// let x = ListCryptoKeyVersionsResponse::new()
11531 /// .set_crypto_key_versions([
11532 /// CryptoKeyVersion::default()/* use setters */,
11533 /// CryptoKeyVersion::default()/* use (different) setters */,
11534 /// ]);
11535 /// ```
11536 pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
11537 where
11538 T: std::iter::IntoIterator<Item = V>,
11539 V: std::convert::Into<crate::model::CryptoKeyVersion>,
11540 {
11541 use std::iter::Iterator;
11542 self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
11543 self
11544 }
11545
11546 /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
11547 ///
11548 /// # Example
11549 /// ```ignore,no_run
11550 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11551 /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
11552 /// ```
11553 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11554 self.next_page_token = v.into();
11555 self
11556 }
11557
11558 /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
11559 ///
11560 /// # Example
11561 /// ```ignore,no_run
11562 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11563 /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
11564 /// ```
11565 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11566 self.total_size = v.into();
11567 self
11568 }
11569}
11570
11571impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11572 fn typename() -> &'static str {
11573 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11574 }
11575}
11576
11577#[doc(hidden)]
11578impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11579 type PageItem = crate::model::CryptoKeyVersion;
11580
11581 fn items(self) -> std::vec::Vec<Self::PageItem> {
11582 self.crypto_key_versions
11583 }
11584
11585 fn next_page_token(&self) -> std::string::String {
11586 use std::clone::Clone;
11587 self.next_page_token.clone()
11588 }
11589}
11590
11591/// Response message for
11592/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11593///
11594/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11595#[derive(Clone, Default, PartialEq)]
11596#[non_exhaustive]
11597pub struct ListImportJobsResponse {
11598 /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11599 ///
11600 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11601 pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
11602
11603 /// A token to retrieve next page of results. Pass this value in
11604 /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
11605 /// to retrieve the next page of results.
11606 ///
11607 /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
11608 pub next_page_token: std::string::String,
11609
11610 /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
11611 /// matched the query.
11612 ///
11613 /// This field is not populated if
11614 /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
11615 /// is applied.
11616 ///
11617 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11618 /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
11619 pub total_size: i32,
11620
11621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11622}
11623
11624impl ListImportJobsResponse {
11625 /// Creates a new default instance.
11626 pub fn new() -> Self {
11627 std::default::Default::default()
11628 }
11629
11630 /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
11631 ///
11632 /// # Example
11633 /// ```ignore,no_run
11634 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11635 /// use google_cloud_kms_v1::model::ImportJob;
11636 /// let x = ListImportJobsResponse::new()
11637 /// .set_import_jobs([
11638 /// ImportJob::default()/* use setters */,
11639 /// ImportJob::default()/* use (different) setters */,
11640 /// ]);
11641 /// ```
11642 pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
11643 where
11644 T: std::iter::IntoIterator<Item = V>,
11645 V: std::convert::Into<crate::model::ImportJob>,
11646 {
11647 use std::iter::Iterator;
11648 self.import_jobs = v.into_iter().map(|i| i.into()).collect();
11649 self
11650 }
11651
11652 /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
11653 ///
11654 /// # Example
11655 /// ```ignore,no_run
11656 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11657 /// let x = ListImportJobsResponse::new().set_next_page_token("example");
11658 /// ```
11659 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11660 self.next_page_token = v.into();
11661 self
11662 }
11663
11664 /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
11665 ///
11666 /// # Example
11667 /// ```ignore,no_run
11668 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11669 /// let x = ListImportJobsResponse::new().set_total_size(42);
11670 /// ```
11671 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11672 self.total_size = v.into();
11673 self
11674 }
11675}
11676
11677impl wkt::message::Message for ListImportJobsResponse {
11678 fn typename() -> &'static str {
11679 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
11680 }
11681}
11682
11683#[doc(hidden)]
11684impl google_cloud_gax::paginator::internal::PageableResponse for ListImportJobsResponse {
11685 type PageItem = crate::model::ImportJob;
11686
11687 fn items(self) -> std::vec::Vec<Self::PageItem> {
11688 self.import_jobs
11689 }
11690
11691 fn next_page_token(&self) -> std::string::String {
11692 use std::clone::Clone;
11693 self.next_page_token.clone()
11694 }
11695}
11696
11697/// Response message for
11698/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11699///
11700/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11701#[derive(Clone, Default, PartialEq)]
11702#[non_exhaustive]
11703pub struct ListRetiredResourcesResponse {
11704 /// The list of [RetiredResources][google.cloud.kms.v1.RetiredResource].
11705 ///
11706 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11707 pub retired_resources: std::vec::Vec<crate::model::RetiredResource>,
11708
11709 /// A token to retrieve the next page of results. Pass this value in
11710 /// [ListRetiredResourcesRequest.page_token][google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]
11711 /// to retrieve the next page of results.
11712 ///
11713 /// [google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]: crate::model::ListRetiredResourcesRequest::page_token
11714 pub next_page_token: std::string::String,
11715
11716 /// The total number of [RetiredResources][google.cloud.kms.v1.RetiredResource]
11717 /// that matched the query.
11718 ///
11719 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11720 pub total_size: i64,
11721
11722 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11723}
11724
11725impl ListRetiredResourcesResponse {
11726 /// Creates a new default instance.
11727 pub fn new() -> Self {
11728 std::default::Default::default()
11729 }
11730
11731 /// Sets the value of [retired_resources][crate::model::ListRetiredResourcesResponse::retired_resources].
11732 ///
11733 /// # Example
11734 /// ```ignore,no_run
11735 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11736 /// use google_cloud_kms_v1::model::RetiredResource;
11737 /// let x = ListRetiredResourcesResponse::new()
11738 /// .set_retired_resources([
11739 /// RetiredResource::default()/* use setters */,
11740 /// RetiredResource::default()/* use (different) setters */,
11741 /// ]);
11742 /// ```
11743 pub fn set_retired_resources<T, V>(mut self, v: T) -> Self
11744 where
11745 T: std::iter::IntoIterator<Item = V>,
11746 V: std::convert::Into<crate::model::RetiredResource>,
11747 {
11748 use std::iter::Iterator;
11749 self.retired_resources = v.into_iter().map(|i| i.into()).collect();
11750 self
11751 }
11752
11753 /// Sets the value of [next_page_token][crate::model::ListRetiredResourcesResponse::next_page_token].
11754 ///
11755 /// # Example
11756 /// ```ignore,no_run
11757 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11758 /// let x = ListRetiredResourcesResponse::new().set_next_page_token("example");
11759 /// ```
11760 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11761 self.next_page_token = v.into();
11762 self
11763 }
11764
11765 /// Sets the value of [total_size][crate::model::ListRetiredResourcesResponse::total_size].
11766 ///
11767 /// # Example
11768 /// ```ignore,no_run
11769 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11770 /// let x = ListRetiredResourcesResponse::new().set_total_size(42);
11771 /// ```
11772 pub fn set_total_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11773 self.total_size = v.into();
11774 self
11775 }
11776}
11777
11778impl wkt::message::Message for ListRetiredResourcesResponse {
11779 fn typename() -> &'static str {
11780 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesResponse"
11781 }
11782}
11783
11784#[doc(hidden)]
11785impl google_cloud_gax::paginator::internal::PageableResponse for ListRetiredResourcesResponse {
11786 type PageItem = crate::model::RetiredResource;
11787
11788 fn items(self) -> std::vec::Vec<Self::PageItem> {
11789 self.retired_resources
11790 }
11791
11792 fn next_page_token(&self) -> std::string::String {
11793 use std::clone::Clone;
11794 self.next_page_token.clone()
11795 }
11796}
11797
11798/// Request message for
11799/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
11800///
11801/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
11802#[derive(Clone, Default, PartialEq)]
11803#[non_exhaustive]
11804pub struct GetKeyRingRequest {
11805 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
11806 /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
11807 ///
11808 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11809 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11810 pub name: std::string::String,
11811
11812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11813}
11814
11815impl GetKeyRingRequest {
11816 /// Creates a new default instance.
11817 pub fn new() -> Self {
11818 std::default::Default::default()
11819 }
11820
11821 /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
11822 ///
11823 /// # Example
11824 /// ```ignore,no_run
11825 /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
11826 /// let x = GetKeyRingRequest::new().set_name("example");
11827 /// ```
11828 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11829 self.name = v.into();
11830 self
11831 }
11832}
11833
11834impl wkt::message::Message for GetKeyRingRequest {
11835 fn typename() -> &'static str {
11836 "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
11837 }
11838}
11839
11840/// Request message for
11841/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
11842///
11843/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
11844#[derive(Clone, Default, PartialEq)]
11845#[non_exhaustive]
11846pub struct GetCryptoKeyRequest {
11847 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11848 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
11849 ///
11850 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11851 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11852 pub name: std::string::String,
11853
11854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11855}
11856
11857impl GetCryptoKeyRequest {
11858 /// Creates a new default instance.
11859 pub fn new() -> Self {
11860 std::default::Default::default()
11861 }
11862
11863 /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
11864 ///
11865 /// # Example
11866 /// ```ignore,no_run
11867 /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
11868 /// let x = GetCryptoKeyRequest::new().set_name("example");
11869 /// ```
11870 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11871 self.name = v.into();
11872 self
11873 }
11874}
11875
11876impl wkt::message::Message for GetCryptoKeyRequest {
11877 fn typename() -> &'static str {
11878 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
11879 }
11880}
11881
11882/// Request message for
11883/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
11884///
11885/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
11886#[derive(Clone, Default, PartialEq)]
11887#[non_exhaustive]
11888pub struct GetCryptoKeyVersionRequest {
11889 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11890 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
11891 ///
11892 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11893 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11894 pub name: std::string::String,
11895
11896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11897}
11898
11899impl GetCryptoKeyVersionRequest {
11900 /// Creates a new default instance.
11901 pub fn new() -> Self {
11902 std::default::Default::default()
11903 }
11904
11905 /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
11906 ///
11907 /// # Example
11908 /// ```ignore,no_run
11909 /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
11910 /// let x = GetCryptoKeyVersionRequest::new().set_name("example");
11911 /// ```
11912 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11913 self.name = v.into();
11914 self
11915 }
11916}
11917
11918impl wkt::message::Message for GetCryptoKeyVersionRequest {
11919 fn typename() -> &'static str {
11920 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
11921 }
11922}
11923
11924/// Request message for
11925/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
11926///
11927/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
11928#[derive(Clone, Default, PartialEq)]
11929#[non_exhaustive]
11930pub struct GetPublicKeyRequest {
11931 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11932 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
11933 ///
11934 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11935 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11936 pub name: std::string::String,
11937
11938 /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
11939 /// by the user. This field is required for PQC algorithms. If specified, the
11940 /// public key will be exported through the
11941 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
11942 /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
11943 /// field will be populated for non-PQC algorithms, and an error will be
11944 /// returned for PQC algorithms.
11945 ///
11946 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
11947 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
11948 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
11949 pub public_key_format: crate::model::public_key::PublicKeyFormat,
11950
11951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11952}
11953
11954impl GetPublicKeyRequest {
11955 /// Creates a new default instance.
11956 pub fn new() -> Self {
11957 std::default::Default::default()
11958 }
11959
11960 /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
11961 ///
11962 /// # Example
11963 /// ```ignore,no_run
11964 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11965 /// let x = GetPublicKeyRequest::new().set_name("example");
11966 /// ```
11967 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11968 self.name = v.into();
11969 self
11970 }
11971
11972 /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
11973 ///
11974 /// # Example
11975 /// ```ignore,no_run
11976 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11977 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
11978 /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
11979 /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
11980 /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
11981 /// ```
11982 pub fn set_public_key_format<
11983 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
11984 >(
11985 mut self,
11986 v: T,
11987 ) -> Self {
11988 self.public_key_format = v.into();
11989 self
11990 }
11991}
11992
11993impl wkt::message::Message for GetPublicKeyRequest {
11994 fn typename() -> &'static str {
11995 "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
11996 }
11997}
11998
11999/// Request message for
12000/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
12001///
12002/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
12003#[derive(Clone, Default, PartialEq)]
12004#[non_exhaustive]
12005pub struct GetImportJobRequest {
12006 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12007 /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
12008 ///
12009 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12010 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12011 pub name: std::string::String,
12012
12013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12014}
12015
12016impl GetImportJobRequest {
12017 /// Creates a new default instance.
12018 pub fn new() -> Self {
12019 std::default::Default::default()
12020 }
12021
12022 /// Sets the value of [name][crate::model::GetImportJobRequest::name].
12023 ///
12024 /// # Example
12025 /// ```ignore,no_run
12026 /// # use google_cloud_kms_v1::model::GetImportJobRequest;
12027 /// let x = GetImportJobRequest::new().set_name("example");
12028 /// ```
12029 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12030 self.name = v.into();
12031 self
12032 }
12033}
12034
12035impl wkt::message::Message for GetImportJobRequest {
12036 fn typename() -> &'static str {
12037 "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
12038 }
12039}
12040
12041/// Request message for
12042/// [KeyManagementService.GetRetiredResource][google.cloud.kms.v1.KeyManagementService.GetRetiredResource].
12043///
12044/// [google.cloud.kms.v1.KeyManagementService.GetRetiredResource]: crate::client::KeyManagementService::get_retired_resource
12045#[derive(Clone, Default, PartialEq)]
12046#[non_exhaustive]
12047pub struct GetRetiredResourceRequest {
12048 /// Required. The [name][google.cloud.kms.v1.RetiredResource.name] of the
12049 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] to get.
12050 ///
12051 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
12052 /// [google.cloud.kms.v1.RetiredResource.name]: crate::model::RetiredResource::name
12053 pub name: std::string::String,
12054
12055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12056}
12057
12058impl GetRetiredResourceRequest {
12059 /// Creates a new default instance.
12060 pub fn new() -> Self {
12061 std::default::Default::default()
12062 }
12063
12064 /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
12065 ///
12066 /// # Example
12067 /// ```ignore,no_run
12068 /// # use google_cloud_kms_v1::model::GetRetiredResourceRequest;
12069 /// let x = GetRetiredResourceRequest::new().set_name("example");
12070 /// ```
12071 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12072 self.name = v.into();
12073 self
12074 }
12075}
12076
12077impl wkt::message::Message for GetRetiredResourceRequest {
12078 fn typename() -> &'static str {
12079 "type.googleapis.com/google.cloud.kms.v1.GetRetiredResourceRequest"
12080 }
12081}
12082
12083/// Request message for
12084/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
12085///
12086/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
12087#[derive(Clone, Default, PartialEq)]
12088#[non_exhaustive]
12089pub struct CreateKeyRingRequest {
12090 /// Required. The resource name of the location associated with the
12091 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
12092 /// `projects/*/locations/*`.
12093 ///
12094 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12095 pub parent: std::string::String,
12096
12097 /// Required. It must be unique within a location and match the regular
12098 /// expression `[a-zA-Z0-9_-]{1,63}`
12099 pub key_ring_id: std::string::String,
12100
12101 /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
12102 /// values.
12103 ///
12104 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12105 pub key_ring: std::option::Option<crate::model::KeyRing>,
12106
12107 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12108}
12109
12110impl CreateKeyRingRequest {
12111 /// Creates a new default instance.
12112 pub fn new() -> Self {
12113 std::default::Default::default()
12114 }
12115
12116 /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
12117 ///
12118 /// # Example
12119 /// ```ignore,no_run
12120 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12121 /// let x = CreateKeyRingRequest::new().set_parent("example");
12122 /// ```
12123 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12124 self.parent = v.into();
12125 self
12126 }
12127
12128 /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
12129 ///
12130 /// # Example
12131 /// ```ignore,no_run
12132 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12133 /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
12134 /// ```
12135 pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12136 self.key_ring_id = v.into();
12137 self
12138 }
12139
12140 /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12141 ///
12142 /// # Example
12143 /// ```ignore,no_run
12144 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12145 /// use google_cloud_kms_v1::model::KeyRing;
12146 /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
12147 /// ```
12148 pub fn set_key_ring<T>(mut self, v: T) -> Self
12149 where
12150 T: std::convert::Into<crate::model::KeyRing>,
12151 {
12152 self.key_ring = std::option::Option::Some(v.into());
12153 self
12154 }
12155
12156 /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12157 ///
12158 /// # Example
12159 /// ```ignore,no_run
12160 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12161 /// use google_cloud_kms_v1::model::KeyRing;
12162 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
12163 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
12164 /// ```
12165 pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
12166 where
12167 T: std::convert::Into<crate::model::KeyRing>,
12168 {
12169 self.key_ring = v.map(|x| x.into());
12170 self
12171 }
12172}
12173
12174impl wkt::message::Message for CreateKeyRingRequest {
12175 fn typename() -> &'static str {
12176 "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
12177 }
12178}
12179
12180/// Request message for
12181/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
12182///
12183/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
12184#[derive(Clone, Default, PartialEq)]
12185#[non_exhaustive]
12186pub struct CreateCryptoKeyRequest {
12187 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
12188 /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
12189 ///
12190 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12191 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12192 pub parent: std::string::String,
12193
12194 /// Required. It must be unique within a KeyRing and match the regular
12195 /// expression `[a-zA-Z0-9_-]{1,63}`
12196 pub crypto_key_id: std::string::String,
12197
12198 /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
12199 /// values.
12200 ///
12201 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12202 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12203
12204 /// If set to true, the request will create a
12205 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
12206 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
12207 /// manually call
12208 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
12209 /// or
12210 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
12211 /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
12212 ///
12213 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12214 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12215 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12216 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12217 pub skip_initial_version_creation: bool,
12218
12219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12220}
12221
12222impl CreateCryptoKeyRequest {
12223 /// Creates a new default instance.
12224 pub fn new() -> Self {
12225 std::default::Default::default()
12226 }
12227
12228 /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
12229 ///
12230 /// # Example
12231 /// ```ignore,no_run
12232 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12233 /// let x = CreateCryptoKeyRequest::new().set_parent("example");
12234 /// ```
12235 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12236 self.parent = v.into();
12237 self
12238 }
12239
12240 /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
12241 ///
12242 /// # Example
12243 /// ```ignore,no_run
12244 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12245 /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
12246 /// ```
12247 pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12248 self.crypto_key_id = v.into();
12249 self
12250 }
12251
12252 /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12253 ///
12254 /// # Example
12255 /// ```ignore,no_run
12256 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12257 /// use google_cloud_kms_v1::model::CryptoKey;
12258 /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12259 /// ```
12260 pub fn set_crypto_key<T>(mut self, v: T) -> Self
12261 where
12262 T: std::convert::Into<crate::model::CryptoKey>,
12263 {
12264 self.crypto_key = std::option::Option::Some(v.into());
12265 self
12266 }
12267
12268 /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12269 ///
12270 /// # Example
12271 /// ```ignore,no_run
12272 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12273 /// use google_cloud_kms_v1::model::CryptoKey;
12274 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12275 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12276 /// ```
12277 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12278 where
12279 T: std::convert::Into<crate::model::CryptoKey>,
12280 {
12281 self.crypto_key = v.map(|x| x.into());
12282 self
12283 }
12284
12285 /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
12286 ///
12287 /// # Example
12288 /// ```ignore,no_run
12289 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12290 /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
12291 /// ```
12292 pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12293 self.skip_initial_version_creation = v.into();
12294 self
12295 }
12296}
12297
12298impl wkt::message::Message for CreateCryptoKeyRequest {
12299 fn typename() -> &'static str {
12300 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
12301 }
12302}
12303
12304/// Request message for
12305/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
12306///
12307/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12308#[derive(Clone, Default, PartialEq)]
12309#[non_exhaustive]
12310pub struct CreateCryptoKeyVersionRequest {
12311 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12312 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
12313 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
12314 ///
12315 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12316 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12317 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12318 pub parent: std::string::String,
12319
12320 /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12321 /// initial field values.
12322 ///
12323 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12324 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12325
12326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12327}
12328
12329impl CreateCryptoKeyVersionRequest {
12330 /// Creates a new default instance.
12331 pub fn new() -> Self {
12332 std::default::Default::default()
12333 }
12334
12335 /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
12336 ///
12337 /// # Example
12338 /// ```ignore,no_run
12339 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12340 /// let x = CreateCryptoKeyVersionRequest::new().set_parent("example");
12341 /// ```
12342 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12343 self.parent = v.into();
12344 self
12345 }
12346
12347 /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12348 ///
12349 /// # Example
12350 /// ```ignore,no_run
12351 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12352 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12353 /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12354 /// ```
12355 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12356 where
12357 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12358 {
12359 self.crypto_key_version = std::option::Option::Some(v.into());
12360 self
12361 }
12362
12363 /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12364 ///
12365 /// # Example
12366 /// ```ignore,no_run
12367 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12368 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12369 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12370 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12371 /// ```
12372 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12373 where
12374 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12375 {
12376 self.crypto_key_version = v.map(|x| x.into());
12377 self
12378 }
12379}
12380
12381impl wkt::message::Message for CreateCryptoKeyVersionRequest {
12382 fn typename() -> &'static str {
12383 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
12384 }
12385}
12386
12387/// Request message for
12388/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey].
12389///
12390/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
12391#[derive(Clone, Default, PartialEq)]
12392#[non_exhaustive]
12393pub struct DeleteCryptoKeyRequest {
12394 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12395 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to delete.
12396 ///
12397 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12398 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12399 pub name: std::string::String,
12400
12401 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12402}
12403
12404impl DeleteCryptoKeyRequest {
12405 /// Creates a new default instance.
12406 pub fn new() -> Self {
12407 std::default::Default::default()
12408 }
12409
12410 /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
12411 ///
12412 /// # Example
12413 /// ```ignore,no_run
12414 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyRequest;
12415 /// let x = DeleteCryptoKeyRequest::new().set_name("example");
12416 /// ```
12417 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12418 self.name = v.into();
12419 self
12420 }
12421}
12422
12423impl wkt::message::Message for DeleteCryptoKeyRequest {
12424 fn typename() -> &'static str {
12425 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyRequest"
12426 }
12427}
12428
12429/// Request message for
12430/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion].
12431///
12432/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
12433#[derive(Clone, Default, PartialEq)]
12434#[non_exhaustive]
12435pub struct DeleteCryptoKeyVersionRequest {
12436 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12437 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to delete.
12438 ///
12439 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12440 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12441 pub name: std::string::String,
12442
12443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12444}
12445
12446impl DeleteCryptoKeyVersionRequest {
12447 /// Creates a new default instance.
12448 pub fn new() -> Self {
12449 std::default::Default::default()
12450 }
12451
12452 /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
12453 ///
12454 /// # Example
12455 /// ```ignore,no_run
12456 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyVersionRequest;
12457 /// let x = DeleteCryptoKeyVersionRequest::new().set_name("example");
12458 /// ```
12459 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12460 self.name = v.into();
12461 self
12462 }
12463}
12464
12465impl wkt::message::Message for DeleteCryptoKeyVersionRequest {
12466 fn typename() -> &'static str {
12467 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionRequest"
12468 }
12469}
12470
12471/// Request message for
12472/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
12473///
12474/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12475#[derive(Clone, Default, PartialEq)]
12476#[non_exhaustive]
12477pub struct ImportCryptoKeyVersionRequest {
12478 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12479 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
12480 ///
12481 /// The create permission is only required on this key when creating a new
12482 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
12483 ///
12484 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12485 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12486 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12487 pub parent: std::string::String,
12488
12489 /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
12490 /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
12491 /// target for an import operation. If this field is not present, a new
12492 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
12493 /// supplied key material is created.
12494 ///
12495 /// If this field is present, the supplied key material is imported into
12496 /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
12497 /// import into an existing
12498 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
12499 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
12500 /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
12501 /// have been previously created via
12502 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
12503 /// and be in
12504 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
12505 /// or
12506 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
12507 /// state. The key material and algorithm must match the previous
12508 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
12509 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
12510 /// key material.
12511 ///
12512 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12513 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
12514 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
12515 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12516 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
12517 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12518 pub crypto_key_version: std::string::String,
12519
12520 /// Required. The
12521 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
12522 /// of the key being imported. This does not need to match the
12523 /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
12524 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
12525 ///
12526 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12527 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
12528 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
12529 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
12530
12531 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12532 /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
12533 /// material.
12534 ///
12535 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12536 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12537 pub import_job: std::string::String,
12538
12539 /// Optional. The wrapped key material to import.
12540 ///
12541 /// Before wrapping, key material must be formatted. If importing symmetric key
12542 /// material, the expected key material format is plain bytes. If importing
12543 /// asymmetric key material, the expected key material format is PKCS#8-encoded
12544 /// DER (the PrivateKeyInfo structure from RFC 5208).
12545 ///
12546 /// When wrapping with import methods
12547 /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
12548 /// or
12549 /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
12550 /// or
12551 /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
12552 /// or
12553 /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
12554 ///
12555 /// this field must contain the concatenation of:
12556 ///
12557 /// This format is the same as the format produced by PKCS#11 mechanism
12558 /// CKM_RSA_AES_KEY_WRAP.
12559 ///
12560 /// When wrapping with import methods
12561 /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
12562 /// or
12563 /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
12564 ///
12565 /// this field must contain the formatted key to be imported, wrapped with the
12566 /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
12567 /// with SHA-256, MGF1 with SHA-256, and an empty label.
12568 ///
12569 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
12570 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
12571 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
12572 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
12573 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
12574 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
12575 /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
12576 pub wrapped_key: ::bytes::Bytes,
12577
12578 /// This field is legacy. Use the field
12579 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12580 /// instead.
12581 ///
12582 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12583 pub wrapped_key_material:
12584 std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
12585
12586 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12587}
12588
12589impl ImportCryptoKeyVersionRequest {
12590 /// Creates a new default instance.
12591 pub fn new() -> Self {
12592 std::default::Default::default()
12593 }
12594
12595 /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
12596 ///
12597 /// # Example
12598 /// ```ignore,no_run
12599 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12600 /// let x = ImportCryptoKeyVersionRequest::new().set_parent("example");
12601 /// ```
12602 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12603 self.parent = v.into();
12604 self
12605 }
12606
12607 /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
12608 ///
12609 /// # Example
12610 /// ```ignore,no_run
12611 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12612 /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version("example");
12613 /// ```
12614 pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
12615 mut self,
12616 v: T,
12617 ) -> Self {
12618 self.crypto_key_version = v.into();
12619 self
12620 }
12621
12622 /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
12623 ///
12624 /// # Example
12625 /// ```ignore,no_run
12626 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12627 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
12628 /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
12629 /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
12630 /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
12631 /// ```
12632 pub fn set_algorithm<
12633 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
12634 >(
12635 mut self,
12636 v: T,
12637 ) -> Self {
12638 self.algorithm = v.into();
12639 self
12640 }
12641
12642 /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
12643 ///
12644 /// # Example
12645 /// ```ignore,no_run
12646 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12647 /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
12648 /// ```
12649 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12650 self.import_job = v.into();
12651 self
12652 }
12653
12654 /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
12655 ///
12656 /// # Example
12657 /// ```ignore,no_run
12658 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12659 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
12660 /// ```
12661 pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12662 self.wrapped_key = v.into();
12663 self
12664 }
12665
12666 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
12667 ///
12668 /// Note that all the setters affecting `wrapped_key_material` are mutually
12669 /// exclusive.
12670 ///
12671 /// # Example
12672 /// ```ignore,no_run
12673 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12674 /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
12675 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
12676 /// ```
12677 pub fn set_wrapped_key_material<
12678 T: std::convert::Into<
12679 std::option::Option<
12680 crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
12681 >,
12682 >,
12683 >(
12684 mut self,
12685 v: T,
12686 ) -> Self {
12687 self.wrapped_key_material = v.into();
12688 self
12689 }
12690
12691 /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12692 /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
12693 /// holds a different branch.
12694 pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
12695 #[allow(unreachable_patterns)]
12696 self.wrapped_key_material.as_ref().and_then(|v| match v {
12697 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
12698 _ => std::option::Option::None,
12699 })
12700 }
12701
12702 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12703 /// to hold a `RsaAesWrappedKey`.
12704 ///
12705 /// Note that all the setters affecting `wrapped_key_material` are
12706 /// mutually exclusive.
12707 ///
12708 /// # Example
12709 /// ```ignore,no_run
12710 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12711 /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
12712 /// assert!(x.rsa_aes_wrapped_key().is_some());
12713 /// ```
12714 pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12715 self.wrapped_key_material = std::option::Option::Some(
12716 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
12717 v.into(),
12718 ),
12719 );
12720 self
12721 }
12722}
12723
12724impl wkt::message::Message for ImportCryptoKeyVersionRequest {
12725 fn typename() -> &'static str {
12726 "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
12727 }
12728}
12729
12730/// Defines additional types related to [ImportCryptoKeyVersionRequest].
12731pub mod import_crypto_key_version_request {
12732 #[allow(unused_imports)]
12733 use super::*;
12734
12735 /// This field is legacy. Use the field
12736 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12737 /// instead.
12738 ///
12739 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12740 #[derive(Clone, Debug, PartialEq)]
12741 #[non_exhaustive]
12742 pub enum WrappedKeyMaterial {
12743 /// Optional. This field has the same meaning as
12744 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
12745 /// Prefer to use that field in new work. Either that field or this field
12746 /// (but not both) must be specified.
12747 ///
12748 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12749 RsaAesWrappedKey(::bytes::Bytes),
12750 }
12751}
12752
12753/// Request message for
12754/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
12755///
12756/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
12757#[derive(Clone, Default, PartialEq)]
12758#[non_exhaustive]
12759pub struct CreateImportJobRequest {
12760 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
12761 /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
12762 /// [ImportJobs][google.cloud.kms.v1.ImportJob].
12763 ///
12764 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12765 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12766 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12767 pub parent: std::string::String,
12768
12769 /// Required. It must be unique within a KeyRing and match the regular
12770 /// expression `[a-zA-Z0-9_-]{1,63}`
12771 pub import_job_id: std::string::String,
12772
12773 /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
12774 /// values.
12775 ///
12776 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12777 pub import_job: std::option::Option<crate::model::ImportJob>,
12778
12779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12780}
12781
12782impl CreateImportJobRequest {
12783 /// Creates a new default instance.
12784 pub fn new() -> Self {
12785 std::default::Default::default()
12786 }
12787
12788 /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
12789 ///
12790 /// # Example
12791 /// ```ignore,no_run
12792 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12793 /// let x = CreateImportJobRequest::new().set_parent("example");
12794 /// ```
12795 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12796 self.parent = v.into();
12797 self
12798 }
12799
12800 /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
12801 ///
12802 /// # Example
12803 /// ```ignore,no_run
12804 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12805 /// let x = CreateImportJobRequest::new().set_import_job_id("example");
12806 /// ```
12807 pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12808 self.import_job_id = v.into();
12809 self
12810 }
12811
12812 /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12813 ///
12814 /// # Example
12815 /// ```ignore,no_run
12816 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12817 /// use google_cloud_kms_v1::model::ImportJob;
12818 /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
12819 /// ```
12820 pub fn set_import_job<T>(mut self, v: T) -> Self
12821 where
12822 T: std::convert::Into<crate::model::ImportJob>,
12823 {
12824 self.import_job = std::option::Option::Some(v.into());
12825 self
12826 }
12827
12828 /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12829 ///
12830 /// # Example
12831 /// ```ignore,no_run
12832 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12833 /// use google_cloud_kms_v1::model::ImportJob;
12834 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
12835 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
12836 /// ```
12837 pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
12838 where
12839 T: std::convert::Into<crate::model::ImportJob>,
12840 {
12841 self.import_job = v.map(|x| x.into());
12842 self
12843 }
12844}
12845
12846impl wkt::message::Message for CreateImportJobRequest {
12847 fn typename() -> &'static str {
12848 "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
12849 }
12850}
12851
12852/// Request message for
12853/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
12854///
12855/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
12856#[derive(Clone, Default, PartialEq)]
12857#[non_exhaustive]
12858pub struct UpdateCryptoKeyRequest {
12859 /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
12860 ///
12861 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12862 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12863
12864 /// Required. List of fields to be updated in this request.
12865 pub update_mask: std::option::Option<wkt::FieldMask>,
12866
12867 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12868}
12869
12870impl UpdateCryptoKeyRequest {
12871 /// Creates a new default instance.
12872 pub fn new() -> Self {
12873 std::default::Default::default()
12874 }
12875
12876 /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12877 ///
12878 /// # Example
12879 /// ```ignore,no_run
12880 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12881 /// use google_cloud_kms_v1::model::CryptoKey;
12882 /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12883 /// ```
12884 pub fn set_crypto_key<T>(mut self, v: T) -> Self
12885 where
12886 T: std::convert::Into<crate::model::CryptoKey>,
12887 {
12888 self.crypto_key = std::option::Option::Some(v.into());
12889 self
12890 }
12891
12892 /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12893 ///
12894 /// # Example
12895 /// ```ignore,no_run
12896 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12897 /// use google_cloud_kms_v1::model::CryptoKey;
12898 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12899 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12900 /// ```
12901 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12902 where
12903 T: std::convert::Into<crate::model::CryptoKey>,
12904 {
12905 self.crypto_key = v.map(|x| x.into());
12906 self
12907 }
12908
12909 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12910 ///
12911 /// # Example
12912 /// ```ignore,no_run
12913 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12914 /// use wkt::FieldMask;
12915 /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12916 /// ```
12917 pub fn set_update_mask<T>(mut self, v: T) -> Self
12918 where
12919 T: std::convert::Into<wkt::FieldMask>,
12920 {
12921 self.update_mask = std::option::Option::Some(v.into());
12922 self
12923 }
12924
12925 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12926 ///
12927 /// # Example
12928 /// ```ignore,no_run
12929 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12930 /// use wkt::FieldMask;
12931 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12932 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12933 /// ```
12934 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12935 where
12936 T: std::convert::Into<wkt::FieldMask>,
12937 {
12938 self.update_mask = v.map(|x| x.into());
12939 self
12940 }
12941}
12942
12943impl wkt::message::Message for UpdateCryptoKeyRequest {
12944 fn typename() -> &'static str {
12945 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
12946 }
12947}
12948
12949/// Request message for
12950/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
12951///
12952/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
12953#[derive(Clone, Default, PartialEq)]
12954#[non_exhaustive]
12955pub struct UpdateCryptoKeyVersionRequest {
12956 /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12957 /// updated values.
12958 ///
12959 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12960 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12961
12962 /// Required. List of fields to be updated in this request.
12963 pub update_mask: std::option::Option<wkt::FieldMask>,
12964
12965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12966}
12967
12968impl UpdateCryptoKeyVersionRequest {
12969 /// Creates a new default instance.
12970 pub fn new() -> Self {
12971 std::default::Default::default()
12972 }
12973
12974 /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12975 ///
12976 /// # Example
12977 /// ```ignore,no_run
12978 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12979 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12980 /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12981 /// ```
12982 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12983 where
12984 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12985 {
12986 self.crypto_key_version = std::option::Option::Some(v.into());
12987 self
12988 }
12989
12990 /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12991 ///
12992 /// # Example
12993 /// ```ignore,no_run
12994 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12995 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12996 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12997 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12998 /// ```
12999 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
13000 where
13001 T: std::convert::Into<crate::model::CryptoKeyVersion>,
13002 {
13003 self.crypto_key_version = v.map(|x| x.into());
13004 self
13005 }
13006
13007 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13008 ///
13009 /// # Example
13010 /// ```ignore,no_run
13011 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13012 /// use wkt::FieldMask;
13013 /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13014 /// ```
13015 pub fn set_update_mask<T>(mut self, v: T) -> Self
13016 where
13017 T: std::convert::Into<wkt::FieldMask>,
13018 {
13019 self.update_mask = std::option::Option::Some(v.into());
13020 self
13021 }
13022
13023 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13024 ///
13025 /// # Example
13026 /// ```ignore,no_run
13027 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13028 /// use wkt::FieldMask;
13029 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13030 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13031 /// ```
13032 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13033 where
13034 T: std::convert::Into<wkt::FieldMask>,
13035 {
13036 self.update_mask = v.map(|x| x.into());
13037 self
13038 }
13039}
13040
13041impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
13042 fn typename() -> &'static str {
13043 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
13044 }
13045}
13046
13047/// Request message for
13048/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
13049///
13050/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
13051#[derive(Clone, Default, PartialEq)]
13052#[non_exhaustive]
13053pub struct UpdateCryptoKeyPrimaryVersionRequest {
13054 /// Required. The resource name of the
13055 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
13056 ///
13057 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13058 pub name: std::string::String,
13059
13060 /// Required. The id of the child
13061 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
13062 ///
13063 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13064 pub crypto_key_version_id: std::string::String,
13065
13066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13067}
13068
13069impl UpdateCryptoKeyPrimaryVersionRequest {
13070 /// Creates a new default instance.
13071 pub fn new() -> Self {
13072 std::default::Default::default()
13073 }
13074
13075 /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
13076 ///
13077 /// # Example
13078 /// ```ignore,no_run
13079 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13080 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name("example");
13081 /// ```
13082 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13083 self.name = v.into();
13084 self
13085 }
13086
13087 /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
13088 ///
13089 /// # Example
13090 /// ```ignore,no_run
13091 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13092 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
13093 /// ```
13094 pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
13095 mut self,
13096 v: T,
13097 ) -> Self {
13098 self.crypto_key_version_id = v.into();
13099 self
13100 }
13101}
13102
13103impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
13104 fn typename() -> &'static str {
13105 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
13106 }
13107}
13108
13109/// Request message for
13110/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
13111///
13112/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
13113#[derive(Clone, Default, PartialEq)]
13114#[non_exhaustive]
13115pub struct DestroyCryptoKeyVersionRequest {
13116 /// Required. The resource name of the
13117 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
13118 ///
13119 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13120 pub name: std::string::String,
13121
13122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13123}
13124
13125impl DestroyCryptoKeyVersionRequest {
13126 /// Creates a new default instance.
13127 pub fn new() -> Self {
13128 std::default::Default::default()
13129 }
13130
13131 /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
13132 ///
13133 /// # Example
13134 /// ```ignore,no_run
13135 /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
13136 /// let x = DestroyCryptoKeyVersionRequest::new().set_name("example");
13137 /// ```
13138 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13139 self.name = v.into();
13140 self
13141 }
13142}
13143
13144impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
13145 fn typename() -> &'static str {
13146 "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
13147 }
13148}
13149
13150/// Request message for
13151/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
13152///
13153/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
13154#[derive(Clone, Default, PartialEq)]
13155#[non_exhaustive]
13156pub struct RestoreCryptoKeyVersionRequest {
13157 /// Required. The resource name of the
13158 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
13159 ///
13160 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13161 pub name: std::string::String,
13162
13163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13164}
13165
13166impl RestoreCryptoKeyVersionRequest {
13167 /// Creates a new default instance.
13168 pub fn new() -> Self {
13169 std::default::Default::default()
13170 }
13171
13172 /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
13173 ///
13174 /// # Example
13175 /// ```ignore,no_run
13176 /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
13177 /// let x = RestoreCryptoKeyVersionRequest::new().set_name("example");
13178 /// ```
13179 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13180 self.name = v.into();
13181 self
13182 }
13183}
13184
13185impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
13186 fn typename() -> &'static str {
13187 "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
13188 }
13189}
13190
13191/// Request message for
13192/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
13193///
13194/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
13195#[derive(Clone, Default, PartialEq)]
13196#[non_exhaustive]
13197pub struct EncryptRequest {
13198 /// Required. The resource name of the
13199 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
13200 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13201 /// encryption.
13202 ///
13203 /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
13204 /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
13205 ///
13206 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13207 /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
13208 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13209 pub name: std::string::String,
13210
13211 /// Required. The data to encrypt. Must be no larger than 64KiB.
13212 ///
13213 /// The maximum size depends on the key version's
13214 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13215 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13216 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13217 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
13218 /// plaintext must be no larger than 64KiB. For
13219 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13220 /// the plaintext and additional_authenticated_data fields must be no larger
13221 /// than 8KiB.
13222 ///
13223 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13224 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13225 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13226 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13227 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13228 pub plaintext: ::bytes::Bytes,
13229
13230 /// Optional. Optional data that, if specified, must also be provided during
13231 /// decryption through
13232 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13233 ///
13234 /// The maximum size depends on the key version's
13235 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13236 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13237 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13238 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
13239 /// AAD must be no larger than 64KiB. For
13240 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13241 /// the plaintext and additional_authenticated_data fields must be no larger
13242 /// than 8KiB.
13243 ///
13244 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13245 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13246 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13247 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13248 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13249 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13250 pub additional_authenticated_data: ::bytes::Bytes,
13251
13252 /// Optional. An optional CRC32C checksum of the
13253 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
13254 /// If specified,
13255 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13256 /// verify the integrity of the received
13257 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
13258 /// using this checksum.
13259 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13260 /// report an error if the checksum verification fails. If you receive a
13261 /// checksum error, your client should verify that
13262 /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
13263 /// is equal to
13264 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
13265 /// and if so, perform a limited number of retries. A persistent mismatch may
13266 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13267 /// field is defined as int64 for reasons of compatibility across different
13268 /// languages. However, it is a non-negative integer, which will never exceed
13269 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13270 /// this type.
13271 ///
13272 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
13273 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
13274 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13275 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13276
13277 /// Optional. An optional CRC32C checksum of the
13278 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13279 /// If specified,
13280 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13281 /// verify the integrity of the received
13282 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
13283 /// using this checksum.
13284 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13285 /// report an error if the checksum verification fails. If you receive a
13286 /// checksum error, your client should verify that
13287 /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
13288 /// is equal to
13289 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
13290 /// and if so, perform a limited number of retries. A persistent mismatch may
13291 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13292 /// field is defined as int64 for reasons of compatibility across different
13293 /// languages. However, it is a non-negative integer, which will never exceed
13294 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13295 /// this type.
13296 ///
13297 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13298 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
13299 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13300 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13301
13302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13303}
13304
13305impl EncryptRequest {
13306 /// Creates a new default instance.
13307 pub fn new() -> Self {
13308 std::default::Default::default()
13309 }
13310
13311 /// Sets the value of [name][crate::model::EncryptRequest::name].
13312 ///
13313 /// # Example
13314 /// ```ignore,no_run
13315 /// # use google_cloud_kms_v1::model::EncryptRequest;
13316 /// let x = EncryptRequest::new().set_name("example");
13317 /// ```
13318 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13319 self.name = v.into();
13320 self
13321 }
13322
13323 /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
13324 ///
13325 /// # Example
13326 /// ```ignore,no_run
13327 /// # use google_cloud_kms_v1::model::EncryptRequest;
13328 /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13329 /// ```
13330 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13331 self.plaintext = v.into();
13332 self
13333 }
13334
13335 /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
13336 ///
13337 /// # Example
13338 /// ```ignore,no_run
13339 /// # use google_cloud_kms_v1::model::EncryptRequest;
13340 /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13341 /// ```
13342 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13343 mut self,
13344 v: T,
13345 ) -> Self {
13346 self.additional_authenticated_data = v.into();
13347 self
13348 }
13349
13350 /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13351 ///
13352 /// # Example
13353 /// ```ignore,no_run
13354 /// # use google_cloud_kms_v1::model::EncryptRequest;
13355 /// use wkt::Int64Value;
13356 /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13357 /// ```
13358 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13359 where
13360 T: std::convert::Into<wkt::Int64Value>,
13361 {
13362 self.plaintext_crc32c = std::option::Option::Some(v.into());
13363 self
13364 }
13365
13366 /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13367 ///
13368 /// # Example
13369 /// ```ignore,no_run
13370 /// # use google_cloud_kms_v1::model::EncryptRequest;
13371 /// use wkt::Int64Value;
13372 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13373 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13374 /// ```
13375 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13376 where
13377 T: std::convert::Into<wkt::Int64Value>,
13378 {
13379 self.plaintext_crc32c = v.map(|x| x.into());
13380 self
13381 }
13382
13383 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13384 ///
13385 /// # Example
13386 /// ```ignore,no_run
13387 /// # use google_cloud_kms_v1::model::EncryptRequest;
13388 /// use wkt::Int64Value;
13389 /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13390 /// ```
13391 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13392 where
13393 T: std::convert::Into<wkt::Int64Value>,
13394 {
13395 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13396 self
13397 }
13398
13399 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13400 ///
13401 /// # Example
13402 /// ```ignore,no_run
13403 /// # use google_cloud_kms_v1::model::EncryptRequest;
13404 /// use wkt::Int64Value;
13405 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13406 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13407 /// ```
13408 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13409 mut self,
13410 v: std::option::Option<T>,
13411 ) -> Self
13412 where
13413 T: std::convert::Into<wkt::Int64Value>,
13414 {
13415 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13416 self
13417 }
13418}
13419
13420impl wkt::message::Message for EncryptRequest {
13421 fn typename() -> &'static str {
13422 "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
13423 }
13424}
13425
13426/// Request message for
13427/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
13428///
13429/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
13430#[derive(Clone, Default, PartialEq)]
13431#[non_exhaustive]
13432pub struct DecryptRequest {
13433 /// Required. The resource name of the
13434 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
13435 /// server will choose the appropriate version.
13436 ///
13437 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13438 pub name: std::string::String,
13439
13440 /// Required. The encrypted data originally returned in
13441 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
13442 ///
13443 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
13444 pub ciphertext: ::bytes::Bytes,
13445
13446 /// Optional. Optional data that must match the data originally supplied in
13447 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13448 ///
13449 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13450 pub additional_authenticated_data: ::bytes::Bytes,
13451
13452 /// Optional. An optional CRC32C checksum of the
13453 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
13454 /// If specified,
13455 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13456 /// verify the integrity of the received
13457 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
13458 /// using this checksum.
13459 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13460 /// report an error if the checksum verification fails. If you receive a
13461 /// checksum error, your client should verify that
13462 /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
13463 /// is equal to
13464 /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
13465 /// and if so, perform a limited number of retries. A persistent mismatch may
13466 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13467 /// field is defined as int64 for reasons of compatibility across different
13468 /// languages. However, it is a non-negative integer, which will never exceed
13469 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13470 /// this type.
13471 ///
13472 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
13473 /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
13474 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13475 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13476
13477 /// Optional. An optional CRC32C checksum of the
13478 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13479 /// If specified,
13480 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13481 /// verify the integrity of the received
13482 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
13483 /// using this checksum.
13484 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13485 /// report an error if the checksum verification fails. If you receive a
13486 /// checksum error, your client should verify that
13487 /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
13488 /// is equal to
13489 /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
13490 /// and if so, perform a limited number of retries. A persistent mismatch may
13491 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13492 /// field is defined as int64 for reasons of compatibility across different
13493 /// languages. However, it is a non-negative integer, which will never exceed
13494 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13495 /// this type.
13496 ///
13497 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13498 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
13499 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13500 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13501
13502 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13503}
13504
13505impl DecryptRequest {
13506 /// Creates a new default instance.
13507 pub fn new() -> Self {
13508 std::default::Default::default()
13509 }
13510
13511 /// Sets the value of [name][crate::model::DecryptRequest::name].
13512 ///
13513 /// # Example
13514 /// ```ignore,no_run
13515 /// # use google_cloud_kms_v1::model::DecryptRequest;
13516 /// let x = DecryptRequest::new().set_name("example");
13517 /// ```
13518 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13519 self.name = v.into();
13520 self
13521 }
13522
13523 /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
13524 ///
13525 /// # Example
13526 /// ```ignore,no_run
13527 /// # use google_cloud_kms_v1::model::DecryptRequest;
13528 /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13529 /// ```
13530 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13531 self.ciphertext = v.into();
13532 self
13533 }
13534
13535 /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
13536 ///
13537 /// # Example
13538 /// ```ignore,no_run
13539 /// # use google_cloud_kms_v1::model::DecryptRequest;
13540 /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13541 /// ```
13542 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13543 mut self,
13544 v: T,
13545 ) -> Self {
13546 self.additional_authenticated_data = v.into();
13547 self
13548 }
13549
13550 /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13551 ///
13552 /// # Example
13553 /// ```ignore,no_run
13554 /// # use google_cloud_kms_v1::model::DecryptRequest;
13555 /// use wkt::Int64Value;
13556 /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13557 /// ```
13558 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13559 where
13560 T: std::convert::Into<wkt::Int64Value>,
13561 {
13562 self.ciphertext_crc32c = std::option::Option::Some(v.into());
13563 self
13564 }
13565
13566 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13567 ///
13568 /// # Example
13569 /// ```ignore,no_run
13570 /// # use google_cloud_kms_v1::model::DecryptRequest;
13571 /// use wkt::Int64Value;
13572 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13573 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13574 /// ```
13575 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13576 where
13577 T: std::convert::Into<wkt::Int64Value>,
13578 {
13579 self.ciphertext_crc32c = v.map(|x| x.into());
13580 self
13581 }
13582
13583 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13584 ///
13585 /// # Example
13586 /// ```ignore,no_run
13587 /// # use google_cloud_kms_v1::model::DecryptRequest;
13588 /// use wkt::Int64Value;
13589 /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13590 /// ```
13591 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13592 where
13593 T: std::convert::Into<wkt::Int64Value>,
13594 {
13595 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13596 self
13597 }
13598
13599 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13600 ///
13601 /// # Example
13602 /// ```ignore,no_run
13603 /// # use google_cloud_kms_v1::model::DecryptRequest;
13604 /// use wkt::Int64Value;
13605 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13606 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13607 /// ```
13608 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13609 mut self,
13610 v: std::option::Option<T>,
13611 ) -> Self
13612 where
13613 T: std::convert::Into<wkt::Int64Value>,
13614 {
13615 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13616 self
13617 }
13618}
13619
13620impl wkt::message::Message for DecryptRequest {
13621 fn typename() -> &'static str {
13622 "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
13623 }
13624}
13625
13626/// Request message for
13627/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
13628///
13629/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
13630#[derive(Clone, Default, PartialEq)]
13631#[non_exhaustive]
13632pub struct RawEncryptRequest {
13633 /// Required. The resource name of the
13634 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13635 /// encryption.
13636 ///
13637 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13638 pub name: std::string::String,
13639
13640 /// Required. The data to encrypt. Must be no larger than 64KiB.
13641 ///
13642 /// The maximum size depends on the key version's
13643 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13644 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13645 /// plaintext must be no larger than 64KiB. For
13646 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13647 /// the plaintext and additional_authenticated_data fields must be no larger
13648 /// than 8KiB.
13649 ///
13650 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13651 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13652 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13653 pub plaintext: ::bytes::Bytes,
13654
13655 /// Optional. Optional data that, if specified, must also be provided during
13656 /// decryption through
13657 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13658 ///
13659 /// This field may only be used in conjunction with an
13660 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
13661 /// additional authenticated data (for example, AES-GCM).
13662 ///
13663 /// The maximum size depends on the key version's
13664 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13665 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13666 /// plaintext must be no larger than 64KiB. For
13667 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13668 /// the plaintext and additional_authenticated_data fields must be no larger
13669 /// than 8KiB.
13670 ///
13671 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13672 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13673 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13674 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13675 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13676 pub additional_authenticated_data: ::bytes::Bytes,
13677
13678 /// Optional. An optional CRC32C checksum of the
13679 /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
13680 /// If specified,
13681 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13682 /// verify the integrity of the received plaintext using this checksum.
13683 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13684 /// report an error if the checksum verification fails. If you receive a
13685 /// checksum error, your client should verify that CRC32C(plaintext) is equal
13686 /// to plaintext_crc32c, and if so, perform a limited number of retries. A
13687 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13688 /// checksum. Note: This field is defined as int64 for reasons of compatibility
13689 /// across different languages. However, it is a non-negative integer, which
13690 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13691 /// languages that support this type.
13692 ///
13693 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13694 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
13695 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13696
13697 /// Optional. An optional CRC32C checksum of the
13698 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13699 /// If specified,
13700 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13701 /// verify the integrity of the received additional_authenticated_data using
13702 /// this checksum.
13703 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13704 /// report an error if the checksum verification fails. If you receive a
13705 /// checksum error, your client should verify that
13706 /// CRC32C(additional_authenticated_data) is equal to
13707 /// additional_authenticated_data_crc32c, and if so, perform
13708 /// a limited number of retries. A persistent mismatch may indicate an issue in
13709 /// your computation of the CRC32C checksum.
13710 /// Note: This field is defined as int64 for reasons of compatibility across
13711 /// different languages. However, it is a non-negative integer, which will
13712 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13713 /// that support this type.
13714 ///
13715 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13716 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13717 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13718
13719 /// Optional. A customer-supplied initialization vector that will be used for
13720 /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
13721 /// generated. It will be returned in
13722 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13723 ///
13724 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13725 pub initialization_vector: ::bytes::Bytes,
13726
13727 /// Optional. An optional CRC32C checksum of the
13728 /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
13729 /// If specified,
13730 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13731 /// verify the integrity of the received initialization_vector using this
13732 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13733 /// will report an error if the checksum verification fails. If you receive a
13734 /// checksum error, your client should verify that
13735 /// CRC32C(initialization_vector) is equal to
13736 /// initialization_vector_crc32c, and if so, perform
13737 /// a limited number of retries. A persistent mismatch may indicate an issue in
13738 /// your computation of the CRC32C checksum.
13739 /// Note: This field is defined as int64 for reasons of compatibility across
13740 /// different languages. However, it is a non-negative integer, which will
13741 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13742 /// that support this type.
13743 ///
13744 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13745 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
13746 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13747
13748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13749}
13750
13751impl RawEncryptRequest {
13752 /// Creates a new default instance.
13753 pub fn new() -> Self {
13754 std::default::Default::default()
13755 }
13756
13757 /// Sets the value of [name][crate::model::RawEncryptRequest::name].
13758 ///
13759 /// # Example
13760 /// ```ignore,no_run
13761 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13762 /// let x = RawEncryptRequest::new().set_name("example");
13763 /// ```
13764 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13765 self.name = v.into();
13766 self
13767 }
13768
13769 /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
13770 ///
13771 /// # Example
13772 /// ```ignore,no_run
13773 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13774 /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13775 /// ```
13776 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13777 self.plaintext = v.into();
13778 self
13779 }
13780
13781 /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
13782 ///
13783 /// # Example
13784 /// ```ignore,no_run
13785 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13786 /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13787 /// ```
13788 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13789 mut self,
13790 v: T,
13791 ) -> Self {
13792 self.additional_authenticated_data = v.into();
13793 self
13794 }
13795
13796 /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13797 ///
13798 /// # Example
13799 /// ```ignore,no_run
13800 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13801 /// use wkt::Int64Value;
13802 /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13803 /// ```
13804 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13805 where
13806 T: std::convert::Into<wkt::Int64Value>,
13807 {
13808 self.plaintext_crc32c = std::option::Option::Some(v.into());
13809 self
13810 }
13811
13812 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13813 ///
13814 /// # Example
13815 /// ```ignore,no_run
13816 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13817 /// use wkt::Int64Value;
13818 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13819 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13820 /// ```
13821 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13822 where
13823 T: std::convert::Into<wkt::Int64Value>,
13824 {
13825 self.plaintext_crc32c = v.map(|x| x.into());
13826 self
13827 }
13828
13829 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13830 ///
13831 /// # Example
13832 /// ```ignore,no_run
13833 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13834 /// use wkt::Int64Value;
13835 /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13836 /// ```
13837 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13838 where
13839 T: std::convert::Into<wkt::Int64Value>,
13840 {
13841 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13842 self
13843 }
13844
13845 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13846 ///
13847 /// # Example
13848 /// ```ignore,no_run
13849 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13850 /// use wkt::Int64Value;
13851 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13852 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13853 /// ```
13854 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13855 mut self,
13856 v: std::option::Option<T>,
13857 ) -> Self
13858 where
13859 T: std::convert::Into<wkt::Int64Value>,
13860 {
13861 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13862 self
13863 }
13864
13865 /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
13866 ///
13867 /// # Example
13868 /// ```ignore,no_run
13869 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13870 /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13871 /// ```
13872 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13873 mut self,
13874 v: T,
13875 ) -> Self {
13876 self.initialization_vector = v.into();
13877 self
13878 }
13879
13880 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13881 ///
13882 /// # Example
13883 /// ```ignore,no_run
13884 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13885 /// use wkt::Int64Value;
13886 /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
13887 /// ```
13888 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
13889 where
13890 T: std::convert::Into<wkt::Int64Value>,
13891 {
13892 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
13893 self
13894 }
13895
13896 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13897 ///
13898 /// # Example
13899 /// ```ignore,no_run
13900 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13901 /// use wkt::Int64Value;
13902 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
13903 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
13904 /// ```
13905 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13906 where
13907 T: std::convert::Into<wkt::Int64Value>,
13908 {
13909 self.initialization_vector_crc32c = v.map(|x| x.into());
13910 self
13911 }
13912}
13913
13914impl wkt::message::Message for RawEncryptRequest {
13915 fn typename() -> &'static str {
13916 "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
13917 }
13918}
13919
13920/// Request message for
13921/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
13922///
13923/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
13924#[derive(Clone, Default, PartialEq)]
13925#[non_exhaustive]
13926pub struct RawDecryptRequest {
13927 /// Required. The resource name of the
13928 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13929 /// decryption.
13930 ///
13931 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13932 pub name: std::string::String,
13933
13934 /// Required. The encrypted data originally returned in
13935 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
13936 ///
13937 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
13938 pub ciphertext: ::bytes::Bytes,
13939
13940 /// Optional. Optional data that must match the data originally supplied in
13941 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13942 ///
13943 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13944 pub additional_authenticated_data: ::bytes::Bytes,
13945
13946 /// Required. The initialization vector (IV) used during encryption, which must
13947 /// match the data originally provided in
13948 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13949 ///
13950 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13951 pub initialization_vector: ::bytes::Bytes,
13952
13953 /// The length of the authentication tag that is appended to the end of
13954 /// the ciphertext. If unspecified (0), the default value for the key's
13955 /// algorithm will be used (for AES-GCM, the default value is 16).
13956 pub tag_length: i32,
13957
13958 /// Optional. An optional CRC32C checksum of the
13959 /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
13960 /// If specified,
13961 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13962 /// verify the integrity of the received ciphertext using this checksum.
13963 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13964 /// report an error if the checksum verification fails. If you receive a
13965 /// checksum error, your client should verify that CRC32C(ciphertext) is equal
13966 /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
13967 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13968 /// checksum. Note: This field is defined as int64 for reasons of compatibility
13969 /// across different languages. However, it is a non-negative integer, which
13970 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13971 /// languages that support this type.
13972 ///
13973 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13974 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
13975 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13976
13977 /// Optional. An optional CRC32C checksum of the
13978 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13979 /// If specified,
13980 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13981 /// verify the integrity of the received additional_authenticated_data using
13982 /// this checksum.
13983 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13984 /// report an error if the checksum verification fails. If you receive a
13985 /// checksum error, your client should verify that
13986 /// CRC32C(additional_authenticated_data) is equal to
13987 /// additional_authenticated_data_crc32c, and if so, perform
13988 /// a limited number of retries. A persistent mismatch may indicate an issue in
13989 /// your computation of the CRC32C checksum.
13990 /// Note: This field is defined as int64 for reasons of compatibility across
13991 /// different languages. However, it is a non-negative integer, which will
13992 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13993 /// that support this type.
13994 ///
13995 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13996 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13997 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13998
13999 /// Optional. An optional CRC32C checksum of the
14000 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
14001 /// If specified,
14002 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14003 /// verify the integrity of the received initialization_vector using this
14004 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14005 /// will report an error if the checksum verification fails. If you receive a
14006 /// checksum error, your client should verify that
14007 /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
14008 /// if so, perform a limited number of retries. A persistent mismatch may
14009 /// indicate an issue in your computation of the CRC32C checksum.
14010 /// Note: This field is defined as int64 for reasons of compatibility across
14011 /// different languages. However, it is a non-negative integer, which will
14012 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14013 /// that support this type.
14014 ///
14015 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14016 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
14017 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
14018
14019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14020}
14021
14022impl RawDecryptRequest {
14023 /// Creates a new default instance.
14024 pub fn new() -> Self {
14025 std::default::Default::default()
14026 }
14027
14028 /// Sets the value of [name][crate::model::RawDecryptRequest::name].
14029 ///
14030 /// # Example
14031 /// ```ignore,no_run
14032 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14033 /// let x = RawDecryptRequest::new().set_name("example");
14034 /// ```
14035 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14036 self.name = v.into();
14037 self
14038 }
14039
14040 /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
14041 ///
14042 /// # Example
14043 /// ```ignore,no_run
14044 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14045 /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14046 /// ```
14047 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14048 self.ciphertext = v.into();
14049 self
14050 }
14051
14052 /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
14053 ///
14054 /// # Example
14055 /// ```ignore,no_run
14056 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14057 /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14058 /// ```
14059 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14060 mut self,
14061 v: T,
14062 ) -> Self {
14063 self.additional_authenticated_data = v.into();
14064 self
14065 }
14066
14067 /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
14068 ///
14069 /// # Example
14070 /// ```ignore,no_run
14071 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14072 /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14073 /// ```
14074 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14075 mut self,
14076 v: T,
14077 ) -> Self {
14078 self.initialization_vector = v.into();
14079 self
14080 }
14081
14082 /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
14083 ///
14084 /// # Example
14085 /// ```ignore,no_run
14086 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14087 /// let x = RawDecryptRequest::new().set_tag_length(42);
14088 /// ```
14089 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14090 self.tag_length = v.into();
14091 self
14092 }
14093
14094 /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14095 ///
14096 /// # Example
14097 /// ```ignore,no_run
14098 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14099 /// use wkt::Int64Value;
14100 /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14101 /// ```
14102 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14103 where
14104 T: std::convert::Into<wkt::Int64Value>,
14105 {
14106 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14107 self
14108 }
14109
14110 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14111 ///
14112 /// # Example
14113 /// ```ignore,no_run
14114 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14115 /// use wkt::Int64Value;
14116 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14117 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14118 /// ```
14119 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14120 where
14121 T: std::convert::Into<wkt::Int64Value>,
14122 {
14123 self.ciphertext_crc32c = v.map(|x| x.into());
14124 self
14125 }
14126
14127 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14128 ///
14129 /// # Example
14130 /// ```ignore,no_run
14131 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14132 /// use wkt::Int64Value;
14133 /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14134 /// ```
14135 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14136 where
14137 T: std::convert::Into<wkt::Int64Value>,
14138 {
14139 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14140 self
14141 }
14142
14143 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14144 ///
14145 /// # Example
14146 /// ```ignore,no_run
14147 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14148 /// use wkt::Int64Value;
14149 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14150 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14151 /// ```
14152 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14153 mut self,
14154 v: std::option::Option<T>,
14155 ) -> Self
14156 where
14157 T: std::convert::Into<wkt::Int64Value>,
14158 {
14159 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14160 self
14161 }
14162
14163 /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14164 ///
14165 /// # Example
14166 /// ```ignore,no_run
14167 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14168 /// use wkt::Int64Value;
14169 /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14170 /// ```
14171 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14172 where
14173 T: std::convert::Into<wkt::Int64Value>,
14174 {
14175 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14176 self
14177 }
14178
14179 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14180 ///
14181 /// # Example
14182 /// ```ignore,no_run
14183 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14184 /// use wkt::Int64Value;
14185 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14186 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14187 /// ```
14188 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14189 where
14190 T: std::convert::Into<wkt::Int64Value>,
14191 {
14192 self.initialization_vector_crc32c = v.map(|x| x.into());
14193 self
14194 }
14195}
14196
14197impl wkt::message::Message for RawDecryptRequest {
14198 fn typename() -> &'static str {
14199 "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
14200 }
14201}
14202
14203/// Request message for
14204/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
14205///
14206/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
14207#[derive(Clone, Default, PartialEq)]
14208#[non_exhaustive]
14209pub struct AsymmetricSignRequest {
14210 /// Required. The resource name of the
14211 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14212 /// signing.
14213 ///
14214 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14215 pub name: std::string::String,
14216
14217 /// Optional. The digest of the data to sign. The digest must be produced with
14218 /// the same digest algorithm as specified by the key version's
14219 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
14220 ///
14221 /// This field may not be supplied if
14222 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14223 /// is supplied.
14224 ///
14225 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14226 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
14227 pub digest: std::option::Option<crate::model::Digest>,
14228
14229 /// Optional. An optional CRC32C checksum of the
14230 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
14231 /// If specified,
14232 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14233 /// verify the integrity of the received
14234 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14235 /// using this checksum.
14236 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14237 /// report an error if the checksum verification fails. If you receive a
14238 /// checksum error, your client should verify that
14239 /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
14240 /// is equal to
14241 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
14242 /// and if so, perform a limited number of retries. A persistent mismatch may
14243 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14244 /// field is defined as int64 for reasons of compatibility across different
14245 /// languages. However, it is a non-negative integer, which will never exceed
14246 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14247 /// this type.
14248 ///
14249 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14250 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
14251 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14252 pub digest_crc32c: std::option::Option<wkt::Int64Value>,
14253
14254 /// Optional. The data to sign.
14255 /// It can't be supplied if
14256 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14257 /// is supplied.
14258 ///
14259 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14260 pub data: ::bytes::Bytes,
14261
14262 /// Optional. An optional CRC32C checksum of the
14263 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
14264 /// If specified,
14265 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14266 /// verify the integrity of the received
14267 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14268 /// using this checksum.
14269 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14270 /// report an error if the checksum verification fails. If you receive a
14271 /// checksum error, your client should verify that
14272 /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
14273 /// is equal to
14274 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
14275 /// and if so, perform a limited number of retries. A persistent mismatch may
14276 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14277 /// field is defined as int64 for reasons of compatibility across different
14278 /// languages. However, it is a non-negative integer, which will never exceed
14279 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14280 /// this type.
14281 ///
14282 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14283 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
14284 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14285 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14286
14287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14288}
14289
14290impl AsymmetricSignRequest {
14291 /// Creates a new default instance.
14292 pub fn new() -> Self {
14293 std::default::Default::default()
14294 }
14295
14296 /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
14297 ///
14298 /// # Example
14299 /// ```ignore,no_run
14300 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14301 /// let x = AsymmetricSignRequest::new().set_name("example");
14302 /// ```
14303 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14304 self.name = v.into();
14305 self
14306 }
14307
14308 /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
14309 ///
14310 /// # Example
14311 /// ```ignore,no_run
14312 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14313 /// use google_cloud_kms_v1::model::Digest;
14314 /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
14315 /// ```
14316 pub fn set_digest<T>(mut self, v: T) -> Self
14317 where
14318 T: std::convert::Into<crate::model::Digest>,
14319 {
14320 self.digest = std::option::Option::Some(v.into());
14321 self
14322 }
14323
14324 /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
14325 ///
14326 /// # Example
14327 /// ```ignore,no_run
14328 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14329 /// use google_cloud_kms_v1::model::Digest;
14330 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
14331 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
14332 /// ```
14333 pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
14334 where
14335 T: std::convert::Into<crate::model::Digest>,
14336 {
14337 self.digest = v.map(|x| x.into());
14338 self
14339 }
14340
14341 /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14342 ///
14343 /// # Example
14344 /// ```ignore,no_run
14345 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14346 /// use wkt::Int64Value;
14347 /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
14348 /// ```
14349 pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
14350 where
14351 T: std::convert::Into<wkt::Int64Value>,
14352 {
14353 self.digest_crc32c = std::option::Option::Some(v.into());
14354 self
14355 }
14356
14357 /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14358 ///
14359 /// # Example
14360 /// ```ignore,no_run
14361 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14362 /// use wkt::Int64Value;
14363 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
14364 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
14365 /// ```
14366 pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14367 where
14368 T: std::convert::Into<wkt::Int64Value>,
14369 {
14370 self.digest_crc32c = v.map(|x| x.into());
14371 self
14372 }
14373
14374 /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
14375 ///
14376 /// # Example
14377 /// ```ignore,no_run
14378 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14379 /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14380 /// ```
14381 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14382 self.data = v.into();
14383 self
14384 }
14385
14386 /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14387 ///
14388 /// # Example
14389 /// ```ignore,no_run
14390 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14391 /// use wkt::Int64Value;
14392 /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14393 /// ```
14394 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14395 where
14396 T: std::convert::Into<wkt::Int64Value>,
14397 {
14398 self.data_crc32c = std::option::Option::Some(v.into());
14399 self
14400 }
14401
14402 /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14403 ///
14404 /// # Example
14405 /// ```ignore,no_run
14406 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14407 /// use wkt::Int64Value;
14408 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14409 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14410 /// ```
14411 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14412 where
14413 T: std::convert::Into<wkt::Int64Value>,
14414 {
14415 self.data_crc32c = v.map(|x| x.into());
14416 self
14417 }
14418}
14419
14420impl wkt::message::Message for AsymmetricSignRequest {
14421 fn typename() -> &'static str {
14422 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
14423 }
14424}
14425
14426/// Request message for
14427/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
14428///
14429/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
14430#[derive(Clone, Default, PartialEq)]
14431#[non_exhaustive]
14432pub struct AsymmetricDecryptRequest {
14433 /// Required. The resource name of the
14434 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14435 /// decryption.
14436 ///
14437 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14438 pub name: std::string::String,
14439
14440 /// Required. The data encrypted with the named
14441 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
14442 /// OAEP.
14443 ///
14444 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14445 pub ciphertext: ::bytes::Bytes,
14446
14447 /// Optional. An optional CRC32C checksum of the
14448 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
14449 /// If specified,
14450 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14451 /// verify the integrity of the received
14452 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
14453 /// using this checksum.
14454 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14455 /// report an error if the checksum verification fails. If you receive a
14456 /// checksum error, your client should verify that
14457 /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
14458 /// is equal to
14459 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
14460 /// and if so, perform a limited number of retries. A persistent mismatch may
14461 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14462 /// field is defined as int64 for reasons of compatibility across different
14463 /// languages. However, it is a non-negative integer, which will never exceed
14464 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14465 /// this type.
14466 ///
14467 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
14468 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
14469 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14470 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14471
14472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14473}
14474
14475impl AsymmetricDecryptRequest {
14476 /// Creates a new default instance.
14477 pub fn new() -> Self {
14478 std::default::Default::default()
14479 }
14480
14481 /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
14482 ///
14483 /// # Example
14484 /// ```ignore,no_run
14485 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14486 /// let x = AsymmetricDecryptRequest::new().set_name("example");
14487 /// ```
14488 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14489 self.name = v.into();
14490 self
14491 }
14492
14493 /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
14494 ///
14495 /// # Example
14496 /// ```ignore,no_run
14497 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14498 /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14499 /// ```
14500 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14501 self.ciphertext = v.into();
14502 self
14503 }
14504
14505 /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14506 ///
14507 /// # Example
14508 /// ```ignore,no_run
14509 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14510 /// use wkt::Int64Value;
14511 /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14512 /// ```
14513 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14514 where
14515 T: std::convert::Into<wkt::Int64Value>,
14516 {
14517 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14518 self
14519 }
14520
14521 /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14522 ///
14523 /// # Example
14524 /// ```ignore,no_run
14525 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14526 /// use wkt::Int64Value;
14527 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14528 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14529 /// ```
14530 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14531 where
14532 T: std::convert::Into<wkt::Int64Value>,
14533 {
14534 self.ciphertext_crc32c = v.map(|x| x.into());
14535 self
14536 }
14537}
14538
14539impl wkt::message::Message for AsymmetricDecryptRequest {
14540 fn typename() -> &'static str {
14541 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
14542 }
14543}
14544
14545/// Request message for
14546/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
14547///
14548/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
14549#[derive(Clone, Default, PartialEq)]
14550#[non_exhaustive]
14551pub struct MacSignRequest {
14552 /// Required. The resource name of the
14553 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14554 /// signing.
14555 ///
14556 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14557 pub name: std::string::String,
14558
14559 /// Required. The data to sign. The MAC tag is computed over this data field
14560 /// based on the specific algorithm.
14561 pub data: ::bytes::Bytes,
14562
14563 /// Optional. An optional CRC32C checksum of the
14564 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
14565 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14566 /// will verify the integrity of the received
14567 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
14568 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14569 /// will report an error if the checksum verification fails. If you receive a
14570 /// checksum error, your client should verify that
14571 /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
14572 /// equal to
14573 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
14574 /// and if so, perform a limited number of retries. A persistent mismatch may
14575 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14576 /// field is defined as int64 for reasons of compatibility across different
14577 /// languages. However, it is a non-negative integer, which will never exceed
14578 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14579 /// this type.
14580 ///
14581 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14582 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14583 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
14584 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14585
14586 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14587}
14588
14589impl MacSignRequest {
14590 /// Creates a new default instance.
14591 pub fn new() -> Self {
14592 std::default::Default::default()
14593 }
14594
14595 /// Sets the value of [name][crate::model::MacSignRequest::name].
14596 ///
14597 /// # Example
14598 /// ```ignore,no_run
14599 /// # use google_cloud_kms_v1::model::MacSignRequest;
14600 /// let x = MacSignRequest::new().set_name("example");
14601 /// ```
14602 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14603 self.name = v.into();
14604 self
14605 }
14606
14607 /// Sets the value of [data][crate::model::MacSignRequest::data].
14608 ///
14609 /// # Example
14610 /// ```ignore,no_run
14611 /// # use google_cloud_kms_v1::model::MacSignRequest;
14612 /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14613 /// ```
14614 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14615 self.data = v.into();
14616 self
14617 }
14618
14619 /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14620 ///
14621 /// # Example
14622 /// ```ignore,no_run
14623 /// # use google_cloud_kms_v1::model::MacSignRequest;
14624 /// use wkt::Int64Value;
14625 /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14626 /// ```
14627 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14628 where
14629 T: std::convert::Into<wkt::Int64Value>,
14630 {
14631 self.data_crc32c = std::option::Option::Some(v.into());
14632 self
14633 }
14634
14635 /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14636 ///
14637 /// # Example
14638 /// ```ignore,no_run
14639 /// # use google_cloud_kms_v1::model::MacSignRequest;
14640 /// use wkt::Int64Value;
14641 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14642 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14643 /// ```
14644 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14645 where
14646 T: std::convert::Into<wkt::Int64Value>,
14647 {
14648 self.data_crc32c = v.map(|x| x.into());
14649 self
14650 }
14651}
14652
14653impl wkt::message::Message for MacSignRequest {
14654 fn typename() -> &'static str {
14655 "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
14656 }
14657}
14658
14659/// Request message for
14660/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
14661///
14662/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
14663#[derive(Clone, Default, PartialEq)]
14664#[non_exhaustive]
14665pub struct MacVerifyRequest {
14666 /// Required. The resource name of the
14667 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14668 /// verification.
14669 ///
14670 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14671 pub name: std::string::String,
14672
14673 /// Required. The data used previously as a
14674 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
14675 /// the MAC tag.
14676 ///
14677 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14678 pub data: ::bytes::Bytes,
14679
14680 /// Optional. An optional CRC32C checksum of the
14681 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
14682 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14683 /// will verify the integrity of the received
14684 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
14685 /// this checksum.
14686 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14687 /// report an error if the checksum verification fails. If you receive a
14688 /// checksum error, your client should verify that
14689 /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
14690 /// is equal to
14691 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
14692 /// and if so, perform a limited number of retries. A persistent mismatch may
14693 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14694 /// field is defined as int64 for reasons of compatibility across different
14695 /// languages. However, it is a non-negative integer, which will never exceed
14696 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14697 /// this type.
14698 ///
14699 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14700 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
14701 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
14702 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14703
14704 /// Required. The signature to verify.
14705 pub mac: ::bytes::Bytes,
14706
14707 /// Optional. An optional CRC32C checksum of the
14708 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
14709 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14710 /// will verify the integrity of the received
14711 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
14712 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14713 /// will report an error if the checksum verification fails. If you receive a
14714 /// checksum error, your client should verify that
14715 /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
14716 /// equal to
14717 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
14718 /// and if so, perform a limited number of retries. A persistent mismatch may
14719 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14720 /// field is defined as int64 for reasons of compatibility across different
14721 /// languages. However, it is a non-negative integer, which will never exceed
14722 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14723 /// this type.
14724 ///
14725 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14726 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
14727 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
14728 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
14729
14730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14731}
14732
14733impl MacVerifyRequest {
14734 /// Creates a new default instance.
14735 pub fn new() -> Self {
14736 std::default::Default::default()
14737 }
14738
14739 /// Sets the value of [name][crate::model::MacVerifyRequest::name].
14740 ///
14741 /// # Example
14742 /// ```ignore,no_run
14743 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14744 /// let x = MacVerifyRequest::new().set_name("example");
14745 /// ```
14746 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14747 self.name = v.into();
14748 self
14749 }
14750
14751 /// Sets the value of [data][crate::model::MacVerifyRequest::data].
14752 ///
14753 /// # Example
14754 /// ```ignore,no_run
14755 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14756 /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14757 /// ```
14758 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14759 self.data = v.into();
14760 self
14761 }
14762
14763 /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14764 ///
14765 /// # Example
14766 /// ```ignore,no_run
14767 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14768 /// use wkt::Int64Value;
14769 /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14770 /// ```
14771 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14772 where
14773 T: std::convert::Into<wkt::Int64Value>,
14774 {
14775 self.data_crc32c = std::option::Option::Some(v.into());
14776 self
14777 }
14778
14779 /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14780 ///
14781 /// # Example
14782 /// ```ignore,no_run
14783 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14784 /// use wkt::Int64Value;
14785 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14786 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14787 /// ```
14788 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14789 where
14790 T: std::convert::Into<wkt::Int64Value>,
14791 {
14792 self.data_crc32c = v.map(|x| x.into());
14793 self
14794 }
14795
14796 /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
14797 ///
14798 /// # Example
14799 /// ```ignore,no_run
14800 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14801 /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
14802 /// ```
14803 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14804 self.mac = v.into();
14805 self
14806 }
14807
14808 /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14809 ///
14810 /// # Example
14811 /// ```ignore,no_run
14812 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14813 /// use wkt::Int64Value;
14814 /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
14815 /// ```
14816 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
14817 where
14818 T: std::convert::Into<wkt::Int64Value>,
14819 {
14820 self.mac_crc32c = std::option::Option::Some(v.into());
14821 self
14822 }
14823
14824 /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14825 ///
14826 /// # Example
14827 /// ```ignore,no_run
14828 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14829 /// use wkt::Int64Value;
14830 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
14831 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
14832 /// ```
14833 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14834 where
14835 T: std::convert::Into<wkt::Int64Value>,
14836 {
14837 self.mac_crc32c = v.map(|x| x.into());
14838 self
14839 }
14840}
14841
14842impl wkt::message::Message for MacVerifyRequest {
14843 fn typename() -> &'static str {
14844 "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
14845 }
14846}
14847
14848/// Request message for
14849/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
14850///
14851/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
14852#[derive(Clone, Default, PartialEq)]
14853#[non_exhaustive]
14854pub struct DecapsulateRequest {
14855 /// Required. The resource name of the
14856 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14857 /// decapsulation.
14858 ///
14859 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14860 pub name: std::string::String,
14861
14862 /// Required. The ciphertext produced from encapsulation with the
14863 /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
14864 /// key(s).
14865 ///
14866 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14867 pub ciphertext: ::bytes::Bytes,
14868
14869 /// Optional. A CRC32C checksum of the
14870 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
14871 /// If specified,
14872 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14873 /// verify the integrity of the received
14874 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
14875 /// using this checksum.
14876 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14877 /// report an error if the checksum verification fails. If you receive a
14878 /// checksum error, your client should verify that
14879 /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
14880 /// is equal to
14881 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
14882 /// and if so, perform a limited number of retries. A persistent mismatch may
14883 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14884 /// field is defined as int64 for reasons of compatibility across different
14885 /// languages. However, it is a non-negative integer, which will never exceed
14886 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14887 /// this type.
14888 ///
14889 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
14890 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
14891 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14892 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14893
14894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14895}
14896
14897impl DecapsulateRequest {
14898 /// Creates a new default instance.
14899 pub fn new() -> Self {
14900 std::default::Default::default()
14901 }
14902
14903 /// Sets the value of [name][crate::model::DecapsulateRequest::name].
14904 ///
14905 /// # Example
14906 /// ```ignore,no_run
14907 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14908 /// let x = DecapsulateRequest::new().set_name("example");
14909 /// ```
14910 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14911 self.name = v.into();
14912 self
14913 }
14914
14915 /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
14916 ///
14917 /// # Example
14918 /// ```ignore,no_run
14919 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14920 /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14921 /// ```
14922 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14923 self.ciphertext = v.into();
14924 self
14925 }
14926
14927 /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14928 ///
14929 /// # Example
14930 /// ```ignore,no_run
14931 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14932 /// use wkt::Int64Value;
14933 /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14934 /// ```
14935 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14936 where
14937 T: std::convert::Into<wkt::Int64Value>,
14938 {
14939 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14940 self
14941 }
14942
14943 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14944 ///
14945 /// # Example
14946 /// ```ignore,no_run
14947 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14948 /// use wkt::Int64Value;
14949 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14950 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14951 /// ```
14952 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14953 where
14954 T: std::convert::Into<wkt::Int64Value>,
14955 {
14956 self.ciphertext_crc32c = v.map(|x| x.into());
14957 self
14958 }
14959}
14960
14961impl wkt::message::Message for DecapsulateRequest {
14962 fn typename() -> &'static str {
14963 "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
14964 }
14965}
14966
14967/// Request message for
14968/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
14969///
14970/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
14971#[derive(Clone, Default, PartialEq)]
14972#[non_exhaustive]
14973pub struct GenerateRandomBytesRequest {
14974 /// The project-specific location in which to generate random bytes.
14975 /// For example, "projects/my-project/locations/us-central1".
14976 pub location: std::string::String,
14977
14978 /// The length in bytes of the amount of randomness to retrieve. Minimum 8
14979 /// bytes, maximum 1024 bytes.
14980 pub length_bytes: i32,
14981
14982 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
14983 /// generating the random data. Currently, only
14984 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
14985 /// supported.
14986 ///
14987 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14988 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14989 pub protection_level: crate::model::ProtectionLevel,
14990
14991 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14992}
14993
14994impl GenerateRandomBytesRequest {
14995 /// Creates a new default instance.
14996 pub fn new() -> Self {
14997 std::default::Default::default()
14998 }
14999
15000 /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
15001 ///
15002 /// # Example
15003 /// ```ignore,no_run
15004 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15005 /// let x = GenerateRandomBytesRequest::new().set_location("example");
15006 /// ```
15007 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15008 self.location = v.into();
15009 self
15010 }
15011
15012 /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
15013 ///
15014 /// # Example
15015 /// ```ignore,no_run
15016 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15017 /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
15018 /// ```
15019 pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15020 self.length_bytes = v.into();
15021 self
15022 }
15023
15024 /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
15025 ///
15026 /// # Example
15027 /// ```ignore,no_run
15028 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15029 /// use google_cloud_kms_v1::model::ProtectionLevel;
15030 /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
15031 /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
15032 /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
15033 /// ```
15034 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15035 mut self,
15036 v: T,
15037 ) -> Self {
15038 self.protection_level = v.into();
15039 self
15040 }
15041}
15042
15043impl wkt::message::Message for GenerateRandomBytesRequest {
15044 fn typename() -> &'static str {
15045 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
15046 }
15047}
15048
15049/// Response message for
15050/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
15051///
15052/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
15053#[derive(Clone, Default, PartialEq)]
15054#[non_exhaustive]
15055pub struct EncryptResponse {
15056 /// The resource name of the
15057 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15058 /// encryption. Check this field to verify that the intended resource was used
15059 /// for encryption.
15060 ///
15061 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15062 pub name: std::string::String,
15063
15064 /// The encrypted data.
15065 pub ciphertext: ::bytes::Bytes,
15066
15067 /// Integrity verification field. A CRC32C checksum of the returned
15068 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
15069 /// An integrity check of
15070 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15071 /// can be performed by computing the CRC32C checksum of
15072 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15073 /// and comparing your results to this field. Discard the response in case of
15074 /// non-matching checksum values, and perform a limited number of retries. A
15075 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15076 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15077 /// across different languages. However, it is a non-negative integer, which
15078 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15079 /// languages that support this type.
15080 ///
15081 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
15082 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15083
15084 /// Integrity verification field. A flag indicating whether
15085 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15086 /// was received by
15087 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15088 /// for the integrity verification of the
15089 /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
15090 /// this field indicates either that
15091 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15092 /// was left unset or that it was not delivered to
15093 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15094 /// set
15095 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15096 /// but this field is still false, discard the response and perform a limited
15097 /// number of retries.
15098 ///
15099 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15100 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
15101 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15102 pub verified_plaintext_crc32c: bool,
15103
15104 /// Integrity verification field. A flag indicating whether
15105 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15106 /// was received by
15107 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15108 /// for the integrity verification of the
15109 /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
15110 /// false value of this field indicates either that
15111 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15112 /// was left unset or that it was not delivered to
15113 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15114 /// set
15115 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15116 /// but this field is still false, discard the response and perform a limited
15117 /// number of retries.
15118 ///
15119 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
15120 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
15121 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15122 pub verified_additional_authenticated_data_crc32c: bool,
15123
15124 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15125 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15126 /// encryption.
15127 ///
15128 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15129 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15130 pub protection_level: crate::model::ProtectionLevel,
15131
15132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15133}
15134
15135impl EncryptResponse {
15136 /// Creates a new default instance.
15137 pub fn new() -> Self {
15138 std::default::Default::default()
15139 }
15140
15141 /// Sets the value of [name][crate::model::EncryptResponse::name].
15142 ///
15143 /// # Example
15144 /// ```ignore,no_run
15145 /// # use google_cloud_kms_v1::model::EncryptResponse;
15146 /// let x = EncryptResponse::new().set_name("example");
15147 /// ```
15148 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15149 self.name = v.into();
15150 self
15151 }
15152
15153 /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
15154 ///
15155 /// # Example
15156 /// ```ignore,no_run
15157 /// # use google_cloud_kms_v1::model::EncryptResponse;
15158 /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15159 /// ```
15160 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15161 self.ciphertext = v.into();
15162 self
15163 }
15164
15165 /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15166 ///
15167 /// # Example
15168 /// ```ignore,no_run
15169 /// # use google_cloud_kms_v1::model::EncryptResponse;
15170 /// use wkt::Int64Value;
15171 /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15172 /// ```
15173 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15174 where
15175 T: std::convert::Into<wkt::Int64Value>,
15176 {
15177 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15178 self
15179 }
15180
15181 /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15182 ///
15183 /// # Example
15184 /// ```ignore,no_run
15185 /// # use google_cloud_kms_v1::model::EncryptResponse;
15186 /// use wkt::Int64Value;
15187 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15188 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15189 /// ```
15190 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15191 where
15192 T: std::convert::Into<wkt::Int64Value>,
15193 {
15194 self.ciphertext_crc32c = v.map(|x| x.into());
15195 self
15196 }
15197
15198 /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
15199 ///
15200 /// # Example
15201 /// ```ignore,no_run
15202 /// # use google_cloud_kms_v1::model::EncryptResponse;
15203 /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
15204 /// ```
15205 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15206 self.verified_plaintext_crc32c = v.into();
15207 self
15208 }
15209
15210 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
15211 ///
15212 /// # Example
15213 /// ```ignore,no_run
15214 /// # use google_cloud_kms_v1::model::EncryptResponse;
15215 /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15216 /// ```
15217 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15218 mut self,
15219 v: T,
15220 ) -> Self {
15221 self.verified_additional_authenticated_data_crc32c = v.into();
15222 self
15223 }
15224
15225 /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
15226 ///
15227 /// # Example
15228 /// ```ignore,no_run
15229 /// # use google_cloud_kms_v1::model::EncryptResponse;
15230 /// use google_cloud_kms_v1::model::ProtectionLevel;
15231 /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15232 /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15233 /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
15234 /// ```
15235 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15236 mut self,
15237 v: T,
15238 ) -> Self {
15239 self.protection_level = v.into();
15240 self
15241 }
15242}
15243
15244impl wkt::message::Message for EncryptResponse {
15245 fn typename() -> &'static str {
15246 "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
15247 }
15248}
15249
15250/// Response message for
15251/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
15252///
15253/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
15254#[derive(Clone, Default, PartialEq)]
15255#[non_exhaustive]
15256pub struct DecryptResponse {
15257 /// The decrypted data originally supplied in
15258 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
15259 ///
15260 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15261 pub plaintext: ::bytes::Bytes,
15262
15263 /// Integrity verification field. A CRC32C checksum of the returned
15264 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
15265 /// An integrity check of
15266 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15267 /// can be performed by computing the CRC32C checksum of
15268 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15269 /// and comparing your results to this field. Discard the response in case of
15270 /// non-matching checksum values, and perform a limited number of retries. A
15271 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15272 /// checksum. Note: receiving this response message indicates that
15273 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15274 /// successfully decrypt the
15275 /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
15276 /// field is defined as int64 for reasons of compatibility across different
15277 /// languages. However, it is a non-negative integer, which will never exceed
15278 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15279 /// this type.
15280 ///
15281 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
15282 /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
15283 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15284 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15285
15286 /// Whether the Decryption was performed using the primary key version.
15287 pub used_primary: bool,
15288
15289 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15290 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15291 /// decryption.
15292 ///
15293 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15294 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15295 pub protection_level: crate::model::ProtectionLevel,
15296
15297 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15298}
15299
15300impl DecryptResponse {
15301 /// Creates a new default instance.
15302 pub fn new() -> Self {
15303 std::default::Default::default()
15304 }
15305
15306 /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
15307 ///
15308 /// # Example
15309 /// ```ignore,no_run
15310 /// # use google_cloud_kms_v1::model::DecryptResponse;
15311 /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15312 /// ```
15313 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15314 self.plaintext = v.into();
15315 self
15316 }
15317
15318 /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15319 ///
15320 /// # Example
15321 /// ```ignore,no_run
15322 /// # use google_cloud_kms_v1::model::DecryptResponse;
15323 /// use wkt::Int64Value;
15324 /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15325 /// ```
15326 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15327 where
15328 T: std::convert::Into<wkt::Int64Value>,
15329 {
15330 self.plaintext_crc32c = std::option::Option::Some(v.into());
15331 self
15332 }
15333
15334 /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15335 ///
15336 /// # Example
15337 /// ```ignore,no_run
15338 /// # use google_cloud_kms_v1::model::DecryptResponse;
15339 /// use wkt::Int64Value;
15340 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15341 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15342 /// ```
15343 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15344 where
15345 T: std::convert::Into<wkt::Int64Value>,
15346 {
15347 self.plaintext_crc32c = v.map(|x| x.into());
15348 self
15349 }
15350
15351 /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
15352 ///
15353 /// # Example
15354 /// ```ignore,no_run
15355 /// # use google_cloud_kms_v1::model::DecryptResponse;
15356 /// let x = DecryptResponse::new().set_used_primary(true);
15357 /// ```
15358 pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15359 self.used_primary = v.into();
15360 self
15361 }
15362
15363 /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
15364 ///
15365 /// # Example
15366 /// ```ignore,no_run
15367 /// # use google_cloud_kms_v1::model::DecryptResponse;
15368 /// use google_cloud_kms_v1::model::ProtectionLevel;
15369 /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15370 /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15371 /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
15372 /// ```
15373 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15374 mut self,
15375 v: T,
15376 ) -> Self {
15377 self.protection_level = v.into();
15378 self
15379 }
15380}
15381
15382impl wkt::message::Message for DecryptResponse {
15383 fn typename() -> &'static str {
15384 "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
15385 }
15386}
15387
15388/// Response message for
15389/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
15390///
15391/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
15392#[derive(Clone, Default, PartialEq)]
15393#[non_exhaustive]
15394pub struct RawEncryptResponse {
15395 /// The encrypted data. In the case of AES-GCM, the authentication tag
15396 /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
15397 /// bytes at the end of this field.
15398 ///
15399 /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
15400 pub ciphertext: ::bytes::Bytes,
15401
15402 /// The initialization vector (IV) generated by the service during
15403 /// encryption. This value must be stored and provided in
15404 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
15405 /// at decryption time.
15406 ///
15407 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
15408 pub initialization_vector: ::bytes::Bytes,
15409
15410 /// The length of the authentication tag that is appended to
15411 /// the end of the ciphertext.
15412 pub tag_length: i32,
15413
15414 /// Integrity verification field. A CRC32C checksum of the returned
15415 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
15416 /// An integrity check of ciphertext can be performed by computing the CRC32C
15417 /// checksum of ciphertext and comparing your results to this field. Discard
15418 /// the response in case of non-matching checksum values, and perform a limited
15419 /// number of retries. A persistent mismatch may indicate an issue in your
15420 /// computation of the CRC32C checksum. Note: This field is defined as int64
15421 /// for reasons of compatibility across different languages. However, it is a
15422 /// non-negative integer, which will never exceed 2^32-1, and can be safely
15423 /// downconverted to uint32 in languages that support this type.
15424 ///
15425 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
15426 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15427
15428 /// Integrity verification field. A CRC32C checksum of the returned
15429 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
15430 /// An integrity check of initialization_vector can be performed by computing
15431 /// the CRC32C checksum of initialization_vector and comparing your results to
15432 /// this field. Discard the response in case of non-matching checksum values,
15433 /// and perform a limited number of retries. A persistent mismatch may indicate
15434 /// an issue in your computation of the CRC32C checksum. Note: This field is
15435 /// defined as int64 for reasons of compatibility across different languages.
15436 /// However, it is a non-negative integer, which will never exceed 2^32-1, and
15437 /// can be safely downconverted to uint32 in languages that support this type.
15438 ///
15439 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
15440 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
15441
15442 /// Integrity verification field. A flag indicating whether
15443 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15444 /// was received by
15445 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15446 /// for the integrity verification of the plaintext. A false value of this
15447 /// field indicates either that
15448 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15449 /// was left unset or that it was not delivered to
15450 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15451 /// set
15452 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15453 /// but this field is still false, discard the response and perform a limited
15454 /// number of retries.
15455 ///
15456 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15457 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
15458 pub verified_plaintext_crc32c: bool,
15459
15460 /// Integrity verification field. A flag indicating whether
15461 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15462 /// was received by
15463 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15464 /// for the integrity verification of additional_authenticated_data. A false
15465 /// value of this field indicates either that //
15466 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15467 /// was left unset or that it was not delivered to
15468 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15469 /// set
15470 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15471 /// but this field is still false, discard the response and perform a limited
15472 /// number of retries.
15473 ///
15474 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15475 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
15476 pub verified_additional_authenticated_data_crc32c: bool,
15477
15478 /// Integrity verification field. A flag indicating whether
15479 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15480 /// was received by
15481 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15482 /// for the integrity verification of initialization_vector. A false value of
15483 /// this field indicates either that
15484 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15485 /// was left unset or that it was not delivered to
15486 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15487 /// set
15488 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15489 /// but this field is still false, discard the response and perform a limited
15490 /// number of retries.
15491 ///
15492 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15493 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
15494 pub verified_initialization_vector_crc32c: bool,
15495
15496 /// The resource name of the
15497 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15498 /// encryption. Check this field to verify that the intended resource was used
15499 /// for encryption.
15500 ///
15501 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15502 pub name: std::string::String,
15503
15504 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15505 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15506 /// encryption.
15507 ///
15508 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15509 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15510 pub protection_level: crate::model::ProtectionLevel,
15511
15512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15513}
15514
15515impl RawEncryptResponse {
15516 /// Creates a new default instance.
15517 pub fn new() -> Self {
15518 std::default::Default::default()
15519 }
15520
15521 /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
15522 ///
15523 /// # Example
15524 /// ```ignore,no_run
15525 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15526 /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15527 /// ```
15528 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15529 self.ciphertext = v.into();
15530 self
15531 }
15532
15533 /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
15534 ///
15535 /// # Example
15536 /// ```ignore,no_run
15537 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15538 /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
15539 /// ```
15540 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
15541 mut self,
15542 v: T,
15543 ) -> Self {
15544 self.initialization_vector = v.into();
15545 self
15546 }
15547
15548 /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
15549 ///
15550 /// # Example
15551 /// ```ignore,no_run
15552 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15553 /// let x = RawEncryptResponse::new().set_tag_length(42);
15554 /// ```
15555 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15556 self.tag_length = v.into();
15557 self
15558 }
15559
15560 /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15561 ///
15562 /// # Example
15563 /// ```ignore,no_run
15564 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15565 /// use wkt::Int64Value;
15566 /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15567 /// ```
15568 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15569 where
15570 T: std::convert::Into<wkt::Int64Value>,
15571 {
15572 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15573 self
15574 }
15575
15576 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15577 ///
15578 /// # Example
15579 /// ```ignore,no_run
15580 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15581 /// use wkt::Int64Value;
15582 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15583 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15584 /// ```
15585 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15586 where
15587 T: std::convert::Into<wkt::Int64Value>,
15588 {
15589 self.ciphertext_crc32c = v.map(|x| x.into());
15590 self
15591 }
15592
15593 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15594 ///
15595 /// # Example
15596 /// ```ignore,no_run
15597 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15598 /// use wkt::Int64Value;
15599 /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
15600 /// ```
15601 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
15602 where
15603 T: std::convert::Into<wkt::Int64Value>,
15604 {
15605 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
15606 self
15607 }
15608
15609 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15610 ///
15611 /// # Example
15612 /// ```ignore,no_run
15613 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15614 /// use wkt::Int64Value;
15615 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
15616 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
15617 /// ```
15618 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15619 where
15620 T: std::convert::Into<wkt::Int64Value>,
15621 {
15622 self.initialization_vector_crc32c = v.map(|x| x.into());
15623 self
15624 }
15625
15626 /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
15627 ///
15628 /// # Example
15629 /// ```ignore,no_run
15630 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15631 /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
15632 /// ```
15633 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15634 self.verified_plaintext_crc32c = v.into();
15635 self
15636 }
15637
15638 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
15639 ///
15640 /// # Example
15641 /// ```ignore,no_run
15642 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15643 /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15644 /// ```
15645 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15646 mut self,
15647 v: T,
15648 ) -> Self {
15649 self.verified_additional_authenticated_data_crc32c = v.into();
15650 self
15651 }
15652
15653 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
15654 ///
15655 /// # Example
15656 /// ```ignore,no_run
15657 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15658 /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
15659 /// ```
15660 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15661 mut self,
15662 v: T,
15663 ) -> Self {
15664 self.verified_initialization_vector_crc32c = v.into();
15665 self
15666 }
15667
15668 /// Sets the value of [name][crate::model::RawEncryptResponse::name].
15669 ///
15670 /// # Example
15671 /// ```ignore,no_run
15672 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15673 /// let x = RawEncryptResponse::new().set_name("example");
15674 /// ```
15675 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15676 self.name = v.into();
15677 self
15678 }
15679
15680 /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
15681 ///
15682 /// # Example
15683 /// ```ignore,no_run
15684 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15685 /// use google_cloud_kms_v1::model::ProtectionLevel;
15686 /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15687 /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15688 /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
15689 /// ```
15690 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15691 mut self,
15692 v: T,
15693 ) -> Self {
15694 self.protection_level = v.into();
15695 self
15696 }
15697}
15698
15699impl wkt::message::Message for RawEncryptResponse {
15700 fn typename() -> &'static str {
15701 "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
15702 }
15703}
15704
15705/// Response message for
15706/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
15707///
15708/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
15709#[derive(Clone, Default, PartialEq)]
15710#[non_exhaustive]
15711pub struct RawDecryptResponse {
15712 /// The decrypted data.
15713 pub plaintext: ::bytes::Bytes,
15714
15715 /// Integrity verification field. A CRC32C checksum of the returned
15716 /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
15717 /// An integrity check of plaintext can be performed by computing the CRC32C
15718 /// checksum of plaintext and comparing your results to this field. Discard the
15719 /// response in case of non-matching checksum values, and perform a limited
15720 /// number of retries. A persistent mismatch may indicate an issue in your
15721 /// computation of the CRC32C checksum. Note: receiving this response message
15722 /// indicates that
15723 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15724 /// successfully decrypt the
15725 /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
15726 /// Note: This field is defined as int64 for reasons of compatibility across
15727 /// different languages. However, it is a non-negative integer, which will
15728 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
15729 /// that support this type.
15730 ///
15731 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15732 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
15733 /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
15734 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15735
15736 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15737 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15738 /// decryption.
15739 ///
15740 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15741 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15742 pub protection_level: crate::model::ProtectionLevel,
15743
15744 /// Integrity verification field. A flag indicating whether
15745 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15746 /// was received by
15747 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15748 /// for the integrity verification of the ciphertext. A false value of this
15749 /// field indicates either that
15750 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15751 /// was left unset or that it was not delivered to
15752 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15753 /// set
15754 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15755 /// but this field is still false, discard the response and perform a limited
15756 /// number of retries.
15757 ///
15758 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15759 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
15760 pub verified_ciphertext_crc32c: bool,
15761
15762 /// Integrity verification field. A flag indicating whether
15763 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15764 /// was received by
15765 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15766 /// for the integrity verification of additional_authenticated_data. A false
15767 /// value of this field indicates either that //
15768 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15769 /// was left unset or that it was not delivered to
15770 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15771 /// set
15772 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15773 /// but this field is still false, discard the response and perform a limited
15774 /// number of retries.
15775 ///
15776 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15777 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
15778 pub verified_additional_authenticated_data_crc32c: bool,
15779
15780 /// Integrity verification field. A flag indicating whether
15781 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15782 /// was received by
15783 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15784 /// for the integrity verification of initialization_vector. A false value of
15785 /// this field indicates either that
15786 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15787 /// was left unset or that it was not delivered to
15788 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15789 /// set
15790 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15791 /// but this field is still false, discard the response and perform a limited
15792 /// number of retries.
15793 ///
15794 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15795 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
15796 pub verified_initialization_vector_crc32c: bool,
15797
15798 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15799}
15800
15801impl RawDecryptResponse {
15802 /// Creates a new default instance.
15803 pub fn new() -> Self {
15804 std::default::Default::default()
15805 }
15806
15807 /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
15808 ///
15809 /// # Example
15810 /// ```ignore,no_run
15811 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15812 /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15813 /// ```
15814 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15815 self.plaintext = v.into();
15816 self
15817 }
15818
15819 /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15820 ///
15821 /// # Example
15822 /// ```ignore,no_run
15823 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15824 /// use wkt::Int64Value;
15825 /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15826 /// ```
15827 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15828 where
15829 T: std::convert::Into<wkt::Int64Value>,
15830 {
15831 self.plaintext_crc32c = std::option::Option::Some(v.into());
15832 self
15833 }
15834
15835 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15836 ///
15837 /// # Example
15838 /// ```ignore,no_run
15839 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15840 /// use wkt::Int64Value;
15841 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15842 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15843 /// ```
15844 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15845 where
15846 T: std::convert::Into<wkt::Int64Value>,
15847 {
15848 self.plaintext_crc32c = v.map(|x| x.into());
15849 self
15850 }
15851
15852 /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
15853 ///
15854 /// # Example
15855 /// ```ignore,no_run
15856 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15857 /// use google_cloud_kms_v1::model::ProtectionLevel;
15858 /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15859 /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15860 /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
15861 /// ```
15862 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15863 mut self,
15864 v: T,
15865 ) -> Self {
15866 self.protection_level = v.into();
15867 self
15868 }
15869
15870 /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
15871 ///
15872 /// # Example
15873 /// ```ignore,no_run
15874 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15875 /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
15876 /// ```
15877 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15878 self.verified_ciphertext_crc32c = v.into();
15879 self
15880 }
15881
15882 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
15883 ///
15884 /// # Example
15885 /// ```ignore,no_run
15886 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15887 /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15888 /// ```
15889 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15890 mut self,
15891 v: T,
15892 ) -> Self {
15893 self.verified_additional_authenticated_data_crc32c = v.into();
15894 self
15895 }
15896
15897 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
15898 ///
15899 /// # Example
15900 /// ```ignore,no_run
15901 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15902 /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
15903 /// ```
15904 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15905 mut self,
15906 v: T,
15907 ) -> Self {
15908 self.verified_initialization_vector_crc32c = v.into();
15909 self
15910 }
15911}
15912
15913impl wkt::message::Message for RawDecryptResponse {
15914 fn typename() -> &'static str {
15915 "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
15916 }
15917}
15918
15919/// Response message for
15920/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
15921///
15922/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
15923#[derive(Clone, Default, PartialEq)]
15924#[non_exhaustive]
15925pub struct AsymmetricSignResponse {
15926 /// The created signature.
15927 pub signature: ::bytes::Bytes,
15928
15929 /// Integrity verification field. A CRC32C checksum of the returned
15930 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
15931 /// An integrity check of
15932 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15933 /// can be performed by computing the CRC32C checksum of
15934 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15935 /// and comparing your results to this field. Discard the response in case of
15936 /// non-matching checksum values, and perform a limited number of retries. A
15937 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15938 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15939 /// across different languages. However, it is a non-negative integer, which
15940 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15941 /// languages that support this type.
15942 ///
15943 /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
15944 pub signature_crc32c: std::option::Option<wkt::Int64Value>,
15945
15946 /// Integrity verification field. A flag indicating whether
15947 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15948 /// was received by
15949 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15950 /// for the integrity verification of the
15951 /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
15952 /// of this field indicates either that
15953 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15954 /// was left unset or that it was not delivered to
15955 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15956 /// set
15957 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15958 /// but this field is still false, discard the response and perform a limited
15959 /// number of retries.
15960 ///
15961 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
15962 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
15963 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15964 pub verified_digest_crc32c: bool,
15965
15966 /// The resource name of the
15967 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15968 /// Check this field to verify that the intended resource was used for signing.
15969 ///
15970 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15971 pub name: std::string::String,
15972
15973 /// Integrity verification field. A flag indicating whether
15974 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15975 /// was received by
15976 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15977 /// for the integrity verification of the
15978 /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
15979 /// this field indicates either that
15980 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15981 /// was left unset or that it was not delivered to
15982 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15983 /// set
15984 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15985 /// but this field is still false, discard the response and perform a limited
15986 /// number of retries.
15987 ///
15988 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
15989 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
15990 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15991 pub verified_data_crc32c: bool,
15992
15993 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15994 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15995 ///
15996 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15997 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15998 pub protection_level: crate::model::ProtectionLevel,
15999
16000 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16001}
16002
16003impl AsymmetricSignResponse {
16004 /// Creates a new default instance.
16005 pub fn new() -> Self {
16006 std::default::Default::default()
16007 }
16008
16009 /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
16010 ///
16011 /// # Example
16012 /// ```ignore,no_run
16013 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16014 /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
16015 /// ```
16016 pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16017 self.signature = v.into();
16018 self
16019 }
16020
16021 /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16022 ///
16023 /// # Example
16024 /// ```ignore,no_run
16025 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16026 /// use wkt::Int64Value;
16027 /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
16028 /// ```
16029 pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
16030 where
16031 T: std::convert::Into<wkt::Int64Value>,
16032 {
16033 self.signature_crc32c = std::option::Option::Some(v.into());
16034 self
16035 }
16036
16037 /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16038 ///
16039 /// # Example
16040 /// ```ignore,no_run
16041 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16042 /// use wkt::Int64Value;
16043 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
16044 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
16045 /// ```
16046 pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16047 where
16048 T: std::convert::Into<wkt::Int64Value>,
16049 {
16050 self.signature_crc32c = v.map(|x| x.into());
16051 self
16052 }
16053
16054 /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
16055 ///
16056 /// # Example
16057 /// ```ignore,no_run
16058 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16059 /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
16060 /// ```
16061 pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16062 self.verified_digest_crc32c = v.into();
16063 self
16064 }
16065
16066 /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
16067 ///
16068 /// # Example
16069 /// ```ignore,no_run
16070 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16071 /// let x = AsymmetricSignResponse::new().set_name("example");
16072 /// ```
16073 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16074 self.name = v.into();
16075 self
16076 }
16077
16078 /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
16079 ///
16080 /// # Example
16081 /// ```ignore,no_run
16082 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16083 /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
16084 /// ```
16085 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16086 self.verified_data_crc32c = v.into();
16087 self
16088 }
16089
16090 /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
16091 ///
16092 /// # Example
16093 /// ```ignore,no_run
16094 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16095 /// use google_cloud_kms_v1::model::ProtectionLevel;
16096 /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
16097 /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16098 /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
16099 /// ```
16100 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16101 mut self,
16102 v: T,
16103 ) -> Self {
16104 self.protection_level = v.into();
16105 self
16106 }
16107}
16108
16109impl wkt::message::Message for AsymmetricSignResponse {
16110 fn typename() -> &'static str {
16111 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
16112 }
16113}
16114
16115/// Response message for
16116/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
16117///
16118/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
16119#[derive(Clone, Default, PartialEq)]
16120#[non_exhaustive]
16121pub struct AsymmetricDecryptResponse {
16122 /// The decrypted data originally encrypted with the matching public key.
16123 pub plaintext: ::bytes::Bytes,
16124
16125 /// Integrity verification field. A CRC32C checksum of the returned
16126 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
16127 /// An integrity check of
16128 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
16129 /// can be performed by computing the CRC32C checksum of
16130 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
16131 /// and comparing your results to this field. Discard the response in case of
16132 /// non-matching checksum values, and perform a limited number of retries. A
16133 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16134 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16135 /// across different languages. However, it is a non-negative integer, which
16136 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16137 /// languages that support this type.
16138 ///
16139 /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
16140 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16141
16142 /// Integrity verification field. A flag indicating whether
16143 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16144 /// was received by
16145 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16146 /// for the integrity verification of the
16147 /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
16148 /// false value of this field indicates either that
16149 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16150 /// was left unset or that it was not delivered to
16151 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16152 /// set
16153 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16154 /// but this field is still false, discard the response and perform a limited
16155 /// number of retries.
16156 ///
16157 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
16158 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
16159 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16160 pub verified_ciphertext_crc32c: bool,
16161
16162 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16163 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16164 /// decryption.
16165 ///
16166 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16167 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16168 pub protection_level: crate::model::ProtectionLevel,
16169
16170 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16171}
16172
16173impl AsymmetricDecryptResponse {
16174 /// Creates a new default instance.
16175 pub fn new() -> Self {
16176 std::default::Default::default()
16177 }
16178
16179 /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
16180 ///
16181 /// # Example
16182 /// ```ignore,no_run
16183 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16184 /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16185 /// ```
16186 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16187 self.plaintext = v.into();
16188 self
16189 }
16190
16191 /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16192 ///
16193 /// # Example
16194 /// ```ignore,no_run
16195 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16196 /// use wkt::Int64Value;
16197 /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16198 /// ```
16199 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16200 where
16201 T: std::convert::Into<wkt::Int64Value>,
16202 {
16203 self.plaintext_crc32c = std::option::Option::Some(v.into());
16204 self
16205 }
16206
16207 /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16208 ///
16209 /// # Example
16210 /// ```ignore,no_run
16211 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16212 /// use wkt::Int64Value;
16213 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16214 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16215 /// ```
16216 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16217 where
16218 T: std::convert::Into<wkt::Int64Value>,
16219 {
16220 self.plaintext_crc32c = v.map(|x| x.into());
16221 self
16222 }
16223
16224 /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
16225 ///
16226 /// # Example
16227 /// ```ignore,no_run
16228 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16229 /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16230 /// ```
16231 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16232 self.verified_ciphertext_crc32c = v.into();
16233 self
16234 }
16235
16236 /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
16237 ///
16238 /// # Example
16239 /// ```ignore,no_run
16240 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16241 /// use google_cloud_kms_v1::model::ProtectionLevel;
16242 /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16243 /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16244 /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16245 /// ```
16246 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16247 mut self,
16248 v: T,
16249 ) -> Self {
16250 self.protection_level = v.into();
16251 self
16252 }
16253}
16254
16255impl wkt::message::Message for AsymmetricDecryptResponse {
16256 fn typename() -> &'static str {
16257 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
16258 }
16259}
16260
16261/// Response message for
16262/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
16263///
16264/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
16265#[derive(Clone, Default, PartialEq)]
16266#[non_exhaustive]
16267pub struct MacSignResponse {
16268 /// The resource name of the
16269 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16270 /// Check this field to verify that the intended resource was used for signing.
16271 ///
16272 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16273 pub name: std::string::String,
16274
16275 /// The created signature.
16276 pub mac: ::bytes::Bytes,
16277
16278 /// Integrity verification field. A CRC32C checksum of the returned
16279 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
16280 /// integrity check of
16281 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
16282 /// performed by computing the CRC32C checksum of
16283 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
16284 /// comparing your results to this field. Discard the response in case of
16285 /// non-matching checksum values, and perform a limited number of retries. A
16286 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16287 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16288 /// across different languages. However, it is a non-negative integer, which
16289 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16290 /// languages that support this type.
16291 ///
16292 /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
16293 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
16294
16295 /// Integrity verification field. A flag indicating whether
16296 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16297 /// was received by
16298 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16299 /// for the integrity verification of the
16300 /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
16301 /// field indicates either that
16302 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16303 /// was left unset or that it was not delivered to
16304 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16305 /// set
16306 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16307 /// but this field is still false, discard the response and perform a limited
16308 /// number of retries.
16309 ///
16310 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16311 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
16312 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
16313 pub verified_data_crc32c: bool,
16314
16315 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16316 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16317 ///
16318 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16319 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16320 pub protection_level: crate::model::ProtectionLevel,
16321
16322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16323}
16324
16325impl MacSignResponse {
16326 /// Creates a new default instance.
16327 pub fn new() -> Self {
16328 std::default::Default::default()
16329 }
16330
16331 /// Sets the value of [name][crate::model::MacSignResponse::name].
16332 ///
16333 /// # Example
16334 /// ```ignore,no_run
16335 /// # use google_cloud_kms_v1::model::MacSignResponse;
16336 /// let x = MacSignResponse::new().set_name("example");
16337 /// ```
16338 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16339 self.name = v.into();
16340 self
16341 }
16342
16343 /// Sets the value of [mac][crate::model::MacSignResponse::mac].
16344 ///
16345 /// # Example
16346 /// ```ignore,no_run
16347 /// # use google_cloud_kms_v1::model::MacSignResponse;
16348 /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
16349 /// ```
16350 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16351 self.mac = v.into();
16352 self
16353 }
16354
16355 /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16356 ///
16357 /// # Example
16358 /// ```ignore,no_run
16359 /// # use google_cloud_kms_v1::model::MacSignResponse;
16360 /// use wkt::Int64Value;
16361 /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
16362 /// ```
16363 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
16364 where
16365 T: std::convert::Into<wkt::Int64Value>,
16366 {
16367 self.mac_crc32c = std::option::Option::Some(v.into());
16368 self
16369 }
16370
16371 /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16372 ///
16373 /// # Example
16374 /// ```ignore,no_run
16375 /// # use google_cloud_kms_v1::model::MacSignResponse;
16376 /// use wkt::Int64Value;
16377 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
16378 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
16379 /// ```
16380 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16381 where
16382 T: std::convert::Into<wkt::Int64Value>,
16383 {
16384 self.mac_crc32c = v.map(|x| x.into());
16385 self
16386 }
16387
16388 /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
16389 ///
16390 /// # Example
16391 /// ```ignore,no_run
16392 /// # use google_cloud_kms_v1::model::MacSignResponse;
16393 /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
16394 /// ```
16395 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16396 self.verified_data_crc32c = v.into();
16397 self
16398 }
16399
16400 /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
16401 ///
16402 /// # Example
16403 /// ```ignore,no_run
16404 /// # use google_cloud_kms_v1::model::MacSignResponse;
16405 /// use google_cloud_kms_v1::model::ProtectionLevel;
16406 /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
16407 /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16408 /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
16409 /// ```
16410 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16411 mut self,
16412 v: T,
16413 ) -> Self {
16414 self.protection_level = v.into();
16415 self
16416 }
16417}
16418
16419impl wkt::message::Message for MacSignResponse {
16420 fn typename() -> &'static str {
16421 "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
16422 }
16423}
16424
16425/// Response message for
16426/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
16427///
16428/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
16429#[derive(Clone, Default, PartialEq)]
16430#[non_exhaustive]
16431pub struct MacVerifyResponse {
16432 /// The resource name of the
16433 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16434 /// verification. Check this field to verify that the intended resource was
16435 /// used for verification.
16436 ///
16437 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16438 pub name: std::string::String,
16439
16440 /// This field indicates whether or not the verification operation for
16441 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
16442 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
16443 /// successful.
16444 ///
16445 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16446 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16447 pub success: bool,
16448
16449 /// Integrity verification field. A flag indicating whether
16450 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16451 /// was received by
16452 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16453 /// for the integrity verification of the
16454 /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
16455 /// field indicates either that
16456 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16457 /// was left unset or that it was not delivered to
16458 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16459 /// set
16460 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16461 /// but this field is still false, discard the response and perform a limited
16462 /// number of retries.
16463 ///
16464 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16465 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16466 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
16467 pub verified_data_crc32c: bool,
16468
16469 /// Integrity verification field. A flag indicating whether
16470 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16471 /// was received by
16472 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16473 /// for the integrity verification of the
16474 /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
16475 /// field indicates either that
16476 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16477 /// was left unset or that it was not delivered to
16478 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16479 /// set
16480 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16481 /// but this field is still false, discard the response and perform a limited
16482 /// number of retries.
16483 ///
16484 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16485 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16486 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
16487 pub verified_mac_crc32c: bool,
16488
16489 /// Integrity verification field. This value is used for the integrity
16490 /// verification of [MacVerifyResponse.success]. If the value of this field
16491 /// contradicts the value of [MacVerifyResponse.success], discard the response
16492 /// and perform a limited number of retries.
16493 pub verified_success_integrity: bool,
16494
16495 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16496 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16497 /// verification.
16498 ///
16499 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16500 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16501 pub protection_level: crate::model::ProtectionLevel,
16502
16503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16504}
16505
16506impl MacVerifyResponse {
16507 /// Creates a new default instance.
16508 pub fn new() -> Self {
16509 std::default::Default::default()
16510 }
16511
16512 /// Sets the value of [name][crate::model::MacVerifyResponse::name].
16513 ///
16514 /// # Example
16515 /// ```ignore,no_run
16516 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16517 /// let x = MacVerifyResponse::new().set_name("example");
16518 /// ```
16519 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16520 self.name = v.into();
16521 self
16522 }
16523
16524 /// Sets the value of [success][crate::model::MacVerifyResponse::success].
16525 ///
16526 /// # Example
16527 /// ```ignore,no_run
16528 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16529 /// let x = MacVerifyResponse::new().set_success(true);
16530 /// ```
16531 pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16532 self.success = v.into();
16533 self
16534 }
16535
16536 /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
16537 ///
16538 /// # Example
16539 /// ```ignore,no_run
16540 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16541 /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
16542 /// ```
16543 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16544 self.verified_data_crc32c = v.into();
16545 self
16546 }
16547
16548 /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
16549 ///
16550 /// # Example
16551 /// ```ignore,no_run
16552 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16553 /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
16554 /// ```
16555 pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16556 self.verified_mac_crc32c = v.into();
16557 self
16558 }
16559
16560 /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
16561 ///
16562 /// # Example
16563 /// ```ignore,no_run
16564 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16565 /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
16566 /// ```
16567 pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16568 self.verified_success_integrity = v.into();
16569 self
16570 }
16571
16572 /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
16573 ///
16574 /// # Example
16575 /// ```ignore,no_run
16576 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16577 /// use google_cloud_kms_v1::model::ProtectionLevel;
16578 /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
16579 /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
16580 /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
16581 /// ```
16582 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16583 mut self,
16584 v: T,
16585 ) -> Self {
16586 self.protection_level = v.into();
16587 self
16588 }
16589}
16590
16591impl wkt::message::Message for MacVerifyResponse {
16592 fn typename() -> &'static str {
16593 "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
16594 }
16595}
16596
16597/// Response message for
16598/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
16599///
16600/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
16601#[derive(Clone, Default, PartialEq)]
16602#[non_exhaustive]
16603pub struct DecapsulateResponse {
16604 /// The resource name of the
16605 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16606 /// decapsulation. Check this field to verify that the intended resource was
16607 /// used for decapsulation.
16608 ///
16609 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16610 pub name: std::string::String,
16611
16612 /// The decapsulated shared_secret originally encapsulated with the matching
16613 /// public key.
16614 pub shared_secret: ::bytes::Bytes,
16615
16616 /// Integrity verification field. A CRC32C checksum of the returned
16617 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
16618 /// An integrity check of
16619 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16620 /// can be performed by computing the CRC32C checksum of
16621 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16622 /// and comparing your results to this field. Discard the response in case of
16623 /// non-matching checksum values, and perform a limited number of retries. A
16624 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16625 /// checksum. Note: receiving this response message indicates that
16626 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16627 /// successfully decrypt the
16628 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
16629 /// field is defined as int64 for reasons of compatibility across different
16630 /// languages. However, it is a non-negative integer, which will never exceed
16631 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
16632 /// this type.
16633 ///
16634 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16635 /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
16636 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16637 pub shared_secret_crc32c: std::option::Option<i64>,
16638
16639 /// Integrity verification field. A flag indicating whether
16640 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16641 /// was received by
16642 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16643 /// for the integrity verification of the
16644 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
16645 /// value of this field indicates either that
16646 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16647 /// was left unset or that it was not delivered to
16648 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16649 /// set
16650 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16651 /// but this field is still false, discard the response and perform a limited
16652 /// number of retries.
16653 ///
16654 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16655 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
16656 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16657 pub verified_ciphertext_crc32c: bool,
16658
16659 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16660 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16661 /// decapsulation.
16662 ///
16663 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16664 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16665 pub protection_level: crate::model::ProtectionLevel,
16666
16667 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16668}
16669
16670impl DecapsulateResponse {
16671 /// Creates a new default instance.
16672 pub fn new() -> Self {
16673 std::default::Default::default()
16674 }
16675
16676 /// Sets the value of [name][crate::model::DecapsulateResponse::name].
16677 ///
16678 /// # Example
16679 /// ```ignore,no_run
16680 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16681 /// let x = DecapsulateResponse::new().set_name("example");
16682 /// ```
16683 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16684 self.name = v.into();
16685 self
16686 }
16687
16688 /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
16689 ///
16690 /// # Example
16691 /// ```ignore,no_run
16692 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16693 /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
16694 /// ```
16695 pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16696 self.shared_secret = v.into();
16697 self
16698 }
16699
16700 /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16701 ///
16702 /// # Example
16703 /// ```ignore,no_run
16704 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16705 /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
16706 /// ```
16707 pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
16708 where
16709 T: std::convert::Into<i64>,
16710 {
16711 self.shared_secret_crc32c = std::option::Option::Some(v.into());
16712 self
16713 }
16714
16715 /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16716 ///
16717 /// # Example
16718 /// ```ignore,no_run
16719 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16720 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
16721 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
16722 /// ```
16723 pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16724 where
16725 T: std::convert::Into<i64>,
16726 {
16727 self.shared_secret_crc32c = v.map(|x| x.into());
16728 self
16729 }
16730
16731 /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
16732 ///
16733 /// # Example
16734 /// ```ignore,no_run
16735 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16736 /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
16737 /// ```
16738 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16739 self.verified_ciphertext_crc32c = v.into();
16740 self
16741 }
16742
16743 /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
16744 ///
16745 /// # Example
16746 /// ```ignore,no_run
16747 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16748 /// use google_cloud_kms_v1::model::ProtectionLevel;
16749 /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
16750 /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
16751 /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
16752 /// ```
16753 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16754 mut self,
16755 v: T,
16756 ) -> Self {
16757 self.protection_level = v.into();
16758 self
16759 }
16760}
16761
16762impl wkt::message::Message for DecapsulateResponse {
16763 fn typename() -> &'static str {
16764 "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
16765 }
16766}
16767
16768/// Response message for
16769/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
16770///
16771/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
16772#[derive(Clone, Default, PartialEq)]
16773#[non_exhaustive]
16774pub struct GenerateRandomBytesResponse {
16775 /// The generated data.
16776 pub data: ::bytes::Bytes,
16777
16778 /// Integrity verification field. A CRC32C checksum of the returned
16779 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
16780 /// An integrity check of
16781 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16782 /// can be performed by computing the CRC32C checksum of
16783 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16784 /// and comparing your results to this field. Discard the response in case of
16785 /// non-matching checksum values, and perform a limited number of retries. A
16786 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16787 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16788 /// across different languages. However, it is a non-negative integer, which
16789 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16790 /// languages that support this type.
16791 ///
16792 /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
16793 pub data_crc32c: std::option::Option<wkt::Int64Value>,
16794
16795 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16796}
16797
16798impl GenerateRandomBytesResponse {
16799 /// Creates a new default instance.
16800 pub fn new() -> Self {
16801 std::default::Default::default()
16802 }
16803
16804 /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
16805 ///
16806 /// # Example
16807 /// ```ignore,no_run
16808 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16809 /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
16810 /// ```
16811 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16812 self.data = v.into();
16813 self
16814 }
16815
16816 /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16817 ///
16818 /// # Example
16819 /// ```ignore,no_run
16820 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16821 /// use wkt::Int64Value;
16822 /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
16823 /// ```
16824 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
16825 where
16826 T: std::convert::Into<wkt::Int64Value>,
16827 {
16828 self.data_crc32c = std::option::Option::Some(v.into());
16829 self
16830 }
16831
16832 /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16833 ///
16834 /// # Example
16835 /// ```ignore,no_run
16836 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16837 /// use wkt::Int64Value;
16838 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
16839 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
16840 /// ```
16841 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16842 where
16843 T: std::convert::Into<wkt::Int64Value>,
16844 {
16845 self.data_crc32c = v.map(|x| x.into());
16846 self
16847 }
16848}
16849
16850impl wkt::message::Message for GenerateRandomBytesResponse {
16851 fn typename() -> &'static str {
16852 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
16853 }
16854}
16855
16856/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
16857///
16858/// [google.cloud.kms.v1.Digest]: crate::model::Digest
16859#[derive(Clone, Default, PartialEq)]
16860#[non_exhaustive]
16861pub struct Digest {
16862 /// Required. The message digest.
16863 pub digest: std::option::Option<crate::model::digest::Digest>,
16864
16865 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16866}
16867
16868impl Digest {
16869 /// Creates a new default instance.
16870 pub fn new() -> Self {
16871 std::default::Default::default()
16872 }
16873
16874 /// Sets the value of [digest][crate::model::Digest::digest].
16875 ///
16876 /// Note that all the setters affecting `digest` are mutually
16877 /// exclusive.
16878 ///
16879 /// # Example
16880 /// ```ignore,no_run
16881 /// # use google_cloud_kms_v1::model::Digest;
16882 /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
16883 /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
16884 /// ```
16885 pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
16886 mut self,
16887 v: T,
16888 ) -> Self {
16889 self.digest = v.into();
16890 self
16891 }
16892
16893 /// The value of [digest][crate::model::Digest::digest]
16894 /// if it holds a `Sha256`, `None` if the field is not set or
16895 /// holds a different branch.
16896 pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
16897 #[allow(unreachable_patterns)]
16898 self.digest.as_ref().and_then(|v| match v {
16899 crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
16900 _ => std::option::Option::None,
16901 })
16902 }
16903
16904 /// Sets the value of [digest][crate::model::Digest::digest]
16905 /// to hold a `Sha256`.
16906 ///
16907 /// Note that all the setters affecting `digest` are
16908 /// mutually exclusive.
16909 ///
16910 /// # Example
16911 /// ```ignore,no_run
16912 /// # use google_cloud_kms_v1::model::Digest;
16913 /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
16914 /// assert!(x.sha256().is_some());
16915 /// assert!(x.sha384().is_none());
16916 /// assert!(x.sha512().is_none());
16917 /// assert!(x.external_mu().is_none());
16918 /// ```
16919 pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16920 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
16921 self
16922 }
16923
16924 /// The value of [digest][crate::model::Digest::digest]
16925 /// if it holds a `Sha384`, `None` if the field is not set or
16926 /// holds a different branch.
16927 pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
16928 #[allow(unreachable_patterns)]
16929 self.digest.as_ref().and_then(|v| match v {
16930 crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
16931 _ => std::option::Option::None,
16932 })
16933 }
16934
16935 /// Sets the value of [digest][crate::model::Digest::digest]
16936 /// to hold a `Sha384`.
16937 ///
16938 /// Note that all the setters affecting `digest` are
16939 /// mutually exclusive.
16940 ///
16941 /// # Example
16942 /// ```ignore,no_run
16943 /// # use google_cloud_kms_v1::model::Digest;
16944 /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
16945 /// assert!(x.sha384().is_some());
16946 /// assert!(x.sha256().is_none());
16947 /// assert!(x.sha512().is_none());
16948 /// assert!(x.external_mu().is_none());
16949 /// ```
16950 pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16951 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
16952 self
16953 }
16954
16955 /// The value of [digest][crate::model::Digest::digest]
16956 /// if it holds a `Sha512`, `None` if the field is not set or
16957 /// holds a different branch.
16958 pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
16959 #[allow(unreachable_patterns)]
16960 self.digest.as_ref().and_then(|v| match v {
16961 crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
16962 _ => std::option::Option::None,
16963 })
16964 }
16965
16966 /// Sets the value of [digest][crate::model::Digest::digest]
16967 /// to hold a `Sha512`.
16968 ///
16969 /// Note that all the setters affecting `digest` are
16970 /// mutually exclusive.
16971 ///
16972 /// # Example
16973 /// ```ignore,no_run
16974 /// # use google_cloud_kms_v1::model::Digest;
16975 /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
16976 /// assert!(x.sha512().is_some());
16977 /// assert!(x.sha256().is_none());
16978 /// assert!(x.sha384().is_none());
16979 /// assert!(x.external_mu().is_none());
16980 /// ```
16981 pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16982 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
16983 self
16984 }
16985
16986 /// The value of [digest][crate::model::Digest::digest]
16987 /// if it holds a `ExternalMu`, `None` if the field is not set or
16988 /// holds a different branch.
16989 pub fn external_mu(&self) -> std::option::Option<&::bytes::Bytes> {
16990 #[allow(unreachable_patterns)]
16991 self.digest.as_ref().and_then(|v| match v {
16992 crate::model::digest::Digest::ExternalMu(v) => std::option::Option::Some(v),
16993 _ => std::option::Option::None,
16994 })
16995 }
16996
16997 /// Sets the value of [digest][crate::model::Digest::digest]
16998 /// to hold a `ExternalMu`.
16999 ///
17000 /// Note that all the setters affecting `digest` are
17001 /// mutually exclusive.
17002 ///
17003 /// # Example
17004 /// ```ignore,no_run
17005 /// # use google_cloud_kms_v1::model::Digest;
17006 /// let x = Digest::new().set_external_mu(bytes::Bytes::from_static(b"example"));
17007 /// assert!(x.external_mu().is_some());
17008 /// assert!(x.sha256().is_none());
17009 /// assert!(x.sha384().is_none());
17010 /// assert!(x.sha512().is_none());
17011 /// ```
17012 pub fn set_external_mu<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17013 self.digest = std::option::Option::Some(crate::model::digest::Digest::ExternalMu(v.into()));
17014 self
17015 }
17016}
17017
17018impl wkt::message::Message for Digest {
17019 fn typename() -> &'static str {
17020 "type.googleapis.com/google.cloud.kms.v1.Digest"
17021 }
17022}
17023
17024/// Defines additional types related to [Digest].
17025pub mod digest {
17026 #[allow(unused_imports)]
17027 use super::*;
17028
17029 /// Required. The message digest.
17030 #[derive(Clone, Debug, PartialEq)]
17031 #[non_exhaustive]
17032 pub enum Digest {
17033 /// A message digest produced with the SHA-256 algorithm.
17034 Sha256(::bytes::Bytes),
17035 /// A message digest produced with the SHA-384 algorithm.
17036 Sha384(::bytes::Bytes),
17037 /// A message digest produced with the SHA-512 algorithm.
17038 Sha512(::bytes::Bytes),
17039 /// A message digest produced with SHAKE-256, to be used with ML-DSA
17040 /// external-μ algorithms only. See "message representative" note in
17041 /// section 6.2, algorithm 7 of the FIPS-204 standard:
17042 /// <https://doi.org/10.6028/nist.fips.204>
17043 ExternalMu(::bytes::Bytes),
17044 }
17045}
17046
17047/// Cloud KMS metadata for the given
17048/// [google.cloud.location.Location][google.cloud.location.Location].
17049///
17050/// [google.cloud.location.Location]: google_cloud_location::model::Location
17051#[derive(Clone, Default, PartialEq)]
17052#[non_exhaustive]
17053pub struct LocationMetadata {
17054 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17055 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17056 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
17057 /// location.
17058 ///
17059 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17060 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17061 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
17062 pub hsm_available: bool,
17063
17064 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17065 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17066 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
17067 /// this location.
17068 ///
17069 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17070 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17071 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
17072 pub ekm_available: bool,
17073
17074 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17075 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17076 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
17077 /// can be created in this location.
17078 ///
17079 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17080 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17081 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
17082 pub hsm_single_tenant_available: bool,
17083
17084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17085}
17086
17087impl LocationMetadata {
17088 /// Creates a new default instance.
17089 pub fn new() -> Self {
17090 std::default::Default::default()
17091 }
17092
17093 /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
17094 ///
17095 /// # Example
17096 /// ```ignore,no_run
17097 /// # use google_cloud_kms_v1::model::LocationMetadata;
17098 /// let x = LocationMetadata::new().set_hsm_available(true);
17099 /// ```
17100 pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17101 self.hsm_available = v.into();
17102 self
17103 }
17104
17105 /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
17106 ///
17107 /// # Example
17108 /// ```ignore,no_run
17109 /// # use google_cloud_kms_v1::model::LocationMetadata;
17110 /// let x = LocationMetadata::new().set_ekm_available(true);
17111 /// ```
17112 pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17113 self.ekm_available = v.into();
17114 self
17115 }
17116
17117 /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
17118 ///
17119 /// # Example
17120 /// ```ignore,no_run
17121 /// # use google_cloud_kms_v1::model::LocationMetadata;
17122 /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
17123 /// ```
17124 pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17125 self.hsm_single_tenant_available = v.into();
17126 self
17127 }
17128}
17129
17130impl wkt::message::Message for LocationMetadata {
17131 fn typename() -> &'static str {
17132 "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
17133 }
17134}
17135
17136/// Represents the metadata of the
17137/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]
17138/// long-running operation.
17139///
17140/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
17141#[derive(Clone, Default, PartialEq)]
17142#[non_exhaustive]
17143pub struct DeleteCryptoKeyMetadata {
17144 /// Output only. The resource name of the
17145 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] created as a result
17146 /// of this operation, in the format
17147 /// `projects/*/locations/*/retiredResources/*`.
17148 ///
17149 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
17150 pub retired_resource: std::string::String,
17151
17152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17153}
17154
17155impl DeleteCryptoKeyMetadata {
17156 /// Creates a new default instance.
17157 pub fn new() -> Self {
17158 std::default::Default::default()
17159 }
17160
17161 /// Sets the value of [retired_resource][crate::model::DeleteCryptoKeyMetadata::retired_resource].
17162 ///
17163 /// # Example
17164 /// ```ignore,no_run
17165 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyMetadata;
17166 /// let x = DeleteCryptoKeyMetadata::new().set_retired_resource("example");
17167 /// ```
17168 pub fn set_retired_resource<T: std::convert::Into<std::string::String>>(
17169 mut self,
17170 v: T,
17171 ) -> Self {
17172 self.retired_resource = v.into();
17173 self
17174 }
17175}
17176
17177impl wkt::message::Message for DeleteCryptoKeyMetadata {
17178 fn typename() -> &'static str {
17179 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyMetadata"
17180 }
17181}
17182
17183/// Represents the metadata of the
17184/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]
17185/// long-running operation.
17186///
17187/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
17188#[derive(Clone, Default, PartialEq)]
17189#[non_exhaustive]
17190pub struct DeleteCryptoKeyVersionMetadata {
17191 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17192}
17193
17194impl DeleteCryptoKeyVersionMetadata {
17195 /// Creates a new default instance.
17196 pub fn new() -> Self {
17197 std::default::Default::default()
17198 }
17199}
17200
17201impl wkt::message::Message for DeleteCryptoKeyVersionMetadata {
17202 fn typename() -> &'static str {
17203 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionMetadata"
17204 }
17205}
17206
17207/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
17208/// cryptographic operations are performed. For more information, see [Protection
17209/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
17210///
17211/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17212///
17213/// # Working with unknown values
17214///
17215/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17216/// additional enum variants at any time. Adding new variants is not considered
17217/// a breaking change. Applications should write their code in anticipation of:
17218///
17219/// - New values appearing in future releases of the client library, **and**
17220/// - New values received dynamically, without application changes.
17221///
17222/// Please consult the [Working with enums] section in the user guide for some
17223/// guidelines.
17224///
17225/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17226#[derive(Clone, Debug, PartialEq)]
17227#[non_exhaustive]
17228pub enum ProtectionLevel {
17229 /// Not specified.
17230 Unspecified,
17231 /// Crypto operations are performed in software.
17232 Software,
17233 /// Crypto operations are performed in a Hardware Security Module.
17234 Hsm,
17235 /// Crypto operations are performed by an external key manager.
17236 External,
17237 /// Crypto operations are performed in an EKM-over-VPC backend.
17238 ExternalVpc,
17239 /// Crypto operations are performed in a single-tenant HSM.
17240 HsmSingleTenant,
17241 /// If set, the enum was initialized with an unknown value.
17242 ///
17243 /// Applications can examine the value using [ProtectionLevel::value] or
17244 /// [ProtectionLevel::name].
17245 UnknownValue(protection_level::UnknownValue),
17246}
17247
17248#[doc(hidden)]
17249pub mod protection_level {
17250 #[allow(unused_imports)]
17251 use super::*;
17252 #[derive(Clone, Debug, PartialEq)]
17253 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17254}
17255
17256impl ProtectionLevel {
17257 /// Gets the enum value.
17258 ///
17259 /// Returns `None` if the enum contains an unknown value deserialized from
17260 /// the string representation of enums.
17261 pub fn value(&self) -> std::option::Option<i32> {
17262 match self {
17263 Self::Unspecified => std::option::Option::Some(0),
17264 Self::Software => std::option::Option::Some(1),
17265 Self::Hsm => std::option::Option::Some(2),
17266 Self::External => std::option::Option::Some(3),
17267 Self::ExternalVpc => std::option::Option::Some(4),
17268 Self::HsmSingleTenant => std::option::Option::Some(5),
17269 Self::UnknownValue(u) => u.0.value(),
17270 }
17271 }
17272
17273 /// Gets the enum value as a string.
17274 ///
17275 /// Returns `None` if the enum contains an unknown value deserialized from
17276 /// the integer representation of enums.
17277 pub fn name(&self) -> std::option::Option<&str> {
17278 match self {
17279 Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
17280 Self::Software => std::option::Option::Some("SOFTWARE"),
17281 Self::Hsm => std::option::Option::Some("HSM"),
17282 Self::External => std::option::Option::Some("EXTERNAL"),
17283 Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
17284 Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
17285 Self::UnknownValue(u) => u.0.name(),
17286 }
17287 }
17288}
17289
17290impl std::default::Default for ProtectionLevel {
17291 fn default() -> Self {
17292 use std::convert::From;
17293 Self::from(0)
17294 }
17295}
17296
17297impl std::fmt::Display for ProtectionLevel {
17298 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17299 wkt::internal::display_enum(f, self.name(), self.value())
17300 }
17301}
17302
17303impl std::convert::From<i32> for ProtectionLevel {
17304 fn from(value: i32) -> Self {
17305 match value {
17306 0 => Self::Unspecified,
17307 1 => Self::Software,
17308 2 => Self::Hsm,
17309 3 => Self::External,
17310 4 => Self::ExternalVpc,
17311 5 => Self::HsmSingleTenant,
17312 _ => Self::UnknownValue(protection_level::UnknownValue(
17313 wkt::internal::UnknownEnumValue::Integer(value),
17314 )),
17315 }
17316 }
17317}
17318
17319impl std::convert::From<&str> for ProtectionLevel {
17320 fn from(value: &str) -> Self {
17321 use std::string::ToString;
17322 match value {
17323 "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
17324 "SOFTWARE" => Self::Software,
17325 "HSM" => Self::Hsm,
17326 "EXTERNAL" => Self::External,
17327 "EXTERNAL_VPC" => Self::ExternalVpc,
17328 "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
17329 _ => Self::UnknownValue(protection_level::UnknownValue(
17330 wkt::internal::UnknownEnumValue::String(value.to_string()),
17331 )),
17332 }
17333 }
17334}
17335
17336impl serde::ser::Serialize for ProtectionLevel {
17337 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17338 where
17339 S: serde::Serializer,
17340 {
17341 match self {
17342 Self::Unspecified => serializer.serialize_i32(0),
17343 Self::Software => serializer.serialize_i32(1),
17344 Self::Hsm => serializer.serialize_i32(2),
17345 Self::External => serializer.serialize_i32(3),
17346 Self::ExternalVpc => serializer.serialize_i32(4),
17347 Self::HsmSingleTenant => serializer.serialize_i32(5),
17348 Self::UnknownValue(u) => u.0.serialize(serializer),
17349 }
17350 }
17351}
17352
17353impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
17354 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17355 where
17356 D: serde::Deserializer<'de>,
17357 {
17358 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
17359 ".google.cloud.kms.v1.ProtectionLevel",
17360 ))
17361 }
17362}
17363
17364/// Describes the reason for a data access. Please refer to
17365/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
17366/// for the detailed semantic meaning of justification reason codes.
17367///
17368/// # Working with unknown values
17369///
17370/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17371/// additional enum variants at any time. Adding new variants is not considered
17372/// a breaking change. Applications should write their code in anticipation of:
17373///
17374/// - New values appearing in future releases of the client library, **and**
17375/// - New values received dynamically, without application changes.
17376///
17377/// Please consult the [Working with enums] section in the user guide for some
17378/// guidelines.
17379///
17380/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17381#[derive(Clone, Debug, PartialEq)]
17382#[non_exhaustive]
17383pub enum AccessReason {
17384 /// Unspecified access reason.
17385 ReasonUnspecified,
17386 /// Customer-initiated support.
17387 CustomerInitiatedSupport,
17388 /// Google-initiated access for system management and troubleshooting.
17389 GoogleInitiatedService,
17390 /// Google-initiated access in response to a legal request or legal process.
17391 ThirdPartyDataRequest,
17392 /// Google-initiated access for security, fraud, abuse, or compliance purposes.
17393 GoogleInitiatedReview,
17394 /// Customer uses their account to perform any access to their own data which
17395 /// their IAM policy authorizes.
17396 CustomerInitiatedAccess,
17397 /// Google systems access customer data to help optimize the structure of the
17398 /// data or quality for future uses by the customer.
17399 GoogleInitiatedSystemOperation,
17400 /// No reason is expected for this key request.
17401 ReasonNotExpected,
17402 /// Deprecated: This code is no longer generated by
17403 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17404 /// available in both Key Access Justifications and Access Transparency logs
17405 /// provide customer-visible signals of emergency access in more precise
17406 /// contexts.
17407 ///
17408 /// Customer uses their account to perform any access to their own data which
17409 /// their IAM policy authorizes, and one of the following is true:
17410 ///
17411 /// * A Google administrator has reset the root-access account associated with
17412 /// the user's organization within the past 7 days.
17413 /// * A Google-initiated emergency access operation has interacted with a
17414 /// resource in the same project or folder as the currently accessed resource
17415 /// within the past 7 days.
17416 #[deprecated]
17417 ModifiedCustomerInitiatedAccess,
17418 /// Deprecated: This code is no longer generated by
17419 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17420 /// available in both Key Access Justifications and Access Transparency logs
17421 /// provide customer-visible signals of emergency access in more precise
17422 /// contexts.
17423 ///
17424 /// Google systems access customer data to help optimize the structure of the
17425 /// data or quality for future uses by the customer, and one of the following
17426 /// is true:
17427 ///
17428 /// * A Google administrator has reset the root-access account associated with
17429 /// the user's organization within the past 7 days.
17430 /// * A Google-initiated emergency access operation has interacted with a
17431 /// resource in the same project or folder as the currently accessed resource
17432 /// within the past 7 days.
17433 #[deprecated]
17434 ModifiedGoogleInitiatedSystemOperation,
17435 /// Google-initiated access to maintain system reliability.
17436 GoogleResponseToProductionAlert,
17437 /// One of the following operations is being executed while simultaneously
17438 /// encountering an internal technical issue which prevented a more precise
17439 /// justification code from being generated:
17440 ///
17441 /// * Your account has been used to perform any access to your own data which
17442 /// your IAM policy authorizes.
17443 /// * An automated Google system operates on encrypted customer data which your
17444 /// IAM policy authorizes.
17445 /// * Customer-initiated Google support access.
17446 /// * Google-initiated support access to protect system reliability.
17447 CustomerAuthorizedWorkflowServicing,
17448 /// If set, the enum was initialized with an unknown value.
17449 ///
17450 /// Applications can examine the value using [AccessReason::value] or
17451 /// [AccessReason::name].
17452 UnknownValue(access_reason::UnknownValue),
17453}
17454
17455#[doc(hidden)]
17456pub mod access_reason {
17457 #[allow(unused_imports)]
17458 use super::*;
17459 #[derive(Clone, Debug, PartialEq)]
17460 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17461}
17462
17463impl AccessReason {
17464 /// Gets the enum value.
17465 ///
17466 /// Returns `None` if the enum contains an unknown value deserialized from
17467 /// the string representation of enums.
17468 pub fn value(&self) -> std::option::Option<i32> {
17469 match self {
17470 Self::ReasonUnspecified => std::option::Option::Some(0),
17471 Self::CustomerInitiatedSupport => std::option::Option::Some(1),
17472 Self::GoogleInitiatedService => std::option::Option::Some(2),
17473 Self::ThirdPartyDataRequest => std::option::Option::Some(3),
17474 Self::GoogleInitiatedReview => std::option::Option::Some(4),
17475 Self::CustomerInitiatedAccess => std::option::Option::Some(5),
17476 Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
17477 Self::ReasonNotExpected => std::option::Option::Some(7),
17478 Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
17479 Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
17480 Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
17481 Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
17482 Self::UnknownValue(u) => u.0.value(),
17483 }
17484 }
17485
17486 /// Gets the enum value as a string.
17487 ///
17488 /// Returns `None` if the enum contains an unknown value deserialized from
17489 /// the integer representation of enums.
17490 pub fn name(&self) -> std::option::Option<&str> {
17491 match self {
17492 Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
17493 Self::CustomerInitiatedSupport => {
17494 std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
17495 }
17496 Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
17497 Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
17498 Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
17499 Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
17500 Self::GoogleInitiatedSystemOperation => {
17501 std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
17502 }
17503 Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
17504 Self::ModifiedCustomerInitiatedAccess => {
17505 std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
17506 }
17507 Self::ModifiedGoogleInitiatedSystemOperation => {
17508 std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
17509 }
17510 Self::GoogleResponseToProductionAlert => {
17511 std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
17512 }
17513 Self::CustomerAuthorizedWorkflowServicing => {
17514 std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
17515 }
17516 Self::UnknownValue(u) => u.0.name(),
17517 }
17518 }
17519}
17520
17521impl std::default::Default for AccessReason {
17522 fn default() -> Self {
17523 use std::convert::From;
17524 Self::from(0)
17525 }
17526}
17527
17528impl std::fmt::Display for AccessReason {
17529 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17530 wkt::internal::display_enum(f, self.name(), self.value())
17531 }
17532}
17533
17534impl std::convert::From<i32> for AccessReason {
17535 fn from(value: i32) -> Self {
17536 match value {
17537 0 => Self::ReasonUnspecified,
17538 1 => Self::CustomerInitiatedSupport,
17539 2 => Self::GoogleInitiatedService,
17540 3 => Self::ThirdPartyDataRequest,
17541 4 => Self::GoogleInitiatedReview,
17542 5 => Self::CustomerInitiatedAccess,
17543 6 => Self::GoogleInitiatedSystemOperation,
17544 7 => Self::ReasonNotExpected,
17545 8 => Self::ModifiedCustomerInitiatedAccess,
17546 9 => Self::ModifiedGoogleInitiatedSystemOperation,
17547 10 => Self::GoogleResponseToProductionAlert,
17548 11 => Self::CustomerAuthorizedWorkflowServicing,
17549 _ => Self::UnknownValue(access_reason::UnknownValue(
17550 wkt::internal::UnknownEnumValue::Integer(value),
17551 )),
17552 }
17553 }
17554}
17555
17556impl std::convert::From<&str> for AccessReason {
17557 fn from(value: &str) -> Self {
17558 use std::string::ToString;
17559 match value {
17560 "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
17561 "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
17562 "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
17563 "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
17564 "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
17565 "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
17566 "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
17567 "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
17568 "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
17569 "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
17570 Self::ModifiedGoogleInitiatedSystemOperation
17571 }
17572 "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
17573 "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
17574 _ => Self::UnknownValue(access_reason::UnknownValue(
17575 wkt::internal::UnknownEnumValue::String(value.to_string()),
17576 )),
17577 }
17578 }
17579}
17580
17581impl serde::ser::Serialize for AccessReason {
17582 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17583 where
17584 S: serde::Serializer,
17585 {
17586 match self {
17587 Self::ReasonUnspecified => serializer.serialize_i32(0),
17588 Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
17589 Self::GoogleInitiatedService => serializer.serialize_i32(2),
17590 Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
17591 Self::GoogleInitiatedReview => serializer.serialize_i32(4),
17592 Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
17593 Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
17594 Self::ReasonNotExpected => serializer.serialize_i32(7),
17595 Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
17596 Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
17597 Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
17598 Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
17599 Self::UnknownValue(u) => u.0.serialize(serializer),
17600 }
17601 }
17602}
17603
17604impl<'de> serde::de::Deserialize<'de> for AccessReason {
17605 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17606 where
17607 D: serde::Deserializer<'de>,
17608 {
17609 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
17610 ".google.cloud.kms.v1.AccessReason",
17611 ))
17612 }
17613}