google_cloud_kms_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_gax;
26extern crate google_cloud_iam_v1;
27extern crate google_cloud_location;
28extern crate google_cloud_longrunning;
29extern crate google_cloud_lro;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Request message for
42/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
43///
44/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
45#[derive(Clone, Default, PartialEq)]
46#[non_exhaustive]
47pub struct CreateKeyHandleRequest {
48 /// Required. Name of the resource project and location to create the
49 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
50 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
51 ///
52 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
53 pub parent: std::string::String,
54
55 /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
56 /// unique to the resource project and location. If not provided by the caller,
57 /// a new UUID is used.
58 ///
59 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
60 pub key_handle_id: std::string::String,
61
62 /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
63 ///
64 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
65 pub key_handle: std::option::Option<crate::model::KeyHandle>,
66
67 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
68}
69
70impl CreateKeyHandleRequest {
71 /// Creates a new default instance.
72 pub fn new() -> Self {
73 std::default::Default::default()
74 }
75
76 /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
77 ///
78 /// # Example
79 /// ```ignore,no_run
80 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
81 /// let x = CreateKeyHandleRequest::new().set_parent("example");
82 /// ```
83 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
84 self.parent = v.into();
85 self
86 }
87
88 /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
89 ///
90 /// # Example
91 /// ```ignore,no_run
92 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
93 /// let x = CreateKeyHandleRequest::new().set_key_handle_id("example");
94 /// ```
95 pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
96 self.key_handle_id = v.into();
97 self
98 }
99
100 /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
101 ///
102 /// # Example
103 /// ```ignore,no_run
104 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
105 /// use google_cloud_kms_v1::model::KeyHandle;
106 /// let x = CreateKeyHandleRequest::new().set_key_handle(KeyHandle::default()/* use setters */);
107 /// ```
108 pub fn set_key_handle<T>(mut self, v: T) -> Self
109 where
110 T: std::convert::Into<crate::model::KeyHandle>,
111 {
112 self.key_handle = std::option::Option::Some(v.into());
113 self
114 }
115
116 /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
117 ///
118 /// # Example
119 /// ```ignore,no_run
120 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
121 /// use google_cloud_kms_v1::model::KeyHandle;
122 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(Some(KeyHandle::default()/* use setters */));
123 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(None::<KeyHandle>);
124 /// ```
125 pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
126 where
127 T: std::convert::Into<crate::model::KeyHandle>,
128 {
129 self.key_handle = v.map(|x| x.into());
130 self
131 }
132}
133
134impl wkt::message::Message for CreateKeyHandleRequest {
135 fn typename() -> &'static str {
136 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
137 }
138}
139
140/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
141///
142/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
143#[derive(Clone, Default, PartialEq)]
144#[non_exhaustive]
145pub struct GetKeyHandleRequest {
146 /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
147 /// e.g.
148 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
149 ///
150 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
151 pub name: std::string::String,
152
153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
154}
155
156impl GetKeyHandleRequest {
157 /// Creates a new default instance.
158 pub fn new() -> Self {
159 std::default::Default::default()
160 }
161
162 /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
163 ///
164 /// # Example
165 /// ```ignore,no_run
166 /// # use google_cloud_kms_v1::model::GetKeyHandleRequest;
167 /// # let project_id = "project_id";
168 /// # let location_id = "location_id";
169 /// # let key_handle_id = "key_handle_id";
170 /// let x = GetKeyHandleRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyHandles/{key_handle_id}"));
171 /// ```
172 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
173 self.name = v.into();
174 self
175 }
176}
177
178impl wkt::message::Message for GetKeyHandleRequest {
179 fn typename() -> &'static str {
180 "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
181 }
182}
183
184/// Resource-oriented representation of a request to Cloud KMS Autokey and the
185/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
186///
187/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
188#[derive(Clone, Default, PartialEq)]
189#[non_exhaustive]
190pub struct KeyHandle {
191 /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
192 /// resource, e.g.
193 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
194 ///
195 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
196 pub name: std::string::String,
197
198 /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
199 /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
200 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
201 /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
202 /// project will reflect the value configured in the
203 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
204 /// project's ancestor folder at the time of the
205 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
206 /// ancestor folder has a configured
207 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
208 /// configurations is used.
209 ///
210 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
211 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
212 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
213 pub kms_key: std::string::String,
214
215 /// Required. Indicates the resource type that the resulting
216 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
217 /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
218 /// types.
219 ///
220 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
221 pub resource_type_selector: std::string::String,
222
223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
224}
225
226impl KeyHandle {
227 /// Creates a new default instance.
228 pub fn new() -> Self {
229 std::default::Default::default()
230 }
231
232 /// Sets the value of [name][crate::model::KeyHandle::name].
233 ///
234 /// # Example
235 /// ```ignore,no_run
236 /// # use google_cloud_kms_v1::model::KeyHandle;
237 /// # let project_id = "project_id";
238 /// # let location_id = "location_id";
239 /// # let key_handle_id = "key_handle_id";
240 /// let x = KeyHandle::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyHandles/{key_handle_id}"));
241 /// ```
242 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
243 self.name = v.into();
244 self
245 }
246
247 /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
248 ///
249 /// # Example
250 /// ```ignore,no_run
251 /// # use google_cloud_kms_v1::model::KeyHandle;
252 /// # let project_id = "project_id";
253 /// # let location_id = "location_id";
254 /// # let key_ring_id = "key_ring_id";
255 /// # let crypto_key_id = "crypto_key_id";
256 /// let x = KeyHandle::new().set_kms_key(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
257 /// ```
258 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
259 self.kms_key = v.into();
260 self
261 }
262
263 /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
264 ///
265 /// # Example
266 /// ```ignore,no_run
267 /// # use google_cloud_kms_v1::model::KeyHandle;
268 /// let x = KeyHandle::new().set_resource_type_selector("example");
269 /// ```
270 pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
271 mut self,
272 v: T,
273 ) -> Self {
274 self.resource_type_selector = v.into();
275 self
276 }
277}
278
279impl wkt::message::Message for KeyHandle {
280 fn typename() -> &'static str {
281 "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
282 }
283}
284
285/// Metadata message for
286/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
287/// operation response.
288///
289/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
290#[derive(Clone, Default, PartialEq)]
291#[non_exhaustive]
292pub struct CreateKeyHandleMetadata {
293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
294}
295
296impl CreateKeyHandleMetadata {
297 /// Creates a new default instance.
298 pub fn new() -> Self {
299 std::default::Default::default()
300 }
301}
302
303impl wkt::message::Message for CreateKeyHandleMetadata {
304 fn typename() -> &'static str {
305 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
306 }
307}
308
309/// Request message for
310/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
311///
312/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
313#[derive(Clone, Default, PartialEq)]
314#[non_exhaustive]
315pub struct ListKeyHandlesRequest {
316 /// Required. Name of the resource project and location from which to list
317 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
318 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
319 ///
320 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
321 pub parent: std::string::String,
322
323 /// Optional. Optional limit on the number of
324 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
325 /// service may return fewer than this value. Further
326 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
327 /// including the
328 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
329 /// in a subsequent request. If unspecified, at most 100
330 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
331 ///
332 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
333 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
334 pub page_size: i32,
335
336 /// Optional. Optional pagination token, returned earlier via
337 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
338 ///
339 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
340 pub page_token: std::string::String,
341
342 /// Optional. Filter to apply when listing
343 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
344 /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
345 ///
346 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
347 pub filter: std::string::String,
348
349 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
350}
351
352impl ListKeyHandlesRequest {
353 /// Creates a new default instance.
354 pub fn new() -> Self {
355 std::default::Default::default()
356 }
357
358 /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
359 ///
360 /// # Example
361 /// ```ignore,no_run
362 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
363 /// let x = ListKeyHandlesRequest::new().set_parent("example");
364 /// ```
365 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
366 self.parent = v.into();
367 self
368 }
369
370 /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
371 ///
372 /// # Example
373 /// ```ignore,no_run
374 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
375 /// let x = ListKeyHandlesRequest::new().set_page_size(42);
376 /// ```
377 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
378 self.page_size = v.into();
379 self
380 }
381
382 /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
383 ///
384 /// # Example
385 /// ```ignore,no_run
386 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
387 /// let x = ListKeyHandlesRequest::new().set_page_token("example");
388 /// ```
389 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
390 self.page_token = v.into();
391 self
392 }
393
394 /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
395 ///
396 /// # Example
397 /// ```ignore,no_run
398 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
399 /// let x = ListKeyHandlesRequest::new().set_filter("example");
400 /// ```
401 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
402 self.filter = v.into();
403 self
404 }
405}
406
407impl wkt::message::Message for ListKeyHandlesRequest {
408 fn typename() -> &'static str {
409 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
410 }
411}
412
413/// Response message for
414/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
415///
416/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
417#[derive(Clone, Default, PartialEq)]
418#[non_exhaustive]
419pub struct ListKeyHandlesResponse {
420 /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
421 ///
422 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
423 pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
424
425 /// A token to retrieve next page of results. Pass this value in
426 /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
427 /// to retrieve the next page of results.
428 ///
429 /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
430 pub next_page_token: std::string::String,
431
432 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
433}
434
435impl ListKeyHandlesResponse {
436 /// Creates a new default instance.
437 pub fn new() -> Self {
438 std::default::Default::default()
439 }
440
441 /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
442 ///
443 /// # Example
444 /// ```ignore,no_run
445 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
446 /// use google_cloud_kms_v1::model::KeyHandle;
447 /// let x = ListKeyHandlesResponse::new()
448 /// .set_key_handles([
449 /// KeyHandle::default()/* use setters */,
450 /// KeyHandle::default()/* use (different) setters */,
451 /// ]);
452 /// ```
453 pub fn set_key_handles<T, V>(mut self, v: T) -> Self
454 where
455 T: std::iter::IntoIterator<Item = V>,
456 V: std::convert::Into<crate::model::KeyHandle>,
457 {
458 use std::iter::Iterator;
459 self.key_handles = v.into_iter().map(|i| i.into()).collect();
460 self
461 }
462
463 /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
464 ///
465 /// # Example
466 /// ```ignore,no_run
467 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
468 /// let x = ListKeyHandlesResponse::new().set_next_page_token("example");
469 /// ```
470 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
471 self.next_page_token = v.into();
472 self
473 }
474}
475
476impl wkt::message::Message for ListKeyHandlesResponse {
477 fn typename() -> &'static str {
478 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
479 }
480}
481
482#[doc(hidden)]
483impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
484 type PageItem = crate::model::KeyHandle;
485
486 fn items(self) -> std::vec::Vec<Self::PageItem> {
487 self.key_handles
488 }
489
490 fn next_page_token(&self) -> std::string::String {
491 use std::clone::Clone;
492 self.next_page_token.clone()
493 }
494}
495
496/// Request message for
497/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
498///
499/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
500#[derive(Clone, Default, PartialEq)]
501#[non_exhaustive]
502pub struct UpdateAutokeyConfigRequest {
503 /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
504 /// update.
505 ///
506 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
507 pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
508
509 /// Required. Masks which fields of the
510 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
511 /// `keyProject`.
512 ///
513 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
514 pub update_mask: std::option::Option<wkt::FieldMask>,
515
516 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
517}
518
519impl UpdateAutokeyConfigRequest {
520 /// Creates a new default instance.
521 pub fn new() -> Self {
522 std::default::Default::default()
523 }
524
525 /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
526 ///
527 /// # Example
528 /// ```ignore,no_run
529 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
530 /// use google_cloud_kms_v1::model::AutokeyConfig;
531 /// let x = UpdateAutokeyConfigRequest::new().set_autokey_config(AutokeyConfig::default()/* use setters */);
532 /// ```
533 pub fn set_autokey_config<T>(mut self, v: T) -> Self
534 where
535 T: std::convert::Into<crate::model::AutokeyConfig>,
536 {
537 self.autokey_config = std::option::Option::Some(v.into());
538 self
539 }
540
541 /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
542 ///
543 /// # Example
544 /// ```ignore,no_run
545 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
546 /// use google_cloud_kms_v1::model::AutokeyConfig;
547 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(Some(AutokeyConfig::default()/* use setters */));
548 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(None::<AutokeyConfig>);
549 /// ```
550 pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
551 where
552 T: std::convert::Into<crate::model::AutokeyConfig>,
553 {
554 self.autokey_config = v.map(|x| x.into());
555 self
556 }
557
558 /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
559 ///
560 /// # Example
561 /// ```ignore,no_run
562 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
563 /// use wkt::FieldMask;
564 /// let x = UpdateAutokeyConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
565 /// ```
566 pub fn set_update_mask<T>(mut self, v: T) -> Self
567 where
568 T: std::convert::Into<wkt::FieldMask>,
569 {
570 self.update_mask = std::option::Option::Some(v.into());
571 self
572 }
573
574 /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
575 ///
576 /// # Example
577 /// ```ignore,no_run
578 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
579 /// use wkt::FieldMask;
580 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
581 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
582 /// ```
583 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
584 where
585 T: std::convert::Into<wkt::FieldMask>,
586 {
587 self.update_mask = v.map(|x| x.into());
588 self
589 }
590}
591
592impl wkt::message::Message for UpdateAutokeyConfigRequest {
593 fn typename() -> &'static str {
594 "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
595 }
596}
597
598/// Request message for
599/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
600///
601/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
602#[derive(Clone, Default, PartialEq)]
603#[non_exhaustive]
604pub struct GetAutokeyConfigRequest {
605 /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
606 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
607 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
608 ///
609 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
610 pub name: std::string::String,
611
612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
613}
614
615impl GetAutokeyConfigRequest {
616 /// Creates a new default instance.
617 pub fn new() -> Self {
618 std::default::Default::default()
619 }
620
621 /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
622 ///
623 /// # Example
624 /// ```ignore,no_run
625 /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
626 /// # let folder_id = "folder_id";
627 /// let x = GetAutokeyConfigRequest::new().set_name(format!("folders/{folder_id}/autokeyConfig"));
628 /// ```
629 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
630 self.name = v.into();
631 self
632 }
633}
634
635impl wkt::message::Message for GetAutokeyConfigRequest {
636 fn typename() -> &'static str {
637 "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
638 }
639}
640
641/// Cloud KMS Autokey configuration for a folder.
642#[derive(Clone, Default, PartialEq)]
643#[non_exhaustive]
644pub struct AutokeyConfig {
645 /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
646 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
647 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
648 ///
649 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
650 pub name: std::string::String,
651
652 /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
653 /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
654 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
655 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
656 /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
657 /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
658 /// this key project. Once configured, for Cloud KMS Autokey to function
659 /// properly, this key project must have the Cloud KMS API activated and the
660 /// Cloud KMS Service Agent for this key project must be granted the
661 /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
662 /// key project field will clear the configuration.
663 ///
664 /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
665 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
666 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
667 pub key_project: std::string::String,
668
669 /// Output only. The state for the AutokeyConfig.
670 pub state: crate::model::autokey_config::State,
671
672 /// Optional. A checksum computed by the server based on the value of other
673 /// fields. This may be sent on update requests to ensure that the client has
674 /// an up-to-date value before proceeding. The request will be rejected with an
675 /// ABORTED error on a mismatched etag.
676 pub etag: std::string::String,
677
678 /// Optional. KeyProjectResolutionMode for the AutokeyConfig.
679 /// Valid values are `DEDICATED_KEY_PROJECT`, `RESOURCE_PROJECT`, or
680 /// `DISABLED`.
681 pub key_project_resolution_mode: crate::model::autokey_config::KeyProjectResolutionMode,
682
683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
684}
685
686impl AutokeyConfig {
687 /// Creates a new default instance.
688 pub fn new() -> Self {
689 std::default::Default::default()
690 }
691
692 /// Sets the value of [name][crate::model::AutokeyConfig::name].
693 ///
694 /// # Example
695 /// ```ignore,no_run
696 /// # use google_cloud_kms_v1::model::AutokeyConfig;
697 /// # let folder_id = "folder_id";
698 /// let x = AutokeyConfig::new().set_name(format!("folders/{folder_id}/autokeyConfig"));
699 /// ```
700 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
701 self.name = v.into();
702 self
703 }
704
705 /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
706 ///
707 /// # Example
708 /// ```ignore,no_run
709 /// # use google_cloud_kms_v1::model::AutokeyConfig;
710 /// let x = AutokeyConfig::new().set_key_project("example");
711 /// ```
712 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
713 self.key_project = v.into();
714 self
715 }
716
717 /// Sets the value of [state][crate::model::AutokeyConfig::state].
718 ///
719 /// # Example
720 /// ```ignore,no_run
721 /// # use google_cloud_kms_v1::model::AutokeyConfig;
722 /// use google_cloud_kms_v1::model::autokey_config::State;
723 /// let x0 = AutokeyConfig::new().set_state(State::Active);
724 /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
725 /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
726 /// ```
727 pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
728 mut self,
729 v: T,
730 ) -> Self {
731 self.state = v.into();
732 self
733 }
734
735 /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
736 ///
737 /// # Example
738 /// ```ignore,no_run
739 /// # use google_cloud_kms_v1::model::AutokeyConfig;
740 /// let x = AutokeyConfig::new().set_etag("example");
741 /// ```
742 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
743 self.etag = v.into();
744 self
745 }
746
747 /// Sets the value of [key_project_resolution_mode][crate::model::AutokeyConfig::key_project_resolution_mode].
748 ///
749 /// # Example
750 /// ```ignore,no_run
751 /// # use google_cloud_kms_v1::model::AutokeyConfig;
752 /// use google_cloud_kms_v1::model::autokey_config::KeyProjectResolutionMode;
753 /// let x0 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::DedicatedKeyProject);
754 /// let x1 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::ResourceProject);
755 /// let x2 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::Disabled);
756 /// ```
757 pub fn set_key_project_resolution_mode<
758 T: std::convert::Into<crate::model::autokey_config::KeyProjectResolutionMode>,
759 >(
760 mut self,
761 v: T,
762 ) -> Self {
763 self.key_project_resolution_mode = v.into();
764 self
765 }
766}
767
768impl wkt::message::Message for AutokeyConfig {
769 fn typename() -> &'static str {
770 "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
771 }
772}
773
774/// Defines additional types related to [AutokeyConfig].
775pub mod autokey_config {
776 #[allow(unused_imports)]
777 use super::*;
778
779 /// The states AutokeyConfig can be in.
780 ///
781 /// # Working with unknown values
782 ///
783 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
784 /// additional enum variants at any time. Adding new variants is not considered
785 /// a breaking change. Applications should write their code in anticipation of:
786 ///
787 /// - New values appearing in future releases of the client library, **and**
788 /// - New values received dynamically, without application changes.
789 ///
790 /// Please consult the [Working with enums] section in the user guide for some
791 /// guidelines.
792 ///
793 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
794 #[derive(Clone, Debug, PartialEq)]
795 #[non_exhaustive]
796 pub enum State {
797 /// The state of the AutokeyConfig is unspecified.
798 Unspecified,
799 /// The AutokeyConfig is currently active.
800 Active,
801 /// A previously configured key project has been deleted and the current
802 /// AutokeyConfig is unusable.
803 KeyProjectDeleted,
804 /// The AutokeyConfig is not yet initialized or has been reset to its default
805 /// uninitialized state.
806 Uninitialized,
807 /// The service account lacks the necessary permissions in the key project to
808 /// configure Autokey.
809 KeyProjectPermissionDenied,
810 /// If set, the enum was initialized with an unknown value.
811 ///
812 /// Applications can examine the value using [State::value] or
813 /// [State::name].
814 UnknownValue(state::UnknownValue),
815 }
816
817 #[doc(hidden)]
818 pub mod state {
819 #[allow(unused_imports)]
820 use super::*;
821 #[derive(Clone, Debug, PartialEq)]
822 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
823 }
824
825 impl State {
826 /// Gets the enum value.
827 ///
828 /// Returns `None` if the enum contains an unknown value deserialized from
829 /// the string representation of enums.
830 pub fn value(&self) -> std::option::Option<i32> {
831 match self {
832 Self::Unspecified => std::option::Option::Some(0),
833 Self::Active => std::option::Option::Some(1),
834 Self::KeyProjectDeleted => std::option::Option::Some(2),
835 Self::Uninitialized => std::option::Option::Some(3),
836 Self::KeyProjectPermissionDenied => std::option::Option::Some(4),
837 Self::UnknownValue(u) => u.0.value(),
838 }
839 }
840
841 /// Gets the enum value as a string.
842 ///
843 /// Returns `None` if the enum contains an unknown value deserialized from
844 /// the integer representation of enums.
845 pub fn name(&self) -> std::option::Option<&str> {
846 match self {
847 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
848 Self::Active => std::option::Option::Some("ACTIVE"),
849 Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
850 Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
851 Self::KeyProjectPermissionDenied => {
852 std::option::Option::Some("KEY_PROJECT_PERMISSION_DENIED")
853 }
854 Self::UnknownValue(u) => u.0.name(),
855 }
856 }
857 }
858
859 impl std::default::Default for State {
860 fn default() -> Self {
861 use std::convert::From;
862 Self::from(0)
863 }
864 }
865
866 impl std::fmt::Display for State {
867 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
868 wkt::internal::display_enum(f, self.name(), self.value())
869 }
870 }
871
872 impl std::convert::From<i32> for State {
873 fn from(value: i32) -> Self {
874 match value {
875 0 => Self::Unspecified,
876 1 => Self::Active,
877 2 => Self::KeyProjectDeleted,
878 3 => Self::Uninitialized,
879 4 => Self::KeyProjectPermissionDenied,
880 _ => Self::UnknownValue(state::UnknownValue(
881 wkt::internal::UnknownEnumValue::Integer(value),
882 )),
883 }
884 }
885 }
886
887 impl std::convert::From<&str> for State {
888 fn from(value: &str) -> Self {
889 use std::string::ToString;
890 match value {
891 "STATE_UNSPECIFIED" => Self::Unspecified,
892 "ACTIVE" => Self::Active,
893 "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
894 "UNINITIALIZED" => Self::Uninitialized,
895 "KEY_PROJECT_PERMISSION_DENIED" => Self::KeyProjectPermissionDenied,
896 _ => Self::UnknownValue(state::UnknownValue(
897 wkt::internal::UnknownEnumValue::String(value.to_string()),
898 )),
899 }
900 }
901 }
902
903 impl serde::ser::Serialize for State {
904 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
905 where
906 S: serde::Serializer,
907 {
908 match self {
909 Self::Unspecified => serializer.serialize_i32(0),
910 Self::Active => serializer.serialize_i32(1),
911 Self::KeyProjectDeleted => serializer.serialize_i32(2),
912 Self::Uninitialized => serializer.serialize_i32(3),
913 Self::KeyProjectPermissionDenied => serializer.serialize_i32(4),
914 Self::UnknownValue(u) => u.0.serialize(serializer),
915 }
916 }
917 }
918
919 impl<'de> serde::de::Deserialize<'de> for State {
920 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
921 where
922 D: serde::Deserializer<'de>,
923 {
924 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
925 ".google.cloud.kms.v1.AutokeyConfig.State",
926 ))
927 }
928 }
929
930 /// Defines the resolution mode enum for the key project.
931 /// The
932 /// [KeyProjectResolutionMode][google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]
933 /// determines the mechanism by which
934 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] identifies a
935 /// [key_project][google.cloud.kms.v1.AutokeyConfig.key_project] at its
936 /// specific configuration node. This parameter also determines if Autokey can
937 /// be used within this project or folder.
938 ///
939 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
940 /// [google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]: crate::model::autokey_config::KeyProjectResolutionMode
941 /// [google.cloud.kms.v1.AutokeyConfig.key_project]: crate::model::AutokeyConfig::key_project
942 ///
943 /// # Working with unknown values
944 ///
945 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
946 /// additional enum variants at any time. Adding new variants is not considered
947 /// a breaking change. Applications should write their code in anticipation of:
948 ///
949 /// - New values appearing in future releases of the client library, **and**
950 /// - New values received dynamically, without application changes.
951 ///
952 /// Please consult the [Working with enums] section in the user guide for some
953 /// guidelines.
954 ///
955 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
956 #[derive(Clone, Debug, PartialEq)]
957 #[non_exhaustive]
958 pub enum KeyProjectResolutionMode {
959 /// Default value. KeyProjectResolutionMode when not specified will act as
960 /// `DEDICATED_KEY_PROJECT`.
961 Unspecified,
962 /// Keys are created in a dedicated project specified by `key_project`.
963 DedicatedKeyProject,
964 /// Keys are created in the same project as the resource requesting the key.
965 /// The `key_project` must not be set when this mode is used.
966 ResourceProject,
967 /// Disables the AutokeyConfig. When this mode is set, any AutokeyConfig
968 /// from higher levels in the resource hierarchy are ignored for this
969 /// resource and its descendants. This setting can be overridden
970 /// by a more specific configuration at a lower level. For example,
971 /// if Autokey is disabled on a folder, it can be re-enabled on a sub-folder
972 /// or project within that folder by setting a different mode (e.g.,
973 /// DEDICATED_KEY_PROJECT or RESOURCE_PROJECT).
974 Disabled,
975 /// If set, the enum was initialized with an unknown value.
976 ///
977 /// Applications can examine the value using [KeyProjectResolutionMode::value] or
978 /// [KeyProjectResolutionMode::name].
979 UnknownValue(key_project_resolution_mode::UnknownValue),
980 }
981
982 #[doc(hidden)]
983 pub mod key_project_resolution_mode {
984 #[allow(unused_imports)]
985 use super::*;
986 #[derive(Clone, Debug, PartialEq)]
987 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
988 }
989
990 impl KeyProjectResolutionMode {
991 /// Gets the enum value.
992 ///
993 /// Returns `None` if the enum contains an unknown value deserialized from
994 /// the string representation of enums.
995 pub fn value(&self) -> std::option::Option<i32> {
996 match self {
997 Self::Unspecified => std::option::Option::Some(0),
998 Self::DedicatedKeyProject => std::option::Option::Some(1),
999 Self::ResourceProject => std::option::Option::Some(2),
1000 Self::Disabled => std::option::Option::Some(3),
1001 Self::UnknownValue(u) => u.0.value(),
1002 }
1003 }
1004
1005 /// Gets the enum value as a string.
1006 ///
1007 /// Returns `None` if the enum contains an unknown value deserialized from
1008 /// the integer representation of enums.
1009 pub fn name(&self) -> std::option::Option<&str> {
1010 match self {
1011 Self::Unspecified => {
1012 std::option::Option::Some("KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED")
1013 }
1014 Self::DedicatedKeyProject => std::option::Option::Some("DEDICATED_KEY_PROJECT"),
1015 Self::ResourceProject => std::option::Option::Some("RESOURCE_PROJECT"),
1016 Self::Disabled => std::option::Option::Some("DISABLED"),
1017 Self::UnknownValue(u) => u.0.name(),
1018 }
1019 }
1020 }
1021
1022 impl std::default::Default for KeyProjectResolutionMode {
1023 fn default() -> Self {
1024 use std::convert::From;
1025 Self::from(0)
1026 }
1027 }
1028
1029 impl std::fmt::Display for KeyProjectResolutionMode {
1030 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1031 wkt::internal::display_enum(f, self.name(), self.value())
1032 }
1033 }
1034
1035 impl std::convert::From<i32> for KeyProjectResolutionMode {
1036 fn from(value: i32) -> Self {
1037 match value {
1038 0 => Self::Unspecified,
1039 1 => Self::DedicatedKeyProject,
1040 2 => Self::ResourceProject,
1041 3 => Self::Disabled,
1042 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1043 wkt::internal::UnknownEnumValue::Integer(value),
1044 )),
1045 }
1046 }
1047 }
1048
1049 impl std::convert::From<&str> for KeyProjectResolutionMode {
1050 fn from(value: &str) -> Self {
1051 use std::string::ToString;
1052 match value {
1053 "KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED" => Self::Unspecified,
1054 "DEDICATED_KEY_PROJECT" => Self::DedicatedKeyProject,
1055 "RESOURCE_PROJECT" => Self::ResourceProject,
1056 "DISABLED" => Self::Disabled,
1057 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1058 wkt::internal::UnknownEnumValue::String(value.to_string()),
1059 )),
1060 }
1061 }
1062 }
1063
1064 impl serde::ser::Serialize for KeyProjectResolutionMode {
1065 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1066 where
1067 S: serde::Serializer,
1068 {
1069 match self {
1070 Self::Unspecified => serializer.serialize_i32(0),
1071 Self::DedicatedKeyProject => serializer.serialize_i32(1),
1072 Self::ResourceProject => serializer.serialize_i32(2),
1073 Self::Disabled => serializer.serialize_i32(3),
1074 Self::UnknownValue(u) => u.0.serialize(serializer),
1075 }
1076 }
1077 }
1078
1079 impl<'de> serde::de::Deserialize<'de> for KeyProjectResolutionMode {
1080 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1081 where
1082 D: serde::Deserializer<'de>,
1083 {
1084 deserializer.deserialize_any(
1085 wkt::internal::EnumVisitor::<KeyProjectResolutionMode>::new(
1086 ".google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode",
1087 ),
1088 )
1089 }
1090 }
1091}
1092
1093/// Request message for
1094/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1095///
1096/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1097#[derive(Clone, Default, PartialEq)]
1098#[non_exhaustive]
1099pub struct ShowEffectiveAutokeyConfigRequest {
1100 /// Required. Name of the resource project to the show effective Cloud KMS
1101 /// Autokey configuration for. This may be helpful for interrogating the effect
1102 /// of nested folder configurations on a given resource project.
1103 pub parent: std::string::String,
1104
1105 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1106}
1107
1108impl ShowEffectiveAutokeyConfigRequest {
1109 /// Creates a new default instance.
1110 pub fn new() -> Self {
1111 std::default::Default::default()
1112 }
1113
1114 /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
1115 ///
1116 /// # Example
1117 /// ```ignore,no_run
1118 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
1119 /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
1120 /// ```
1121 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1122 self.parent = v.into();
1123 self
1124 }
1125}
1126
1127impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
1128 fn typename() -> &'static str {
1129 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
1130 }
1131}
1132
1133/// Response message for
1134/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1135///
1136/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1137#[derive(Clone, Default, PartialEq)]
1138#[non_exhaustive]
1139pub struct ShowEffectiveAutokeyConfigResponse {
1140 /// Name of the key project configured in the resource project's folder
1141 /// ancestry.
1142 pub key_project: std::string::String,
1143
1144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1145}
1146
1147impl ShowEffectiveAutokeyConfigResponse {
1148 /// Creates a new default instance.
1149 pub fn new() -> Self {
1150 std::default::Default::default()
1151 }
1152
1153 /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
1154 ///
1155 /// # Example
1156 /// ```ignore,no_run
1157 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
1158 /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
1159 /// ```
1160 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1161 self.key_project = v.into();
1162 self
1163 }
1164}
1165
1166impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
1167 fn typename() -> &'static str {
1168 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
1169 }
1170}
1171
1172/// Request message for
1173/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1174///
1175/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1176#[derive(Clone, Default, PartialEq)]
1177#[non_exhaustive]
1178pub struct ListEkmConnectionsRequest {
1179 /// Required. The resource name of the location associated with the
1180 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
1181 /// `projects/*/locations/*`.
1182 ///
1183 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1184 pub parent: std::string::String,
1185
1186 /// Optional. Optional limit on the number of
1187 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
1188 /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
1189 /// subsequently be obtained by including the
1190 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
1191 /// in a subsequent request. If unspecified, the server will pick an
1192 /// appropriate default.
1193 ///
1194 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1195 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1196 pub page_size: i32,
1197
1198 /// Optional. Optional pagination token, returned earlier via
1199 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
1200 ///
1201 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1202 pub page_token: std::string::String,
1203
1204 /// Optional. Only include resources that match the filter in the response. For
1205 /// more information, see
1206 /// [Sorting and filtering list
1207 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1208 pub filter: std::string::String,
1209
1210 /// Optional. Specify how the results should be sorted. If not specified, the
1211 /// results will be sorted in the default order. For more information, see
1212 /// [Sorting and filtering list
1213 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1214 pub order_by: std::string::String,
1215
1216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1217}
1218
1219impl ListEkmConnectionsRequest {
1220 /// Creates a new default instance.
1221 pub fn new() -> Self {
1222 std::default::Default::default()
1223 }
1224
1225 /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1226 ///
1227 /// # Example
1228 /// ```ignore,no_run
1229 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1230 /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1231 /// ```
1232 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1233 self.parent = v.into();
1234 self
1235 }
1236
1237 /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1238 ///
1239 /// # Example
1240 /// ```ignore,no_run
1241 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1242 /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1243 /// ```
1244 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1245 self.page_size = v.into();
1246 self
1247 }
1248
1249 /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1250 ///
1251 /// # Example
1252 /// ```ignore,no_run
1253 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1254 /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1255 /// ```
1256 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1257 self.page_token = v.into();
1258 self
1259 }
1260
1261 /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1262 ///
1263 /// # Example
1264 /// ```ignore,no_run
1265 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1266 /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1267 /// ```
1268 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1269 self.filter = v.into();
1270 self
1271 }
1272
1273 /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1274 ///
1275 /// # Example
1276 /// ```ignore,no_run
1277 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1278 /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1279 /// ```
1280 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1281 self.order_by = v.into();
1282 self
1283 }
1284}
1285
1286impl wkt::message::Message for ListEkmConnectionsRequest {
1287 fn typename() -> &'static str {
1288 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1289 }
1290}
1291
1292/// Response message for
1293/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1294///
1295/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1296#[derive(Clone, Default, PartialEq)]
1297#[non_exhaustive]
1298pub struct ListEkmConnectionsResponse {
1299 /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1300 ///
1301 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1302 pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1303
1304 /// A token to retrieve next page of results. Pass this value in
1305 /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1306 /// to retrieve the next page of results.
1307 ///
1308 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1309 pub next_page_token: std::string::String,
1310
1311 /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1312 /// that matched the query.
1313 ///
1314 /// This field is not populated if
1315 /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1316 /// is applied.
1317 ///
1318 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1319 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1320 pub total_size: i32,
1321
1322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1323}
1324
1325impl ListEkmConnectionsResponse {
1326 /// Creates a new default instance.
1327 pub fn new() -> Self {
1328 std::default::Default::default()
1329 }
1330
1331 /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1332 ///
1333 /// # Example
1334 /// ```ignore,no_run
1335 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1336 /// use google_cloud_kms_v1::model::EkmConnection;
1337 /// let x = ListEkmConnectionsResponse::new()
1338 /// .set_ekm_connections([
1339 /// EkmConnection::default()/* use setters */,
1340 /// EkmConnection::default()/* use (different) setters */,
1341 /// ]);
1342 /// ```
1343 pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1344 where
1345 T: std::iter::IntoIterator<Item = V>,
1346 V: std::convert::Into<crate::model::EkmConnection>,
1347 {
1348 use std::iter::Iterator;
1349 self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1350 self
1351 }
1352
1353 /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1354 ///
1355 /// # Example
1356 /// ```ignore,no_run
1357 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1358 /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1359 /// ```
1360 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1361 self.next_page_token = v.into();
1362 self
1363 }
1364
1365 /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1366 ///
1367 /// # Example
1368 /// ```ignore,no_run
1369 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1370 /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1371 /// ```
1372 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1373 self.total_size = v.into();
1374 self
1375 }
1376}
1377
1378impl wkt::message::Message for ListEkmConnectionsResponse {
1379 fn typename() -> &'static str {
1380 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1381 }
1382}
1383
1384#[doc(hidden)]
1385impl google_cloud_gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1386 type PageItem = crate::model::EkmConnection;
1387
1388 fn items(self) -> std::vec::Vec<Self::PageItem> {
1389 self.ekm_connections
1390 }
1391
1392 fn next_page_token(&self) -> std::string::String {
1393 use std::clone::Clone;
1394 self.next_page_token.clone()
1395 }
1396}
1397
1398/// Request message for
1399/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1400///
1401/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1402#[derive(Clone, Default, PartialEq)]
1403#[non_exhaustive]
1404pub struct GetEkmConnectionRequest {
1405 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1406 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1407 ///
1408 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1409 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1410 pub name: std::string::String,
1411
1412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1413}
1414
1415impl GetEkmConnectionRequest {
1416 /// Creates a new default instance.
1417 pub fn new() -> Self {
1418 std::default::Default::default()
1419 }
1420
1421 /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1422 ///
1423 /// # Example
1424 /// ```ignore,no_run
1425 /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1426 /// # let project_id = "project_id";
1427 /// # let location_id = "location_id";
1428 /// # let ekm_connection_id = "ekm_connection_id";
1429 /// let x = GetEkmConnectionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
1430 /// ```
1431 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1432 self.name = v.into();
1433 self
1434 }
1435}
1436
1437impl wkt::message::Message for GetEkmConnectionRequest {
1438 fn typename() -> &'static str {
1439 "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1440 }
1441}
1442
1443/// Request message for
1444/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1445///
1446/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1447#[derive(Clone, Default, PartialEq)]
1448#[non_exhaustive]
1449pub struct CreateEkmConnectionRequest {
1450 /// Required. The resource name of the location associated with the
1451 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1452 /// `projects/*/locations/*`.
1453 ///
1454 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1455 pub parent: std::string::String,
1456
1457 /// Required. It must be unique within a location and match the regular
1458 /// expression `[a-zA-Z0-9_-]{1,63}`.
1459 pub ekm_connection_id: std::string::String,
1460
1461 /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1462 /// initial field values.
1463 ///
1464 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1465 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1466
1467 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1468}
1469
1470impl CreateEkmConnectionRequest {
1471 /// Creates a new default instance.
1472 pub fn new() -> Self {
1473 std::default::Default::default()
1474 }
1475
1476 /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1477 ///
1478 /// # Example
1479 /// ```ignore,no_run
1480 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1481 /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1482 /// ```
1483 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1484 self.parent = v.into();
1485 self
1486 }
1487
1488 /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1489 ///
1490 /// # Example
1491 /// ```ignore,no_run
1492 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1493 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1494 /// ```
1495 pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1496 mut self,
1497 v: T,
1498 ) -> Self {
1499 self.ekm_connection_id = v.into();
1500 self
1501 }
1502
1503 /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1504 ///
1505 /// # Example
1506 /// ```ignore,no_run
1507 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1508 /// use google_cloud_kms_v1::model::EkmConnection;
1509 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1510 /// ```
1511 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1512 where
1513 T: std::convert::Into<crate::model::EkmConnection>,
1514 {
1515 self.ekm_connection = std::option::Option::Some(v.into());
1516 self
1517 }
1518
1519 /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1520 ///
1521 /// # Example
1522 /// ```ignore,no_run
1523 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1524 /// use google_cloud_kms_v1::model::EkmConnection;
1525 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1526 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1527 /// ```
1528 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1529 where
1530 T: std::convert::Into<crate::model::EkmConnection>,
1531 {
1532 self.ekm_connection = v.map(|x| x.into());
1533 self
1534 }
1535}
1536
1537impl wkt::message::Message for CreateEkmConnectionRequest {
1538 fn typename() -> &'static str {
1539 "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1540 }
1541}
1542
1543/// Request message for
1544/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1545///
1546/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1547#[derive(Clone, Default, PartialEq)]
1548#[non_exhaustive]
1549pub struct UpdateEkmConnectionRequest {
1550 /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1551 /// values.
1552 ///
1553 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1554 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1555
1556 /// Required. List of fields to be updated in this request.
1557 pub update_mask: std::option::Option<wkt::FieldMask>,
1558
1559 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1560}
1561
1562impl UpdateEkmConnectionRequest {
1563 /// Creates a new default instance.
1564 pub fn new() -> Self {
1565 std::default::Default::default()
1566 }
1567
1568 /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1569 ///
1570 /// # Example
1571 /// ```ignore,no_run
1572 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1573 /// use google_cloud_kms_v1::model::EkmConnection;
1574 /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1575 /// ```
1576 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1577 where
1578 T: std::convert::Into<crate::model::EkmConnection>,
1579 {
1580 self.ekm_connection = std::option::Option::Some(v.into());
1581 self
1582 }
1583
1584 /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1585 ///
1586 /// # Example
1587 /// ```ignore,no_run
1588 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1589 /// use google_cloud_kms_v1::model::EkmConnection;
1590 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1591 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1592 /// ```
1593 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1594 where
1595 T: std::convert::Into<crate::model::EkmConnection>,
1596 {
1597 self.ekm_connection = v.map(|x| x.into());
1598 self
1599 }
1600
1601 /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1602 ///
1603 /// # Example
1604 /// ```ignore,no_run
1605 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1606 /// use wkt::FieldMask;
1607 /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1608 /// ```
1609 pub fn set_update_mask<T>(mut self, v: T) -> Self
1610 where
1611 T: std::convert::Into<wkt::FieldMask>,
1612 {
1613 self.update_mask = std::option::Option::Some(v.into());
1614 self
1615 }
1616
1617 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1618 ///
1619 /// # Example
1620 /// ```ignore,no_run
1621 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1622 /// use wkt::FieldMask;
1623 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1624 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1625 /// ```
1626 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1627 where
1628 T: std::convert::Into<wkt::FieldMask>,
1629 {
1630 self.update_mask = v.map(|x| x.into());
1631 self
1632 }
1633}
1634
1635impl wkt::message::Message for UpdateEkmConnectionRequest {
1636 fn typename() -> &'static str {
1637 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1638 }
1639}
1640
1641/// Request message for
1642/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1643///
1644/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1645#[derive(Clone, Default, PartialEq)]
1646#[non_exhaustive]
1647pub struct GetEkmConfigRequest {
1648 /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1649 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1650 ///
1651 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1652 /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1653 pub name: std::string::String,
1654
1655 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1656}
1657
1658impl GetEkmConfigRequest {
1659 /// Creates a new default instance.
1660 pub fn new() -> Self {
1661 std::default::Default::default()
1662 }
1663
1664 /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1665 ///
1666 /// # Example
1667 /// ```ignore,no_run
1668 /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1669 /// # let project_id = "project_id";
1670 /// # let location_id = "location_id";
1671 /// let x = GetEkmConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConfig"));
1672 /// ```
1673 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1674 self.name = v.into();
1675 self
1676 }
1677}
1678
1679impl wkt::message::Message for GetEkmConfigRequest {
1680 fn typename() -> &'static str {
1681 "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1682 }
1683}
1684
1685/// Request message for
1686/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1687///
1688/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1689#[derive(Clone, Default, PartialEq)]
1690#[non_exhaustive]
1691pub struct UpdateEkmConfigRequest {
1692 /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1693 ///
1694 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1695 pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1696
1697 /// Required. List of fields to be updated in this request.
1698 pub update_mask: std::option::Option<wkt::FieldMask>,
1699
1700 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1701}
1702
1703impl UpdateEkmConfigRequest {
1704 /// Creates a new default instance.
1705 pub fn new() -> Self {
1706 std::default::Default::default()
1707 }
1708
1709 /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1710 ///
1711 /// # Example
1712 /// ```ignore,no_run
1713 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1714 /// use google_cloud_kms_v1::model::EkmConfig;
1715 /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1716 /// ```
1717 pub fn set_ekm_config<T>(mut self, v: T) -> Self
1718 where
1719 T: std::convert::Into<crate::model::EkmConfig>,
1720 {
1721 self.ekm_config = std::option::Option::Some(v.into());
1722 self
1723 }
1724
1725 /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1726 ///
1727 /// # Example
1728 /// ```ignore,no_run
1729 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1730 /// use google_cloud_kms_v1::model::EkmConfig;
1731 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1732 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1733 /// ```
1734 pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1735 where
1736 T: std::convert::Into<crate::model::EkmConfig>,
1737 {
1738 self.ekm_config = v.map(|x| x.into());
1739 self
1740 }
1741
1742 /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1743 ///
1744 /// # Example
1745 /// ```ignore,no_run
1746 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1747 /// use wkt::FieldMask;
1748 /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1749 /// ```
1750 pub fn set_update_mask<T>(mut self, v: T) -> Self
1751 where
1752 T: std::convert::Into<wkt::FieldMask>,
1753 {
1754 self.update_mask = std::option::Option::Some(v.into());
1755 self
1756 }
1757
1758 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1759 ///
1760 /// # Example
1761 /// ```ignore,no_run
1762 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1763 /// use wkt::FieldMask;
1764 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1765 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1766 /// ```
1767 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1768 where
1769 T: std::convert::Into<wkt::FieldMask>,
1770 {
1771 self.update_mask = v.map(|x| x.into());
1772 self
1773 }
1774}
1775
1776impl wkt::message::Message for UpdateEkmConfigRequest {
1777 fn typename() -> &'static str {
1778 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1779 }
1780}
1781
1782/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1783/// certificate used to authenticate HTTPS connections to EKM replicas.
1784///
1785/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1786#[derive(Clone, Default, PartialEq)]
1787#[non_exhaustive]
1788pub struct Certificate {
1789 /// Required. The raw certificate bytes in DER format.
1790 pub raw_der: ::bytes::Bytes,
1791
1792 /// Output only. True if the certificate was parsed successfully.
1793 pub parsed: bool,
1794
1795 /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1796 /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1797 ///
1798 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1799 pub issuer: std::string::String,
1800
1801 /// Output only. The subject distinguished name in RFC 2253 format. Only
1802 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1803 ///
1804 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1805 pub subject: std::string::String,
1806
1807 /// Output only. The subject Alternative DNS names. Only present if
1808 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1809 ///
1810 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1811 pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1812
1813 /// Output only. The certificate is not valid before this time. Only present if
1814 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1815 ///
1816 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1817 pub not_before_time: std::option::Option<wkt::Timestamp>,
1818
1819 /// Output only. The certificate is not valid after this time. Only present if
1820 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1821 ///
1822 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1823 pub not_after_time: std::option::Option<wkt::Timestamp>,
1824
1825 /// Output only. The certificate serial number as a hex string. Only present if
1826 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1827 ///
1828 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1829 pub serial_number: std::string::String,
1830
1831 /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1832 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1833 ///
1834 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1835 pub sha256_fingerprint: std::string::String,
1836
1837 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1838}
1839
1840impl Certificate {
1841 /// Creates a new default instance.
1842 pub fn new() -> Self {
1843 std::default::Default::default()
1844 }
1845
1846 /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1847 ///
1848 /// # Example
1849 /// ```ignore,no_run
1850 /// # use google_cloud_kms_v1::model::Certificate;
1851 /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1852 /// ```
1853 pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1854 self.raw_der = v.into();
1855 self
1856 }
1857
1858 /// Sets the value of [parsed][crate::model::Certificate::parsed].
1859 ///
1860 /// # Example
1861 /// ```ignore,no_run
1862 /// # use google_cloud_kms_v1::model::Certificate;
1863 /// let x = Certificate::new().set_parsed(true);
1864 /// ```
1865 pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1866 self.parsed = v.into();
1867 self
1868 }
1869
1870 /// Sets the value of [issuer][crate::model::Certificate::issuer].
1871 ///
1872 /// # Example
1873 /// ```ignore,no_run
1874 /// # use google_cloud_kms_v1::model::Certificate;
1875 /// let x = Certificate::new().set_issuer("example");
1876 /// ```
1877 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1878 self.issuer = v.into();
1879 self
1880 }
1881
1882 /// Sets the value of [subject][crate::model::Certificate::subject].
1883 ///
1884 /// # Example
1885 /// ```ignore,no_run
1886 /// # use google_cloud_kms_v1::model::Certificate;
1887 /// let x = Certificate::new().set_subject("example");
1888 /// ```
1889 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1890 self.subject = v.into();
1891 self
1892 }
1893
1894 /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1895 ///
1896 /// # Example
1897 /// ```ignore,no_run
1898 /// # use google_cloud_kms_v1::model::Certificate;
1899 /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1900 /// ```
1901 pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1902 where
1903 T: std::iter::IntoIterator<Item = V>,
1904 V: std::convert::Into<std::string::String>,
1905 {
1906 use std::iter::Iterator;
1907 self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1908 self
1909 }
1910
1911 /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1912 ///
1913 /// # Example
1914 /// ```ignore,no_run
1915 /// # use google_cloud_kms_v1::model::Certificate;
1916 /// use wkt::Timestamp;
1917 /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1918 /// ```
1919 pub fn set_not_before_time<T>(mut self, v: T) -> Self
1920 where
1921 T: std::convert::Into<wkt::Timestamp>,
1922 {
1923 self.not_before_time = std::option::Option::Some(v.into());
1924 self
1925 }
1926
1927 /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1928 ///
1929 /// # Example
1930 /// ```ignore,no_run
1931 /// # use google_cloud_kms_v1::model::Certificate;
1932 /// use wkt::Timestamp;
1933 /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1934 /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1935 /// ```
1936 pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1937 where
1938 T: std::convert::Into<wkt::Timestamp>,
1939 {
1940 self.not_before_time = v.map(|x| x.into());
1941 self
1942 }
1943
1944 /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1945 ///
1946 /// # Example
1947 /// ```ignore,no_run
1948 /// # use google_cloud_kms_v1::model::Certificate;
1949 /// use wkt::Timestamp;
1950 /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1951 /// ```
1952 pub fn set_not_after_time<T>(mut self, v: T) -> Self
1953 where
1954 T: std::convert::Into<wkt::Timestamp>,
1955 {
1956 self.not_after_time = std::option::Option::Some(v.into());
1957 self
1958 }
1959
1960 /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1961 ///
1962 /// # Example
1963 /// ```ignore,no_run
1964 /// # use google_cloud_kms_v1::model::Certificate;
1965 /// use wkt::Timestamp;
1966 /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1967 /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1968 /// ```
1969 pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1970 where
1971 T: std::convert::Into<wkt::Timestamp>,
1972 {
1973 self.not_after_time = v.map(|x| x.into());
1974 self
1975 }
1976
1977 /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1978 ///
1979 /// # Example
1980 /// ```ignore,no_run
1981 /// # use google_cloud_kms_v1::model::Certificate;
1982 /// let x = Certificate::new().set_serial_number("example");
1983 /// ```
1984 pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1985 self.serial_number = v.into();
1986 self
1987 }
1988
1989 /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1990 ///
1991 /// # Example
1992 /// ```ignore,no_run
1993 /// # use google_cloud_kms_v1::model::Certificate;
1994 /// let x = Certificate::new().set_sha256_fingerprint("example");
1995 /// ```
1996 pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1997 mut self,
1998 v: T,
1999 ) -> Self {
2000 self.sha256_fingerprint = v.into();
2001 self
2002 }
2003}
2004
2005impl wkt::message::Message for Certificate {
2006 fn typename() -> &'static str {
2007 "type.googleapis.com/google.cloud.kms.v1.Certificate"
2008 }
2009}
2010
2011/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
2012/// individual EKM connection. It can be used for creating
2013/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2014/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2015/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2016/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
2017/// performing cryptographic operations using keys created within the
2018/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2019///
2020/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2021/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2022/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2023/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2024/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2025#[derive(Clone, Default, PartialEq)]
2026#[non_exhaustive]
2027pub struct EkmConnection {
2028 /// Output only. The resource name for the
2029 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
2030 /// `projects/*/locations/*/ekmConnections/*`.
2031 ///
2032 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2033 pub name: std::string::String,
2034
2035 /// Output only. The time at which the
2036 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
2037 ///
2038 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2039 pub create_time: std::option::Option<wkt::Timestamp>,
2040
2041 /// Optional. A list of
2042 /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
2043 /// the EKM can be reached. There should be one ServiceResolver per EKM
2044 /// replica. Currently, only a single
2045 /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
2046 /// supported.
2047 ///
2048 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2049 pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
2050
2051 /// Optional. Etag of the currently stored
2052 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2053 ///
2054 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2055 pub etag: std::string::String,
2056
2057 /// Optional. Describes who can perform control plane operations on the EKM. If
2058 /// unset, this defaults to
2059 /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
2060 ///
2061 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
2062 pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
2063
2064 /// Optional. Identifies the EKM Crypto Space that this
2065 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
2066 /// field is required if
2067 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
2068 /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
2069 ///
2070 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2071 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2072 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
2073 pub crypto_space_path: std::string::String,
2074
2075 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2076}
2077
2078impl EkmConnection {
2079 /// Creates a new default instance.
2080 pub fn new() -> Self {
2081 std::default::Default::default()
2082 }
2083
2084 /// Sets the value of [name][crate::model::EkmConnection::name].
2085 ///
2086 /// # Example
2087 /// ```ignore,no_run
2088 /// # use google_cloud_kms_v1::model::EkmConnection;
2089 /// # let project_id = "project_id";
2090 /// # let location_id = "location_id";
2091 /// # let ekm_connection_id = "ekm_connection_id";
2092 /// let x = EkmConnection::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2093 /// ```
2094 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2095 self.name = v.into();
2096 self
2097 }
2098
2099 /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
2100 ///
2101 /// # Example
2102 /// ```ignore,no_run
2103 /// # use google_cloud_kms_v1::model::EkmConnection;
2104 /// use wkt::Timestamp;
2105 /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
2106 /// ```
2107 pub fn set_create_time<T>(mut self, v: T) -> Self
2108 where
2109 T: std::convert::Into<wkt::Timestamp>,
2110 {
2111 self.create_time = std::option::Option::Some(v.into());
2112 self
2113 }
2114
2115 /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
2116 ///
2117 /// # Example
2118 /// ```ignore,no_run
2119 /// # use google_cloud_kms_v1::model::EkmConnection;
2120 /// use wkt::Timestamp;
2121 /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2122 /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
2123 /// ```
2124 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2125 where
2126 T: std::convert::Into<wkt::Timestamp>,
2127 {
2128 self.create_time = v.map(|x| x.into());
2129 self
2130 }
2131
2132 /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
2133 ///
2134 /// # Example
2135 /// ```ignore,no_run
2136 /// # use google_cloud_kms_v1::model::EkmConnection;
2137 /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2138 /// let x = EkmConnection::new()
2139 /// .set_service_resolvers([
2140 /// ServiceResolver::default()/* use setters */,
2141 /// ServiceResolver::default()/* use (different) setters */,
2142 /// ]);
2143 /// ```
2144 pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
2145 where
2146 T: std::iter::IntoIterator<Item = V>,
2147 V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
2148 {
2149 use std::iter::Iterator;
2150 self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
2151 self
2152 }
2153
2154 /// Sets the value of [etag][crate::model::EkmConnection::etag].
2155 ///
2156 /// # Example
2157 /// ```ignore,no_run
2158 /// # use google_cloud_kms_v1::model::EkmConnection;
2159 /// let x = EkmConnection::new().set_etag("example");
2160 /// ```
2161 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2162 self.etag = v.into();
2163 self
2164 }
2165
2166 /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
2167 ///
2168 /// # Example
2169 /// ```ignore,no_run
2170 /// # use google_cloud_kms_v1::model::EkmConnection;
2171 /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
2172 /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
2173 /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
2174 /// ```
2175 pub fn set_key_management_mode<
2176 T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
2177 >(
2178 mut self,
2179 v: T,
2180 ) -> Self {
2181 self.key_management_mode = v.into();
2182 self
2183 }
2184
2185 /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
2186 ///
2187 /// # Example
2188 /// ```ignore,no_run
2189 /// # use google_cloud_kms_v1::model::EkmConnection;
2190 /// let x = EkmConnection::new().set_crypto_space_path("example");
2191 /// ```
2192 pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
2193 mut self,
2194 v: T,
2195 ) -> Self {
2196 self.crypto_space_path = v.into();
2197 self
2198 }
2199}
2200
2201impl wkt::message::Message for EkmConnection {
2202 fn typename() -> &'static str {
2203 "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
2204 }
2205}
2206
2207/// Defines additional types related to [EkmConnection].
2208pub mod ekm_connection {
2209 #[allow(unused_imports)]
2210 use super::*;
2211
2212 /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
2213 /// represents an EKM replica that can be reached within an
2214 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2215 ///
2216 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2217 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2218 #[derive(Clone, Default, PartialEq)]
2219 #[non_exhaustive]
2220 pub struct ServiceResolver {
2221 /// Required. The resource name of the Service Directory service pointing to
2222 /// an EKM replica, in the format
2223 /// `projects/*/locations/*/namespaces/*/services/*`.
2224 pub service_directory_service: std::string::String,
2225
2226 /// Optional. The filter applied to the endpoints of the resolved service. If
2227 /// no filter is specified, all endpoints will be considered. An endpoint
2228 /// will be chosen arbitrarily from the filtered list for each request.
2229 ///
2230 /// For endpoint filter syntax and examples, see
2231 /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
2232 pub endpoint_filter: std::string::String,
2233
2234 /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
2235 pub hostname: std::string::String,
2236
2237 /// Required. A list of leaf server certificates used to authenticate HTTPS
2238 /// connections to the EKM replica. Currently, a maximum of 10
2239 /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2240 ///
2241 /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2242 pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2243
2244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2245 }
2246
2247 impl ServiceResolver {
2248 /// Creates a new default instance.
2249 pub fn new() -> Self {
2250 std::default::Default::default()
2251 }
2252
2253 /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2254 ///
2255 /// # Example
2256 /// ```ignore,no_run
2257 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2258 /// let x = ServiceResolver::new().set_service_directory_service("example");
2259 /// ```
2260 pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2261 mut self,
2262 v: T,
2263 ) -> Self {
2264 self.service_directory_service = v.into();
2265 self
2266 }
2267
2268 /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2269 ///
2270 /// # Example
2271 /// ```ignore,no_run
2272 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2273 /// let x = ServiceResolver::new().set_endpoint_filter("example");
2274 /// ```
2275 pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2276 mut self,
2277 v: T,
2278 ) -> Self {
2279 self.endpoint_filter = v.into();
2280 self
2281 }
2282
2283 /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2284 ///
2285 /// # Example
2286 /// ```ignore,no_run
2287 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2288 /// let x = ServiceResolver::new().set_hostname("example");
2289 /// ```
2290 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2291 self.hostname = v.into();
2292 self
2293 }
2294
2295 /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2296 ///
2297 /// # Example
2298 /// ```ignore,no_run
2299 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2300 /// use google_cloud_kms_v1::model::Certificate;
2301 /// let x = ServiceResolver::new()
2302 /// .set_server_certificates([
2303 /// Certificate::default()/* use setters */,
2304 /// Certificate::default()/* use (different) setters */,
2305 /// ]);
2306 /// ```
2307 pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2308 where
2309 T: std::iter::IntoIterator<Item = V>,
2310 V: std::convert::Into<crate::model::Certificate>,
2311 {
2312 use std::iter::Iterator;
2313 self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2314 self
2315 }
2316 }
2317
2318 impl wkt::message::Message for ServiceResolver {
2319 fn typename() -> &'static str {
2320 "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2321 }
2322 }
2323
2324 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2325 /// describes who can perform control plane cryptographic operations using this
2326 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2327 ///
2328 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2329 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2330 ///
2331 /// # Working with unknown values
2332 ///
2333 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2334 /// additional enum variants at any time. Adding new variants is not considered
2335 /// a breaking change. Applications should write their code in anticipation of:
2336 ///
2337 /// - New values appearing in future releases of the client library, **and**
2338 /// - New values received dynamically, without application changes.
2339 ///
2340 /// Please consult the [Working with enums] section in the user guide for some
2341 /// guidelines.
2342 ///
2343 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2344 #[derive(Clone, Debug, PartialEq)]
2345 #[non_exhaustive]
2346 pub enum KeyManagementMode {
2347 /// Not specified.
2348 Unspecified,
2349 /// EKM-side key management operations on
2350 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2351 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2352 /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2353 ///
2354 /// * When creating a
2355 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2356 /// this
2357 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2358 /// supply the key path of pre-existing external key material that will be
2359 /// linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2360 /// * Destruction of external key material cannot be requested via the
2361 /// Cloud KMS API and must be performed directly in the EKM.
2362 /// * Automatic rotation of key material is not supported.
2363 ///
2364 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2365 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2366 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2367 Manual,
2368 /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2369 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2370 /// management operations initiated from Cloud KMS. This means that:
2371 ///
2372 /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2373 /// associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2374 /// is
2375 /// created, the EKM automatically generates new key material and a new
2376 /// key path. The caller cannot supply the key path of pre-existing
2377 /// external key material.
2378 /// * Destruction of external key material associated with this
2379 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2380 /// calling
2381 /// [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2382 /// * Automatic rotation of key material is supported.
2383 ///
2384 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2385 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2386 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2387 /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2388 CloudKms,
2389 /// If set, the enum was initialized with an unknown value.
2390 ///
2391 /// Applications can examine the value using [KeyManagementMode::value] or
2392 /// [KeyManagementMode::name].
2393 UnknownValue(key_management_mode::UnknownValue),
2394 }
2395
2396 #[doc(hidden)]
2397 pub mod key_management_mode {
2398 #[allow(unused_imports)]
2399 use super::*;
2400 #[derive(Clone, Debug, PartialEq)]
2401 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2402 }
2403
2404 impl KeyManagementMode {
2405 /// Gets the enum value.
2406 ///
2407 /// Returns `None` if the enum contains an unknown value deserialized from
2408 /// the string representation of enums.
2409 pub fn value(&self) -> std::option::Option<i32> {
2410 match self {
2411 Self::Unspecified => std::option::Option::Some(0),
2412 Self::Manual => std::option::Option::Some(1),
2413 Self::CloudKms => std::option::Option::Some(2),
2414 Self::UnknownValue(u) => u.0.value(),
2415 }
2416 }
2417
2418 /// Gets the enum value as a string.
2419 ///
2420 /// Returns `None` if the enum contains an unknown value deserialized from
2421 /// the integer representation of enums.
2422 pub fn name(&self) -> std::option::Option<&str> {
2423 match self {
2424 Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2425 Self::Manual => std::option::Option::Some("MANUAL"),
2426 Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2427 Self::UnknownValue(u) => u.0.name(),
2428 }
2429 }
2430 }
2431
2432 impl std::default::Default for KeyManagementMode {
2433 fn default() -> Self {
2434 use std::convert::From;
2435 Self::from(0)
2436 }
2437 }
2438
2439 impl std::fmt::Display for KeyManagementMode {
2440 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2441 wkt::internal::display_enum(f, self.name(), self.value())
2442 }
2443 }
2444
2445 impl std::convert::From<i32> for KeyManagementMode {
2446 fn from(value: i32) -> Self {
2447 match value {
2448 0 => Self::Unspecified,
2449 1 => Self::Manual,
2450 2 => Self::CloudKms,
2451 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2452 wkt::internal::UnknownEnumValue::Integer(value),
2453 )),
2454 }
2455 }
2456 }
2457
2458 impl std::convert::From<&str> for KeyManagementMode {
2459 fn from(value: &str) -> Self {
2460 use std::string::ToString;
2461 match value {
2462 "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2463 "MANUAL" => Self::Manual,
2464 "CLOUD_KMS" => Self::CloudKms,
2465 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2466 wkt::internal::UnknownEnumValue::String(value.to_string()),
2467 )),
2468 }
2469 }
2470 }
2471
2472 impl serde::ser::Serialize for KeyManagementMode {
2473 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2474 where
2475 S: serde::Serializer,
2476 {
2477 match self {
2478 Self::Unspecified => serializer.serialize_i32(0),
2479 Self::Manual => serializer.serialize_i32(1),
2480 Self::CloudKms => serializer.serialize_i32(2),
2481 Self::UnknownValue(u) => u.0.serialize(serializer),
2482 }
2483 }
2484 }
2485
2486 impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2487 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2488 where
2489 D: serde::Deserializer<'de>,
2490 {
2491 deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2492 ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2493 ))
2494 }
2495 }
2496}
2497
2498/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2499/// represents configuration parameters that apply to all
2500/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2501/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2502/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2503/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2504/// project and location.
2505///
2506/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2507/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2508/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2509/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2510/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2511#[derive(Clone, Default, PartialEq)]
2512#[non_exhaustive]
2513pub struct EkmConfig {
2514 /// Output only. The resource name for the
2515 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2516 /// `projects/*/locations/*/ekmConfig`.
2517 ///
2518 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2519 pub name: std::string::String,
2520
2521 /// Optional. Resource name of the default
2522 /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2523 /// the empty string removes the default.
2524 ///
2525 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2526 pub default_ekm_connection: std::string::String,
2527
2528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2529}
2530
2531impl EkmConfig {
2532 /// Creates a new default instance.
2533 pub fn new() -> Self {
2534 std::default::Default::default()
2535 }
2536
2537 /// Sets the value of [name][crate::model::EkmConfig::name].
2538 ///
2539 /// # Example
2540 /// ```ignore,no_run
2541 /// # use google_cloud_kms_v1::model::EkmConfig;
2542 /// # let project_id = "project_id";
2543 /// # let location_id = "location_id";
2544 /// let x = EkmConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConfig"));
2545 /// ```
2546 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2547 self.name = v.into();
2548 self
2549 }
2550
2551 /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2552 ///
2553 /// # Example
2554 /// ```ignore,no_run
2555 /// # use google_cloud_kms_v1::model::EkmConfig;
2556 /// # let project_id = "project_id";
2557 /// # let location_id = "location_id";
2558 /// # let ekm_connection_id = "ekm_connection_id";
2559 /// let x = EkmConfig::new().set_default_ekm_connection(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2560 /// ```
2561 pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2562 mut self,
2563 v: T,
2564 ) -> Self {
2565 self.default_ekm_connection = v.into();
2566 self
2567 }
2568}
2569
2570impl wkt::message::Message for EkmConfig {
2571 fn typename() -> &'static str {
2572 "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2573 }
2574}
2575
2576/// Request message for
2577/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2578///
2579/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2580#[derive(Clone, Default, PartialEq)]
2581#[non_exhaustive]
2582pub struct VerifyConnectivityRequest {
2583 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2584 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2585 ///
2586 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2587 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2588 pub name: std::string::String,
2589
2590 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2591}
2592
2593impl VerifyConnectivityRequest {
2594 /// Creates a new default instance.
2595 pub fn new() -> Self {
2596 std::default::Default::default()
2597 }
2598
2599 /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2600 ///
2601 /// # Example
2602 /// ```ignore,no_run
2603 /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2604 /// # let project_id = "project_id";
2605 /// # let location_id = "location_id";
2606 /// # let ekm_connection_id = "ekm_connection_id";
2607 /// let x = VerifyConnectivityRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2608 /// ```
2609 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2610 self.name = v.into();
2611 self
2612 }
2613}
2614
2615impl wkt::message::Message for VerifyConnectivityRequest {
2616 fn typename() -> &'static str {
2617 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2618 }
2619}
2620
2621/// Response message for
2622/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2623///
2624/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2625#[derive(Clone, Default, PartialEq)]
2626#[non_exhaustive]
2627pub struct VerifyConnectivityResponse {
2628 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2629}
2630
2631impl VerifyConnectivityResponse {
2632 /// Creates a new default instance.
2633 pub fn new() -> Self {
2634 std::default::Default::default()
2635 }
2636}
2637
2638impl wkt::message::Message for VerifyConnectivityResponse {
2639 fn typename() -> &'static str {
2640 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2641 }
2642}
2643
2644/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2645/// represents a single-tenant HSM instance. It can be used for creating
2646/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2647/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2648/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2649/// well as performing cryptographic operations using keys created within the
2650/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2651///
2652/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2653/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2654/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2655#[derive(Clone, Default, PartialEq)]
2656#[non_exhaustive]
2657pub struct SingleTenantHsmInstance {
2658 /// Identifier. The resource name for this
2659 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2660 /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2661 ///
2662 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2663 pub name: std::string::String,
2664
2665 /// Output only. The time at which the
2666 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2667 /// created.
2668 ///
2669 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2670 pub create_time: std::option::Option<wkt::Timestamp>,
2671
2672 /// Output only. The state of the
2673 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2674 ///
2675 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2676 pub state: crate::model::single_tenant_hsm_instance::State,
2677
2678 /// Required. The quorum auth configuration for the
2679 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2680 ///
2681 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2682 pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2683
2684 /// Output only. The time at which the
2685 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2686 /// deleted.
2687 ///
2688 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2689 pub delete_time: std::option::Option<wkt::Timestamp>,
2690
2691 /// Output only. The system-defined duration that an instance can remain
2692 /// unrefreshed until it is automatically disabled. This will have a value of
2693 /// 730 days.
2694 pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2695
2696 /// Output only. The time at which the instance will be automatically disabled
2697 /// if not refreshed. This field is updated upon creation and after each
2698 /// successful refresh operation and enable. A
2699 /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2700 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2701 /// before this time otherwise the
2702 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2703 /// become disabled.
2704 ///
2705 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2706 pub disable_time: std::option::Option<wkt::Timestamp>,
2707
2708 /// Optional. Immutable. Indicates whether key portability is enabled for the
2709 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2710 /// This can only be set at creation time. Key portability features are
2711 /// disabled by default.
2712 ///
2713 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2714 pub key_portability_enabled: bool,
2715
2716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2717}
2718
2719impl SingleTenantHsmInstance {
2720 /// Creates a new default instance.
2721 pub fn new() -> Self {
2722 std::default::Default::default()
2723 }
2724
2725 /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2726 ///
2727 /// # Example
2728 /// ```ignore,no_run
2729 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2730 /// # let project_id = "project_id";
2731 /// # let location_id = "location_id";
2732 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
2733 /// let x = SingleTenantHsmInstance::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
2734 /// ```
2735 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2736 self.name = v.into();
2737 self
2738 }
2739
2740 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2741 ///
2742 /// # Example
2743 /// ```ignore,no_run
2744 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2745 /// use wkt::Timestamp;
2746 /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2747 /// ```
2748 pub fn set_create_time<T>(mut self, v: T) -> Self
2749 where
2750 T: std::convert::Into<wkt::Timestamp>,
2751 {
2752 self.create_time = std::option::Option::Some(v.into());
2753 self
2754 }
2755
2756 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2757 ///
2758 /// # Example
2759 /// ```ignore,no_run
2760 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2761 /// use wkt::Timestamp;
2762 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2763 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2764 /// ```
2765 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2766 where
2767 T: std::convert::Into<wkt::Timestamp>,
2768 {
2769 self.create_time = v.map(|x| x.into());
2770 self
2771 }
2772
2773 /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2774 ///
2775 /// # Example
2776 /// ```ignore,no_run
2777 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2778 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2779 /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2780 /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2781 /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2782 /// ```
2783 pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2784 mut self,
2785 v: T,
2786 ) -> Self {
2787 self.state = v.into();
2788 self
2789 }
2790
2791 /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2792 ///
2793 /// # Example
2794 /// ```ignore,no_run
2795 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2796 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2797 /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2798 /// ```
2799 pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2800 where
2801 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2802 {
2803 self.quorum_auth = std::option::Option::Some(v.into());
2804 self
2805 }
2806
2807 /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2808 ///
2809 /// # Example
2810 /// ```ignore,no_run
2811 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2812 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2813 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2814 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2815 /// ```
2816 pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2817 where
2818 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2819 {
2820 self.quorum_auth = v.map(|x| x.into());
2821 self
2822 }
2823
2824 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2825 ///
2826 /// # Example
2827 /// ```ignore,no_run
2828 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2829 /// use wkt::Timestamp;
2830 /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2831 /// ```
2832 pub fn set_delete_time<T>(mut self, v: T) -> Self
2833 where
2834 T: std::convert::Into<wkt::Timestamp>,
2835 {
2836 self.delete_time = std::option::Option::Some(v.into());
2837 self
2838 }
2839
2840 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2841 ///
2842 /// # Example
2843 /// ```ignore,no_run
2844 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2845 /// use wkt::Timestamp;
2846 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2847 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2848 /// ```
2849 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2850 where
2851 T: std::convert::Into<wkt::Timestamp>,
2852 {
2853 self.delete_time = v.map(|x| x.into());
2854 self
2855 }
2856
2857 /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2858 ///
2859 /// # Example
2860 /// ```ignore,no_run
2861 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2862 /// use wkt::Duration;
2863 /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2864 /// ```
2865 pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2866 where
2867 T: std::convert::Into<wkt::Duration>,
2868 {
2869 self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2870 self
2871 }
2872
2873 /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2874 ///
2875 /// # Example
2876 /// ```ignore,no_run
2877 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2878 /// use wkt::Duration;
2879 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2880 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2881 /// ```
2882 pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2883 mut self,
2884 v: std::option::Option<T>,
2885 ) -> Self
2886 where
2887 T: std::convert::Into<wkt::Duration>,
2888 {
2889 self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2890 self
2891 }
2892
2893 /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2894 ///
2895 /// # Example
2896 /// ```ignore,no_run
2897 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2898 /// use wkt::Timestamp;
2899 /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2900 /// ```
2901 pub fn set_disable_time<T>(mut self, v: T) -> Self
2902 where
2903 T: std::convert::Into<wkt::Timestamp>,
2904 {
2905 self.disable_time = std::option::Option::Some(v.into());
2906 self
2907 }
2908
2909 /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2910 ///
2911 /// # Example
2912 /// ```ignore,no_run
2913 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2914 /// use wkt::Timestamp;
2915 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2916 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2917 /// ```
2918 pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2919 where
2920 T: std::convert::Into<wkt::Timestamp>,
2921 {
2922 self.disable_time = v.map(|x| x.into());
2923 self
2924 }
2925
2926 /// Sets the value of [key_portability_enabled][crate::model::SingleTenantHsmInstance::key_portability_enabled].
2927 ///
2928 /// # Example
2929 /// ```ignore,no_run
2930 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2931 /// let x = SingleTenantHsmInstance::new().set_key_portability_enabled(true);
2932 /// ```
2933 pub fn set_key_portability_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2934 self.key_portability_enabled = v.into();
2935 self
2936 }
2937}
2938
2939impl wkt::message::Message for SingleTenantHsmInstance {
2940 fn typename() -> &'static str {
2941 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2942 }
2943}
2944
2945/// Defines additional types related to [SingleTenantHsmInstance].
2946pub mod single_tenant_hsm_instance {
2947 #[allow(unused_imports)]
2948 use super::*;
2949
2950 /// Configuration for M of N quorum auth.
2951 #[derive(Clone, Default, PartialEq)]
2952 #[non_exhaustive]
2953 pub struct QuorumAuth {
2954 /// Required. The total number of approvers. This is the N value used
2955 /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2956 /// or equal to 16.
2957 pub total_approver_count: i32,
2958
2959 /// Output only. The required numbers of approvers. The M value used for M of
2960 /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2961 /// to
2962 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2963 ///
2964 ///
2965 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2966 pub required_approver_count: i32,
2967
2968 /// Output only. The public keys associated with the 2FA keys for M of N
2969 /// quorum auth.
2970 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2971
2972 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2973 }
2974
2975 impl QuorumAuth {
2976 /// Creates a new default instance.
2977 pub fn new() -> Self {
2978 std::default::Default::default()
2979 }
2980
2981 /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2982 ///
2983 /// # Example
2984 /// ```ignore,no_run
2985 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2986 /// let x = QuorumAuth::new().set_total_approver_count(42);
2987 /// ```
2988 pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2989 self.total_approver_count = v.into();
2990 self
2991 }
2992
2993 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2994 ///
2995 /// # Example
2996 /// ```ignore,no_run
2997 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2998 /// let x = QuorumAuth::new().set_required_approver_count(42);
2999 /// ```
3000 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3001 self.required_approver_count = v.into();
3002 self
3003 }
3004
3005 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
3006 ///
3007 /// # Example
3008 /// ```ignore,no_run
3009 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
3010 /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
3011 /// ```
3012 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
3013 where
3014 T: std::iter::IntoIterator<Item = V>,
3015 V: std::convert::Into<std::string::String>,
3016 {
3017 use std::iter::Iterator;
3018 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
3019 self
3020 }
3021 }
3022
3023 impl wkt::message::Message for QuorumAuth {
3024 fn typename() -> &'static str {
3025 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
3026 }
3027 }
3028
3029 /// The set of states of a
3030 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3031 ///
3032 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3033 ///
3034 /// # Working with unknown values
3035 ///
3036 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3037 /// additional enum variants at any time. Adding new variants is not considered
3038 /// a breaking change. Applications should write their code in anticipation of:
3039 ///
3040 /// - New values appearing in future releases of the client library, **and**
3041 /// - New values received dynamically, without application changes.
3042 ///
3043 /// Please consult the [Working with enums] section in the user guide for some
3044 /// guidelines.
3045 ///
3046 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3047 #[derive(Clone, Debug, PartialEq)]
3048 #[non_exhaustive]
3049 pub enum State {
3050 /// Not specified.
3051 Unspecified,
3052 /// The
3053 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3054 /// being created.
3055 ///
3056 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3057 Creating,
3058 /// The
3059 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3060 /// waiting for 2FA keys to be registered. This can be done by calling
3061 /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
3062 /// with the [RegisterTwoFactorAuthKeys][] operation.
3063 ///
3064 /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
3065 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3066 PendingTwoFactorAuthRegistration,
3067 /// The
3068 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3069 /// ready to use. A
3070 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3071 /// must be in the
3072 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
3073 /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
3074 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
3075 /// be usable.
3076 ///
3077 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3078 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3079 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
3080 Active,
3081 /// The
3082 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3083 /// being disabled.
3084 ///
3085 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3086 Disabling,
3087 /// The
3088 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3089 /// disabled.
3090 ///
3091 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3092 Disabled,
3093 /// The
3094 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3095 /// being deleted. Requests to the instance will be rejected in this state.
3096 ///
3097 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3098 Deleting,
3099 /// The
3100 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3101 /// has been deleted.
3102 ///
3103 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3104 Deleted,
3105 /// The
3106 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3107 /// has failed and can not be recovered or used.
3108 ///
3109 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3110 Failed,
3111 /// If set, the enum was initialized with an unknown value.
3112 ///
3113 /// Applications can examine the value using [State::value] or
3114 /// [State::name].
3115 UnknownValue(state::UnknownValue),
3116 }
3117
3118 #[doc(hidden)]
3119 pub mod state {
3120 #[allow(unused_imports)]
3121 use super::*;
3122 #[derive(Clone, Debug, PartialEq)]
3123 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3124 }
3125
3126 impl State {
3127 /// Gets the enum value.
3128 ///
3129 /// Returns `None` if the enum contains an unknown value deserialized from
3130 /// the string representation of enums.
3131 pub fn value(&self) -> std::option::Option<i32> {
3132 match self {
3133 Self::Unspecified => std::option::Option::Some(0),
3134 Self::Creating => std::option::Option::Some(1),
3135 Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
3136 Self::Active => std::option::Option::Some(3),
3137 Self::Disabling => std::option::Option::Some(4),
3138 Self::Disabled => std::option::Option::Some(5),
3139 Self::Deleting => std::option::Option::Some(6),
3140 Self::Deleted => std::option::Option::Some(7),
3141 Self::Failed => std::option::Option::Some(8),
3142 Self::UnknownValue(u) => u.0.value(),
3143 }
3144 }
3145
3146 /// Gets the enum value as a string.
3147 ///
3148 /// Returns `None` if the enum contains an unknown value deserialized from
3149 /// the integer representation of enums.
3150 pub fn name(&self) -> std::option::Option<&str> {
3151 match self {
3152 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3153 Self::Creating => std::option::Option::Some("CREATING"),
3154 Self::PendingTwoFactorAuthRegistration => {
3155 std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
3156 }
3157 Self::Active => std::option::Option::Some("ACTIVE"),
3158 Self::Disabling => std::option::Option::Some("DISABLING"),
3159 Self::Disabled => std::option::Option::Some("DISABLED"),
3160 Self::Deleting => std::option::Option::Some("DELETING"),
3161 Self::Deleted => std::option::Option::Some("DELETED"),
3162 Self::Failed => std::option::Option::Some("FAILED"),
3163 Self::UnknownValue(u) => u.0.name(),
3164 }
3165 }
3166 }
3167
3168 impl std::default::Default for State {
3169 fn default() -> Self {
3170 use std::convert::From;
3171 Self::from(0)
3172 }
3173 }
3174
3175 impl std::fmt::Display for State {
3176 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3177 wkt::internal::display_enum(f, self.name(), self.value())
3178 }
3179 }
3180
3181 impl std::convert::From<i32> for State {
3182 fn from(value: i32) -> Self {
3183 match value {
3184 0 => Self::Unspecified,
3185 1 => Self::Creating,
3186 2 => Self::PendingTwoFactorAuthRegistration,
3187 3 => Self::Active,
3188 4 => Self::Disabling,
3189 5 => Self::Disabled,
3190 6 => Self::Deleting,
3191 7 => Self::Deleted,
3192 8 => Self::Failed,
3193 _ => Self::UnknownValue(state::UnknownValue(
3194 wkt::internal::UnknownEnumValue::Integer(value),
3195 )),
3196 }
3197 }
3198 }
3199
3200 impl std::convert::From<&str> for State {
3201 fn from(value: &str) -> Self {
3202 use std::string::ToString;
3203 match value {
3204 "STATE_UNSPECIFIED" => Self::Unspecified,
3205 "CREATING" => Self::Creating,
3206 "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
3207 "ACTIVE" => Self::Active,
3208 "DISABLING" => Self::Disabling,
3209 "DISABLED" => Self::Disabled,
3210 "DELETING" => Self::Deleting,
3211 "DELETED" => Self::Deleted,
3212 "FAILED" => Self::Failed,
3213 _ => Self::UnknownValue(state::UnknownValue(
3214 wkt::internal::UnknownEnumValue::String(value.to_string()),
3215 )),
3216 }
3217 }
3218 }
3219
3220 impl serde::ser::Serialize for State {
3221 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3222 where
3223 S: serde::Serializer,
3224 {
3225 match self {
3226 Self::Unspecified => serializer.serialize_i32(0),
3227 Self::Creating => serializer.serialize_i32(1),
3228 Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
3229 Self::Active => serializer.serialize_i32(3),
3230 Self::Disabling => serializer.serialize_i32(4),
3231 Self::Disabled => serializer.serialize_i32(5),
3232 Self::Deleting => serializer.serialize_i32(6),
3233 Self::Deleted => serializer.serialize_i32(7),
3234 Self::Failed => serializer.serialize_i32(8),
3235 Self::UnknownValue(u) => u.0.serialize(serializer),
3236 }
3237 }
3238 }
3239
3240 impl<'de> serde::de::Deserialize<'de> for State {
3241 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3242 where
3243 D: serde::Deserializer<'de>,
3244 {
3245 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3246 ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
3247 ))
3248 }
3249 }
3250}
3251
3252/// A
3253/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3254/// represents a proposal to perform an operation on a
3255/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3256///
3257/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3258/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3259#[derive(Clone, Default, PartialEq)]
3260#[non_exhaustive]
3261pub struct SingleTenantHsmInstanceProposal {
3262 /// Identifier. The resource name for this
3263 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
3264 /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
3265 ///
3266 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3267 pub name: std::string::String,
3268
3269 /// Output only. The time at which the
3270 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3271 /// was created.
3272 ///
3273 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3274 pub create_time: std::option::Option<wkt::Timestamp>,
3275
3276 /// Output only. The state of the
3277 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3278 ///
3279 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3280 pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3281
3282 /// Output only. The root cause of the most recent failure. Only present if
3283 /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3284 /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3285 ///
3286 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3287 pub failure_reason: std::string::String,
3288
3289 /// Output only. The time at which the
3290 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3291 /// was deleted.
3292 ///
3293 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3294 pub delete_time: std::option::Option<wkt::Timestamp>,
3295
3296 /// Output only. The time at which the soft-deleted
3297 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3298 /// will be permanently purged. This field is only populated
3299 /// when the state is DELETED and will be set a time after expiration of the
3300 /// proposal, i.e. >= expire_time or (create_time + ttl).
3301 ///
3302 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3303 pub purge_time: std::option::Option<wkt::Timestamp>,
3304
3305 /// The approval parameters for the
3306 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3307 /// The type of parameters is determined by the operation being proposed.
3308 ///
3309 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3310 pub approval_parameters:
3311 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3312
3313 /// The expiration of the
3314 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3315 /// If not set, the
3316 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3317 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3318 /// time is 5 minutes.
3319 ///
3320 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3321 pub expiration:
3322 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3323
3324 /// The operation to perform on the
3325 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3326 ///
3327 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3328 pub operation:
3329 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3330
3331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3332}
3333
3334impl SingleTenantHsmInstanceProposal {
3335 /// Creates a new default instance.
3336 pub fn new() -> Self {
3337 std::default::Default::default()
3338 }
3339
3340 /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3341 ///
3342 /// # Example
3343 /// ```ignore,no_run
3344 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3345 /// # let project_id = "project_id";
3346 /// # let location_id = "location_id";
3347 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
3348 /// # let proposal_id = "proposal_id";
3349 /// let x = SingleTenantHsmInstanceProposal::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
3350 /// ```
3351 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3352 self.name = v.into();
3353 self
3354 }
3355
3356 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3357 ///
3358 /// # Example
3359 /// ```ignore,no_run
3360 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3361 /// use wkt::Timestamp;
3362 /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3363 /// ```
3364 pub fn set_create_time<T>(mut self, v: T) -> Self
3365 where
3366 T: std::convert::Into<wkt::Timestamp>,
3367 {
3368 self.create_time = std::option::Option::Some(v.into());
3369 self
3370 }
3371
3372 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3373 ///
3374 /// # Example
3375 /// ```ignore,no_run
3376 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3377 /// use wkt::Timestamp;
3378 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3379 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3380 /// ```
3381 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3382 where
3383 T: std::convert::Into<wkt::Timestamp>,
3384 {
3385 self.create_time = v.map(|x| x.into());
3386 self
3387 }
3388
3389 /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3390 ///
3391 /// # Example
3392 /// ```ignore,no_run
3393 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3394 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3395 /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3396 /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3397 /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3398 /// ```
3399 pub fn set_state<
3400 T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3401 >(
3402 mut self,
3403 v: T,
3404 ) -> Self {
3405 self.state = v.into();
3406 self
3407 }
3408
3409 /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3410 ///
3411 /// # Example
3412 /// ```ignore,no_run
3413 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3414 /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3415 /// ```
3416 pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3417 self.failure_reason = v.into();
3418 self
3419 }
3420
3421 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3422 ///
3423 /// # Example
3424 /// ```ignore,no_run
3425 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3426 /// use wkt::Timestamp;
3427 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3428 /// ```
3429 pub fn set_delete_time<T>(mut self, v: T) -> Self
3430 where
3431 T: std::convert::Into<wkt::Timestamp>,
3432 {
3433 self.delete_time = std::option::Option::Some(v.into());
3434 self
3435 }
3436
3437 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3438 ///
3439 /// # Example
3440 /// ```ignore,no_run
3441 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3442 /// use wkt::Timestamp;
3443 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3444 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3445 /// ```
3446 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3447 where
3448 T: std::convert::Into<wkt::Timestamp>,
3449 {
3450 self.delete_time = v.map(|x| x.into());
3451 self
3452 }
3453
3454 /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3455 ///
3456 /// # Example
3457 /// ```ignore,no_run
3458 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3459 /// use wkt::Timestamp;
3460 /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3461 /// ```
3462 pub fn set_purge_time<T>(mut self, v: T) -> Self
3463 where
3464 T: std::convert::Into<wkt::Timestamp>,
3465 {
3466 self.purge_time = std::option::Option::Some(v.into());
3467 self
3468 }
3469
3470 /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3471 ///
3472 /// # Example
3473 /// ```ignore,no_run
3474 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3475 /// use wkt::Timestamp;
3476 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3477 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3478 /// ```
3479 pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3480 where
3481 T: std::convert::Into<wkt::Timestamp>,
3482 {
3483 self.purge_time = v.map(|x| x.into());
3484 self
3485 }
3486
3487 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3488 ///
3489 /// Note that all the setters affecting `approval_parameters` are mutually
3490 /// exclusive.
3491 ///
3492 /// # Example
3493 /// ```ignore,no_run
3494 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3495 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3496 /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3497 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3498 /// ```
3499 pub fn set_approval_parameters<
3500 T: std::convert::Into<
3501 std::option::Option<
3502 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3503 >,
3504 >,
3505 >(
3506 mut self,
3507 v: T,
3508 ) -> Self {
3509 self.approval_parameters = v.into();
3510 self
3511 }
3512
3513 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3514 /// if it holds a `QuorumParameters`, `None` if the field is not set or
3515 /// holds a different branch.
3516 pub fn quorum_parameters(
3517 &self,
3518 ) -> std::option::Option<
3519 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3520 > {
3521 #[allow(unreachable_patterns)]
3522 self.approval_parameters.as_ref().and_then(|v| match v {
3523 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3524 _ => std::option::Option::None,
3525 })
3526 }
3527
3528 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3529 /// to hold a `QuorumParameters`.
3530 ///
3531 /// Note that all the setters affecting `approval_parameters` are
3532 /// mutually exclusive.
3533 ///
3534 /// # Example
3535 /// ```ignore,no_run
3536 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3537 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3538 /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3539 /// assert!(x.quorum_parameters().is_some());
3540 /// assert!(x.required_action_quorum_parameters().is_none());
3541 /// ```
3542 pub fn set_quorum_parameters<
3543 T: std::convert::Into<
3544 std::boxed::Box<
3545 crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3546 >,
3547 >,
3548 >(
3549 mut self,
3550 v: T,
3551 ) -> Self {
3552 self.approval_parameters = std::option::Option::Some(
3553 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3554 v.into(),
3555 ),
3556 );
3557 self
3558 }
3559
3560 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3561 /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3562 /// holds a different branch.
3563 pub fn required_action_quorum_parameters(
3564 &self,
3565 ) -> std::option::Option<
3566 &std::boxed::Box<
3567 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3568 >,
3569 > {
3570 #[allow(unreachable_patterns)]
3571 self.approval_parameters.as_ref().and_then(|v| match v {
3572 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3573 _ => std::option::Option::None,
3574 })
3575 }
3576
3577 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3578 /// to hold a `RequiredActionQuorumParameters`.
3579 ///
3580 /// Note that all the setters affecting `approval_parameters` are
3581 /// mutually exclusive.
3582 ///
3583 /// # Example
3584 /// ```ignore,no_run
3585 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3586 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3587 /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3588 /// assert!(x.required_action_quorum_parameters().is_some());
3589 /// assert!(x.quorum_parameters().is_none());
3590 /// ```
3591 pub fn set_required_action_quorum_parameters<T: std::convert::Into<std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters>>>(mut self, v: T) -> Self{
3592 self.approval_parameters = std::option::Option::Some(
3593 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3594 v.into()
3595 )
3596 );
3597 self
3598 }
3599
3600 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3601 ///
3602 /// Note that all the setters affecting `expiration` are mutually
3603 /// exclusive.
3604 ///
3605 /// # Example
3606 /// ```ignore,no_run
3607 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3608 /// use wkt::Timestamp;
3609 /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3610 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3611 /// ```
3612 pub fn set_expiration<
3613 T: std::convert::Into<
3614 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3615 >,
3616 >(
3617 mut self,
3618 v: T,
3619 ) -> Self {
3620 self.expiration = v.into();
3621 self
3622 }
3623
3624 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3625 /// if it holds a `ExpireTime`, `None` if the field is not set or
3626 /// holds a different branch.
3627 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3628 #[allow(unreachable_patterns)]
3629 self.expiration.as_ref().and_then(|v| match v {
3630 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3631 std::option::Option::Some(v)
3632 }
3633 _ => std::option::Option::None,
3634 })
3635 }
3636
3637 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3638 /// to hold a `ExpireTime`.
3639 ///
3640 /// Note that all the setters affecting `expiration` are
3641 /// mutually exclusive.
3642 ///
3643 /// # Example
3644 /// ```ignore,no_run
3645 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3646 /// use wkt::Timestamp;
3647 /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3648 /// assert!(x.expire_time().is_some());
3649 /// assert!(x.ttl().is_none());
3650 /// ```
3651 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3652 mut self,
3653 v: T,
3654 ) -> Self {
3655 self.expiration = std::option::Option::Some(
3656 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3657 );
3658 self
3659 }
3660
3661 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3662 /// if it holds a `Ttl`, `None` if the field is not set or
3663 /// holds a different branch.
3664 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3665 #[allow(unreachable_patterns)]
3666 self.expiration.as_ref().and_then(|v| match v {
3667 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3668 std::option::Option::Some(v)
3669 }
3670 _ => std::option::Option::None,
3671 })
3672 }
3673
3674 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3675 /// to hold a `Ttl`.
3676 ///
3677 /// Note that all the setters affecting `expiration` are
3678 /// mutually exclusive.
3679 ///
3680 /// # Example
3681 /// ```ignore,no_run
3682 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3683 /// use wkt::Duration;
3684 /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3685 /// assert!(x.ttl().is_some());
3686 /// assert!(x.expire_time().is_none());
3687 /// ```
3688 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3689 self.expiration = std::option::Option::Some(
3690 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3691 );
3692 self
3693 }
3694
3695 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3696 ///
3697 /// Note that all the setters affecting `operation` are mutually
3698 /// exclusive.
3699 ///
3700 /// # Example
3701 /// ```ignore,no_run
3702 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3703 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3704 /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3705 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3706 /// ```
3707 pub fn set_operation<
3708 T: std::convert::Into<
3709 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3710 >,
3711 >(
3712 mut self,
3713 v: T,
3714 ) -> Self {
3715 self.operation = v.into();
3716 self
3717 }
3718
3719 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3720 /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3721 /// holds a different branch.
3722 pub fn register_two_factor_auth_keys(
3723 &self,
3724 ) -> std::option::Option<
3725 &std::boxed::Box<
3726 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3727 >,
3728 > {
3729 #[allow(unreachable_patterns)]
3730 self.operation.as_ref().and_then(|v| match v {
3731 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3732 _ => std::option::Option::None,
3733 })
3734 }
3735
3736 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3737 /// to hold a `RegisterTwoFactorAuthKeys`.
3738 ///
3739 /// Note that all the setters affecting `operation` are
3740 /// mutually exclusive.
3741 ///
3742 /// # Example
3743 /// ```ignore,no_run
3744 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3745 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3746 /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3747 /// assert!(x.register_two_factor_auth_keys().is_some());
3748 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3749 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3750 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3751 /// assert!(x.add_quorum_member().is_none());
3752 /// assert!(x.remove_quorum_member().is_none());
3753 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3754 /// assert!(x.upgrade_key_trust().is_none());
3755 /// ```
3756 pub fn set_register_two_factor_auth_keys<
3757 T: std::convert::Into<
3758 std::boxed::Box<
3759 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3760 >,
3761 >,
3762 >(
3763 mut self,
3764 v: T,
3765 ) -> Self {
3766 self.operation = std::option::Option::Some(
3767 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3768 v.into(),
3769 ),
3770 );
3771 self
3772 }
3773
3774 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3775 /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3776 /// holds a different branch.
3777 pub fn disable_single_tenant_hsm_instance(
3778 &self,
3779 ) -> std::option::Option<
3780 &std::boxed::Box<
3781 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3782 >,
3783 > {
3784 #[allow(unreachable_patterns)]
3785 self.operation.as_ref().and_then(|v| match v {
3786 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3787 _ => std::option::Option::None,
3788 })
3789 }
3790
3791 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3792 /// to hold a `DisableSingleTenantHsmInstance`.
3793 ///
3794 /// Note that all the setters affecting `operation` are
3795 /// mutually exclusive.
3796 ///
3797 /// # Example
3798 /// ```ignore,no_run
3799 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3800 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3801 /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3802 /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3803 /// assert!(x.register_two_factor_auth_keys().is_none());
3804 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3805 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3806 /// assert!(x.add_quorum_member().is_none());
3807 /// assert!(x.remove_quorum_member().is_none());
3808 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3809 /// assert!(x.upgrade_key_trust().is_none());
3810 /// ```
3811 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{
3812 self.operation = std::option::Option::Some(
3813 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3814 v.into()
3815 )
3816 );
3817 self
3818 }
3819
3820 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3821 /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3822 /// holds a different branch.
3823 pub fn enable_single_tenant_hsm_instance(
3824 &self,
3825 ) -> std::option::Option<
3826 &std::boxed::Box<
3827 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3828 >,
3829 > {
3830 #[allow(unreachable_patterns)]
3831 self.operation.as_ref().and_then(|v| match v {
3832 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3833 _ => std::option::Option::None,
3834 })
3835 }
3836
3837 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3838 /// to hold a `EnableSingleTenantHsmInstance`.
3839 ///
3840 /// Note that all the setters affecting `operation` are
3841 /// mutually exclusive.
3842 ///
3843 /// # Example
3844 /// ```ignore,no_run
3845 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3846 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3847 /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3848 /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3849 /// assert!(x.register_two_factor_auth_keys().is_none());
3850 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3851 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3852 /// assert!(x.add_quorum_member().is_none());
3853 /// assert!(x.remove_quorum_member().is_none());
3854 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3855 /// assert!(x.upgrade_key_trust().is_none());
3856 /// ```
3857 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{
3858 self.operation = std::option::Option::Some(
3859 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3860 v.into()
3861 )
3862 );
3863 self
3864 }
3865
3866 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3867 /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3868 /// holds a different branch.
3869 pub fn delete_single_tenant_hsm_instance(
3870 &self,
3871 ) -> std::option::Option<
3872 &std::boxed::Box<
3873 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3874 >,
3875 > {
3876 #[allow(unreachable_patterns)]
3877 self.operation.as_ref().and_then(|v| match v {
3878 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3879 _ => std::option::Option::None,
3880 })
3881 }
3882
3883 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3884 /// to hold a `DeleteSingleTenantHsmInstance`.
3885 ///
3886 /// Note that all the setters affecting `operation` are
3887 /// mutually exclusive.
3888 ///
3889 /// # Example
3890 /// ```ignore,no_run
3891 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3892 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3893 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3894 /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3895 /// assert!(x.register_two_factor_auth_keys().is_none());
3896 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3897 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3898 /// assert!(x.add_quorum_member().is_none());
3899 /// assert!(x.remove_quorum_member().is_none());
3900 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3901 /// assert!(x.upgrade_key_trust().is_none());
3902 /// ```
3903 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{
3904 self.operation = std::option::Option::Some(
3905 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3906 v.into()
3907 )
3908 );
3909 self
3910 }
3911
3912 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3913 /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3914 /// holds a different branch.
3915 pub fn add_quorum_member(
3916 &self,
3917 ) -> std::option::Option<
3918 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3919 > {
3920 #[allow(unreachable_patterns)]
3921 self.operation.as_ref().and_then(|v| match v {
3922 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3923 std::option::Option::Some(v)
3924 }
3925 _ => std::option::Option::None,
3926 })
3927 }
3928
3929 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3930 /// to hold a `AddQuorumMember`.
3931 ///
3932 /// Note that all the setters affecting `operation` are
3933 /// mutually exclusive.
3934 ///
3935 /// # Example
3936 /// ```ignore,no_run
3937 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3938 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3939 /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3940 /// assert!(x.add_quorum_member().is_some());
3941 /// assert!(x.register_two_factor_auth_keys().is_none());
3942 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3943 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3944 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3945 /// assert!(x.remove_quorum_member().is_none());
3946 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3947 /// assert!(x.upgrade_key_trust().is_none());
3948 /// ```
3949 pub fn set_add_quorum_member<
3950 T: std::convert::Into<
3951 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3952 >,
3953 >(
3954 mut self,
3955 v: T,
3956 ) -> Self {
3957 self.operation = std::option::Option::Some(
3958 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3959 );
3960 self
3961 }
3962
3963 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3964 /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3965 /// holds a different branch.
3966 pub fn remove_quorum_member(
3967 &self,
3968 ) -> std::option::Option<
3969 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3970 > {
3971 #[allow(unreachable_patterns)]
3972 self.operation.as_ref().and_then(|v| match v {
3973 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3974 std::option::Option::Some(v)
3975 }
3976 _ => std::option::Option::None,
3977 })
3978 }
3979
3980 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3981 /// to hold a `RemoveQuorumMember`.
3982 ///
3983 /// Note that all the setters affecting `operation` are
3984 /// mutually exclusive.
3985 ///
3986 /// # Example
3987 /// ```ignore,no_run
3988 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3989 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
3990 /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3991 /// assert!(x.remove_quorum_member().is_some());
3992 /// assert!(x.register_two_factor_auth_keys().is_none());
3993 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3994 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3995 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3996 /// assert!(x.add_quorum_member().is_none());
3997 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3998 /// assert!(x.upgrade_key_trust().is_none());
3999 /// ```
4000 pub fn set_remove_quorum_member<
4001 T: std::convert::Into<
4002 std::boxed::Box<
4003 crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
4004 >,
4005 >,
4006 >(
4007 mut self,
4008 v: T,
4009 ) -> Self {
4010 self.operation = std::option::Option::Some(
4011 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
4012 v.into(),
4013 ),
4014 );
4015 self
4016 }
4017
4018 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4019 /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
4020 /// holds a different branch.
4021 pub fn refresh_single_tenant_hsm_instance(
4022 &self,
4023 ) -> std::option::Option<
4024 &std::boxed::Box<
4025 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4026 >,
4027 > {
4028 #[allow(unreachable_patterns)]
4029 self.operation.as_ref().and_then(|v| match v {
4030 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
4031 _ => std::option::Option::None,
4032 })
4033 }
4034
4035 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4036 /// to hold a `RefreshSingleTenantHsmInstance`.
4037 ///
4038 /// Note that all the setters affecting `operation` are
4039 /// mutually exclusive.
4040 ///
4041 /// # Example
4042 /// ```ignore,no_run
4043 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
4044 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
4045 /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
4046 /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
4047 /// assert!(x.register_two_factor_auth_keys().is_none());
4048 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
4049 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
4050 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
4051 /// assert!(x.add_quorum_member().is_none());
4052 /// assert!(x.remove_quorum_member().is_none());
4053 /// assert!(x.upgrade_key_trust().is_none());
4054 /// ```
4055 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{
4056 self.operation = std::option::Option::Some(
4057 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
4058 v.into()
4059 )
4060 );
4061 self
4062 }
4063
4064 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4065 /// if it holds a `UpgradeKeyTrust`, `None` if the field is not set or
4066 /// holds a different branch.
4067 pub fn upgrade_key_trust(
4068 &self,
4069 ) -> std::option::Option<
4070 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust>,
4071 > {
4072 #[allow(unreachable_patterns)]
4073 self.operation.as_ref().and_then(|v| match v {
4074 crate::model::single_tenant_hsm_instance_proposal::Operation::UpgradeKeyTrust(v) => {
4075 std::option::Option::Some(v)
4076 }
4077 _ => std::option::Option::None,
4078 })
4079 }
4080
4081 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4082 /// to hold a `UpgradeKeyTrust`.
4083 ///
4084 /// Note that all the setters affecting `operation` are
4085 /// mutually exclusive.
4086 ///
4087 /// # Example
4088 /// ```ignore,no_run
4089 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
4090 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust;
4091 /// let x = SingleTenantHsmInstanceProposal::new().set_upgrade_key_trust(UpgradeKeyTrust::default()/* use setters */);
4092 /// assert!(x.upgrade_key_trust().is_some());
4093 /// assert!(x.register_two_factor_auth_keys().is_none());
4094 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
4095 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
4096 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
4097 /// assert!(x.add_quorum_member().is_none());
4098 /// assert!(x.remove_quorum_member().is_none());
4099 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
4100 /// ```
4101 pub fn set_upgrade_key_trust<
4102 T: std::convert::Into<
4103 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust>,
4104 >,
4105 >(
4106 mut self,
4107 v: T,
4108 ) -> Self {
4109 self.operation = std::option::Option::Some(
4110 crate::model::single_tenant_hsm_instance_proposal::Operation::UpgradeKeyTrust(v.into()),
4111 );
4112 self
4113 }
4114}
4115
4116impl wkt::message::Message for SingleTenantHsmInstanceProposal {
4117 fn typename() -> &'static str {
4118 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
4119 }
4120}
4121
4122/// Defines additional types related to [SingleTenantHsmInstanceProposal].
4123pub mod single_tenant_hsm_instance_proposal {
4124 #[allow(unused_imports)]
4125 use super::*;
4126
4127 /// Parameters of quorum approval for the
4128 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4129 ///
4130 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4131 #[derive(Clone, Default, PartialEq)]
4132 #[non_exhaustive]
4133 pub struct QuorumParameters {
4134 /// Output only. The required numbers of approvers. This is the M value used
4135 /// for M of N quorum auth. It is less than the number of public keys.
4136 pub required_approver_count: i32,
4137
4138 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4139 /// of N of these challenges are required to be signed to approve the
4140 /// operation.
4141 pub challenges: std::vec::Vec<crate::model::Challenge>,
4142
4143 /// Output only. The public keys associated with the 2FA keys that have
4144 /// already approved the
4145 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4146 /// by signing the challenge.
4147 ///
4148 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4149 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4150
4151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4152 }
4153
4154 impl QuorumParameters {
4155 /// Creates a new default instance.
4156 pub fn new() -> Self {
4157 std::default::Default::default()
4158 }
4159
4160 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
4161 ///
4162 /// # Example
4163 /// ```ignore,no_run
4164 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4165 /// let x = QuorumParameters::new().set_required_approver_count(42);
4166 /// ```
4167 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4168 self.required_approver_count = v.into();
4169 self
4170 }
4171
4172 /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
4173 ///
4174 /// # Example
4175 /// ```ignore,no_run
4176 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4177 /// use google_cloud_kms_v1::model::Challenge;
4178 /// let x = QuorumParameters::new()
4179 /// .set_challenges([
4180 /// Challenge::default()/* use setters */,
4181 /// Challenge::default()/* use (different) setters */,
4182 /// ]);
4183 /// ```
4184 pub fn set_challenges<T, V>(mut self, v: T) -> Self
4185 where
4186 T: std::iter::IntoIterator<Item = V>,
4187 V: std::convert::Into<crate::model::Challenge>,
4188 {
4189 use std::iter::Iterator;
4190 self.challenges = v.into_iter().map(|i| i.into()).collect();
4191 self
4192 }
4193
4194 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
4195 ///
4196 /// # Example
4197 /// ```ignore,no_run
4198 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4199 /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4200 /// ```
4201 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4202 where
4203 T: std::iter::IntoIterator<Item = V>,
4204 V: std::convert::Into<std::string::String>,
4205 {
4206 use std::iter::Iterator;
4207 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4208 self
4209 }
4210 }
4211
4212 impl wkt::message::Message for QuorumParameters {
4213 fn typename() -> &'static str {
4214 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
4215 }
4216 }
4217
4218 /// Parameters for an approval that has both required challenges and a
4219 /// quorum.
4220 #[derive(Clone, Default, PartialEq)]
4221 #[non_exhaustive]
4222 pub struct RequiredActionQuorumParameters {
4223 /// Output only. A list of specific challenges that must be signed.
4224 /// For some operations, this will contain a single challenge.
4225 pub required_challenges: std::vec::Vec<crate::model::Challenge>,
4226
4227 /// Output only. The required number of quorum approvers. This is the M value
4228 /// used for M of N quorum auth. It is less than the number of public keys.
4229 pub required_approver_count: i32,
4230
4231 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4232 /// of N of these challenges are required to be signed to approve the
4233 /// operation.
4234 pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
4235
4236 /// Output only. The public keys associated with the 2FA keys that have
4237 /// already approved the
4238 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4239 /// by signing the challenge.
4240 ///
4241 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4242 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4243
4244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4245 }
4246
4247 impl RequiredActionQuorumParameters {
4248 /// Creates a new default instance.
4249 pub fn new() -> Self {
4250 std::default::Default::default()
4251 }
4252
4253 /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
4254 ///
4255 /// # Example
4256 /// ```ignore,no_run
4257 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4258 /// use google_cloud_kms_v1::model::Challenge;
4259 /// let x = RequiredActionQuorumParameters::new()
4260 /// .set_required_challenges([
4261 /// Challenge::default()/* use setters */,
4262 /// Challenge::default()/* use (different) setters */,
4263 /// ]);
4264 /// ```
4265 pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
4266 where
4267 T: std::iter::IntoIterator<Item = V>,
4268 V: std::convert::Into<crate::model::Challenge>,
4269 {
4270 use std::iter::Iterator;
4271 self.required_challenges = v.into_iter().map(|i| i.into()).collect();
4272 self
4273 }
4274
4275 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
4276 ///
4277 /// # Example
4278 /// ```ignore,no_run
4279 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4280 /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
4281 /// ```
4282 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4283 self.required_approver_count = v.into();
4284 self
4285 }
4286
4287 /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
4288 ///
4289 /// # Example
4290 /// ```ignore,no_run
4291 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4292 /// use google_cloud_kms_v1::model::Challenge;
4293 /// let x = RequiredActionQuorumParameters::new()
4294 /// .set_quorum_challenges([
4295 /// Challenge::default()/* use setters */,
4296 /// Challenge::default()/* use (different) setters */,
4297 /// ]);
4298 /// ```
4299 pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
4300 where
4301 T: std::iter::IntoIterator<Item = V>,
4302 V: std::convert::Into<crate::model::Challenge>,
4303 {
4304 use std::iter::Iterator;
4305 self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
4306 self
4307 }
4308
4309 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
4310 ///
4311 /// # Example
4312 /// ```ignore,no_run
4313 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4314 /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4315 /// ```
4316 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4317 where
4318 T: std::iter::IntoIterator<Item = V>,
4319 V: std::convert::Into<std::string::String>,
4320 {
4321 use std::iter::Iterator;
4322 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4323 self
4324 }
4325 }
4326
4327 impl wkt::message::Message for RequiredActionQuorumParameters {
4328 fn typename() -> &'static str {
4329 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
4330 }
4331 }
4332
4333 /// Register 2FA keys for the
4334 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4335 /// This operation requires all Challenges to be signed by 2FA keys. The
4336 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4337 /// be in the
4338 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4339 /// state to perform this operation.
4340 ///
4341 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4342 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4343 #[derive(Clone, Default, PartialEq)]
4344 #[non_exhaustive]
4345 pub struct RegisterTwoFactorAuthKeys {
4346 /// Required. The required numbers of approvers to set for the
4347 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4348 /// This is the M value used for M of N quorum auth. Must be greater than or
4349 /// equal to 2 and less than or equal to
4350 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4351 ///
4352 ///
4353 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4354 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4355 pub required_approver_count: i32,
4356
4357 /// Required. The public keys associated with the 2FA keys for M of N quorum
4358 /// auth. Public keys must be associated with RSA 2048 keys.
4359 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4360
4361 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4362 }
4363
4364 impl RegisterTwoFactorAuthKeys {
4365 /// Creates a new default instance.
4366 pub fn new() -> Self {
4367 std::default::Default::default()
4368 }
4369
4370 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4371 ///
4372 /// # Example
4373 /// ```ignore,no_run
4374 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4375 /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4376 /// ```
4377 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4378 self.required_approver_count = v.into();
4379 self
4380 }
4381
4382 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4383 ///
4384 /// # Example
4385 /// ```ignore,no_run
4386 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4387 /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4388 /// ```
4389 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4390 where
4391 T: std::iter::IntoIterator<Item = V>,
4392 V: std::convert::Into<std::string::String>,
4393 {
4394 use std::iter::Iterator;
4395 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4396 self
4397 }
4398 }
4399
4400 impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4401 fn typename() -> &'static str {
4402 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4403 }
4404 }
4405
4406 /// Disable the
4407 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4408 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4409 /// be in the
4410 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4411 /// perform this operation.
4412 ///
4413 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4414 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4415 #[derive(Clone, Default, PartialEq)]
4416 #[non_exhaustive]
4417 pub struct DisableSingleTenantHsmInstance {
4418 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4419 }
4420
4421 impl DisableSingleTenantHsmInstance {
4422 /// Creates a new default instance.
4423 pub fn new() -> Self {
4424 std::default::Default::default()
4425 }
4426 }
4427
4428 impl wkt::message::Message for DisableSingleTenantHsmInstance {
4429 fn typename() -> &'static str {
4430 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4431 }
4432 }
4433
4434 /// Enable the
4435 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4436 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4437 /// be in the
4438 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4439 /// state to perform this operation.
4440 ///
4441 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4442 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4443 #[derive(Clone, Default, PartialEq)]
4444 #[non_exhaustive]
4445 pub struct EnableSingleTenantHsmInstance {
4446 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4447 }
4448
4449 impl EnableSingleTenantHsmInstance {
4450 /// Creates a new default instance.
4451 pub fn new() -> Self {
4452 std::default::Default::default()
4453 }
4454 }
4455
4456 impl wkt::message::Message for EnableSingleTenantHsmInstance {
4457 fn typename() -> &'static str {
4458 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4459 }
4460 }
4461
4462 /// Delete the
4463 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4464 /// Deleting a
4465 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4466 /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4467 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4468 /// unusable. The
4469 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4470 /// not be in the
4471 /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4472 /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4473 /// to perform this operation.
4474 ///
4475 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4476 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4477 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4478 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4479 #[derive(Clone, Default, PartialEq)]
4480 #[non_exhaustive]
4481 pub struct DeleteSingleTenantHsmInstance {
4482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4483 }
4484
4485 impl DeleteSingleTenantHsmInstance {
4486 /// Creates a new default instance.
4487 pub fn new() -> Self {
4488 std::default::Default::default()
4489 }
4490 }
4491
4492 impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4493 fn typename() -> &'static str {
4494 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4495 }
4496 }
4497
4498 /// Add a quorum member to the
4499 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4500 /// This will increase the
4501 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4502 /// by 1. The
4503 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4504 /// be in the
4505 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4506 /// perform this operation.
4507 ///
4508 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4509 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4510 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4511 #[derive(Clone, Default, PartialEq)]
4512 #[non_exhaustive]
4513 pub struct AddQuorumMember {
4514 /// Required. The public key associated with the 2FA key for the new quorum
4515 /// member to add. Public keys must be associated with RSA 2048 keys.
4516 pub two_factor_public_key_pem: std::string::String,
4517
4518 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4519 }
4520
4521 impl AddQuorumMember {
4522 /// Creates a new default instance.
4523 pub fn new() -> Self {
4524 std::default::Default::default()
4525 }
4526
4527 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4528 ///
4529 /// # Example
4530 /// ```ignore,no_run
4531 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4532 /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4533 /// ```
4534 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4535 mut self,
4536 v: T,
4537 ) -> Self {
4538 self.two_factor_public_key_pem = v.into();
4539 self
4540 }
4541 }
4542
4543 impl wkt::message::Message for AddQuorumMember {
4544 fn typename() -> &'static str {
4545 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4546 }
4547 }
4548
4549 /// Remove a quorum member from the
4550 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4551 /// This will reduce
4552 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4553 /// by 1. The
4554 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4555 /// be in the
4556 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4557 /// perform this operation.
4558 ///
4559 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4560 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4561 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4562 #[derive(Clone, Default, PartialEq)]
4563 #[non_exhaustive]
4564 pub struct RemoveQuorumMember {
4565 /// Required. The public key associated with the 2FA key for the quorum
4566 /// member to remove. Public keys must be associated with RSA 2048 keys.
4567 pub two_factor_public_key_pem: std::string::String,
4568
4569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4570 }
4571
4572 impl RemoveQuorumMember {
4573 /// Creates a new default instance.
4574 pub fn new() -> Self {
4575 std::default::Default::default()
4576 }
4577
4578 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4579 ///
4580 /// # Example
4581 /// ```ignore,no_run
4582 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4583 /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4584 /// ```
4585 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4586 mut self,
4587 v: T,
4588 ) -> Self {
4589 self.two_factor_public_key_pem = v.into();
4590 self
4591 }
4592 }
4593
4594 impl wkt::message::Message for RemoveQuorumMember {
4595 fn typename() -> &'static str {
4596 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4597 }
4598 }
4599
4600 /// Refreshes the
4601 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4602 /// This operation must be performed periodically to keep the
4603 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4604 /// active. This operation must be performed before
4605 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4606 /// has passed. The
4607 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4608 /// be in the
4609 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4610 /// perform this operation.
4611 ///
4612 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4613 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4614 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4615 #[derive(Clone, Default, PartialEq)]
4616 #[non_exhaustive]
4617 pub struct RefreshSingleTenantHsmInstance {
4618 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4619 }
4620
4621 impl RefreshSingleTenantHsmInstance {
4622 /// Creates a new default instance.
4623 pub fn new() -> Self {
4624 std::default::Default::default()
4625 }
4626 }
4627
4628 impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4629 fn typename() -> &'static str {
4630 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4631 }
4632 }
4633
4634 /// Promotes a key with the AES_WRAPPING purpose to a trusted wrapping key.
4635 /// The key must be in the
4636 /// [ACTIVE][CryptoKeyVersion.CryptoKeyVersionState.ACTIVE] state to perform
4637 /// this operation.
4638 #[derive(Clone, Default, PartialEq)]
4639 #[non_exhaustive]
4640 pub struct UpgradeKeyTrust {
4641 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
4642 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to promote.
4643 ///
4644 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
4645 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
4646 pub name: std::string::String,
4647
4648 /// Required. The public key associated with the 2FA key that will sign the
4649 /// login nonce for this operation.
4650 pub two_factor_public_key_pem: std::string::String,
4651
4652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4653 }
4654
4655 impl UpgradeKeyTrust {
4656 /// Creates a new default instance.
4657 pub fn new() -> Self {
4658 std::default::Default::default()
4659 }
4660
4661 /// Sets the value of [name][crate::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust::name].
4662 ///
4663 /// # Example
4664 /// ```ignore,no_run
4665 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust;
4666 /// let x = UpgradeKeyTrust::new().set_name("example");
4667 /// ```
4668 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4669 self.name = v.into();
4670 self
4671 }
4672
4673 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust::two_factor_public_key_pem].
4674 ///
4675 /// # Example
4676 /// ```ignore,no_run
4677 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust;
4678 /// let x = UpgradeKeyTrust::new().set_two_factor_public_key_pem("example");
4679 /// ```
4680 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4681 mut self,
4682 v: T,
4683 ) -> Self {
4684 self.two_factor_public_key_pem = v.into();
4685 self
4686 }
4687 }
4688
4689 impl wkt::message::Message for UpgradeKeyTrust {
4690 fn typename() -> &'static str {
4691 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.UpgradeKeyTrust"
4692 }
4693 }
4694
4695 /// The set of states of a
4696 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4697 ///
4698 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4699 ///
4700 /// # Working with unknown values
4701 ///
4702 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4703 /// additional enum variants at any time. Adding new variants is not considered
4704 /// a breaking change. Applications should write their code in anticipation of:
4705 ///
4706 /// - New values appearing in future releases of the client library, **and**
4707 /// - New values received dynamically, without application changes.
4708 ///
4709 /// Please consult the [Working with enums] section in the user guide for some
4710 /// guidelines.
4711 ///
4712 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4713 #[derive(Clone, Debug, PartialEq)]
4714 #[non_exhaustive]
4715 pub enum State {
4716 /// Not specified.
4717 Unspecified,
4718 /// The
4719 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4720 /// is being created.
4721 ///
4722 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4723 Creating,
4724 /// The
4725 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4726 /// is pending approval.
4727 ///
4728 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4729 Pending,
4730 /// The
4731 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4732 /// has been approved.
4733 ///
4734 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4735 Approved,
4736 /// The
4737 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4738 /// is being executed.
4739 ///
4740 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4741 Running,
4742 /// The
4743 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4744 /// has been executed successfully.
4745 ///
4746 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4747 Succeeded,
4748 /// The
4749 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4750 /// has failed.
4751 ///
4752 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4753 Failed,
4754 /// The
4755 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4756 /// has been deleted and will be purged after the purge_time.
4757 ///
4758 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4759 Deleted,
4760 /// If set, the enum was initialized with an unknown value.
4761 ///
4762 /// Applications can examine the value using [State::value] or
4763 /// [State::name].
4764 UnknownValue(state::UnknownValue),
4765 }
4766
4767 #[doc(hidden)]
4768 pub mod state {
4769 #[allow(unused_imports)]
4770 use super::*;
4771 #[derive(Clone, Debug, PartialEq)]
4772 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4773 }
4774
4775 impl State {
4776 /// Gets the enum value.
4777 ///
4778 /// Returns `None` if the enum contains an unknown value deserialized from
4779 /// the string representation of enums.
4780 pub fn value(&self) -> std::option::Option<i32> {
4781 match self {
4782 Self::Unspecified => std::option::Option::Some(0),
4783 Self::Creating => std::option::Option::Some(1),
4784 Self::Pending => std::option::Option::Some(2),
4785 Self::Approved => std::option::Option::Some(3),
4786 Self::Running => std::option::Option::Some(4),
4787 Self::Succeeded => std::option::Option::Some(5),
4788 Self::Failed => std::option::Option::Some(6),
4789 Self::Deleted => std::option::Option::Some(7),
4790 Self::UnknownValue(u) => u.0.value(),
4791 }
4792 }
4793
4794 /// Gets the enum value as a string.
4795 ///
4796 /// Returns `None` if the enum contains an unknown value deserialized from
4797 /// the integer representation of enums.
4798 pub fn name(&self) -> std::option::Option<&str> {
4799 match self {
4800 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4801 Self::Creating => std::option::Option::Some("CREATING"),
4802 Self::Pending => std::option::Option::Some("PENDING"),
4803 Self::Approved => std::option::Option::Some("APPROVED"),
4804 Self::Running => std::option::Option::Some("RUNNING"),
4805 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4806 Self::Failed => std::option::Option::Some("FAILED"),
4807 Self::Deleted => std::option::Option::Some("DELETED"),
4808 Self::UnknownValue(u) => u.0.name(),
4809 }
4810 }
4811 }
4812
4813 impl std::default::Default for State {
4814 fn default() -> Self {
4815 use std::convert::From;
4816 Self::from(0)
4817 }
4818 }
4819
4820 impl std::fmt::Display for State {
4821 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4822 wkt::internal::display_enum(f, self.name(), self.value())
4823 }
4824 }
4825
4826 impl std::convert::From<i32> for State {
4827 fn from(value: i32) -> Self {
4828 match value {
4829 0 => Self::Unspecified,
4830 1 => Self::Creating,
4831 2 => Self::Pending,
4832 3 => Self::Approved,
4833 4 => Self::Running,
4834 5 => Self::Succeeded,
4835 6 => Self::Failed,
4836 7 => Self::Deleted,
4837 _ => Self::UnknownValue(state::UnknownValue(
4838 wkt::internal::UnknownEnumValue::Integer(value),
4839 )),
4840 }
4841 }
4842 }
4843
4844 impl std::convert::From<&str> for State {
4845 fn from(value: &str) -> Self {
4846 use std::string::ToString;
4847 match value {
4848 "STATE_UNSPECIFIED" => Self::Unspecified,
4849 "CREATING" => Self::Creating,
4850 "PENDING" => Self::Pending,
4851 "APPROVED" => Self::Approved,
4852 "RUNNING" => Self::Running,
4853 "SUCCEEDED" => Self::Succeeded,
4854 "FAILED" => Self::Failed,
4855 "DELETED" => Self::Deleted,
4856 _ => Self::UnknownValue(state::UnknownValue(
4857 wkt::internal::UnknownEnumValue::String(value.to_string()),
4858 )),
4859 }
4860 }
4861 }
4862
4863 impl serde::ser::Serialize for State {
4864 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4865 where
4866 S: serde::Serializer,
4867 {
4868 match self {
4869 Self::Unspecified => serializer.serialize_i32(0),
4870 Self::Creating => serializer.serialize_i32(1),
4871 Self::Pending => serializer.serialize_i32(2),
4872 Self::Approved => serializer.serialize_i32(3),
4873 Self::Running => serializer.serialize_i32(4),
4874 Self::Succeeded => serializer.serialize_i32(5),
4875 Self::Failed => serializer.serialize_i32(6),
4876 Self::Deleted => serializer.serialize_i32(7),
4877 Self::UnknownValue(u) => u.0.serialize(serializer),
4878 }
4879 }
4880 }
4881
4882 impl<'de> serde::de::Deserialize<'de> for State {
4883 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4884 where
4885 D: serde::Deserializer<'de>,
4886 {
4887 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4888 ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4889 ))
4890 }
4891 }
4892
4893 /// The approval parameters for the
4894 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4895 /// The type of parameters is determined by the operation being proposed.
4896 ///
4897 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4898 #[derive(Clone, Debug, PartialEq)]
4899 #[non_exhaustive]
4900 pub enum ApprovalParameters {
4901 /// Output only. The quorum approval parameters for the
4902 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4903 ///
4904 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4905 QuorumParameters(
4906 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4907 ),
4908 /// Output only. Parameters for an approval of a
4909 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4910 /// that has both required challenges and a quorum.
4911 ///
4912 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4913 RequiredActionQuorumParameters(
4914 std::boxed::Box<
4915 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4916 >,
4917 ),
4918 }
4919
4920 /// The expiration of the
4921 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4922 /// If not set, the
4923 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4924 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4925 /// time is 5 minutes.
4926 ///
4927 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4928 #[derive(Clone, Debug, PartialEq)]
4929 #[non_exhaustive]
4930 pub enum Expiration {
4931 /// The time at which the
4932 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4933 /// will expire if not approved and executed.
4934 ///
4935 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4936 ExpireTime(std::boxed::Box<wkt::Timestamp>),
4937 /// Input only. The TTL for the
4938 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4939 /// Proposals will expire after this duration.
4940 ///
4941 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4942 Ttl(std::boxed::Box<wkt::Duration>),
4943 }
4944
4945 /// The operation to perform on the
4946 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4947 ///
4948 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4949 #[derive(Clone, Debug, PartialEq)]
4950 #[non_exhaustive]
4951 pub enum Operation {
4952 /// Register 2FA keys for the
4953 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4954 /// This operation requires all N Challenges to be signed by 2FA keys. The
4955 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4956 /// must be in the
4957 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4958 /// state to perform this operation.
4959 ///
4960 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4961 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4962 RegisterTwoFactorAuthKeys(
4963 std::boxed::Box<
4964 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4965 >,
4966 ),
4967 /// Disable the
4968 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4969 /// The
4970 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4971 /// must be in the
4972 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4973 /// to perform this operation.
4974 ///
4975 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4976 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4977 DisableSingleTenantHsmInstance(
4978 std::boxed::Box<
4979 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4980 >,
4981 ),
4982 /// Enable the
4983 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4984 /// The
4985 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4986 /// must be in the
4987 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4988 /// state to perform this operation.
4989 ///
4990 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4991 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4992 EnableSingleTenantHsmInstance(
4993 std::boxed::Box<
4994 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4995 >,
4996 ),
4997 /// Delete the
4998 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4999 /// Deleting a
5000 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5001 /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
5002 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5003 /// unusable. The
5004 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5005 /// must be in the
5006 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
5007 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
5008 /// state to perform this operation.
5009 ///
5010 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
5011 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5012 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
5013 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
5014 DeleteSingleTenantHsmInstance(
5015 std::boxed::Box<
5016 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
5017 >,
5018 ),
5019 /// Add a quorum member to the
5020 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
5021 /// This will increase the
5022 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
5023 /// by 1. The
5024 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5025 /// must be in the
5026 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
5027 /// to perform this operation.
5028 ///
5029 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5030 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
5031 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
5032 AddQuorumMember(
5033 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
5034 ),
5035 /// Remove a quorum member from the
5036 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
5037 /// This will reduce
5038 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
5039 /// by 1. The
5040 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5041 /// must be in the
5042 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
5043 /// to perform this operation.
5044 ///
5045 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5046 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
5047 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
5048 RemoveQuorumMember(
5049 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
5050 ),
5051 /// Refreshes the
5052 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
5053 /// This operation must be performed periodically to keep the
5054 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5055 /// active. This operation must be performed before
5056 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
5057 /// has passed. The
5058 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5059 /// must be in the
5060 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
5061 /// to perform this operation.
5062 ///
5063 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5064 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
5065 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
5066 RefreshSingleTenantHsmInstance(
5067 std::boxed::Box<
5068 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
5069 >,
5070 ),
5071 /// Promotes a key with the AES_WRAPPING purpose to a trusted wrapping key.
5072 /// The key must be in the
5073 /// [ACTIVE][CryptoKeyVersion.CryptoKeyVersionState.ACTIVE] state to perform
5074 /// this operation.
5075 UpgradeKeyTrust(
5076 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::UpgradeKeyTrust>,
5077 ),
5078 }
5079}
5080
5081/// A challenge to be signed by a 2FA key.
5082#[derive(Clone, Default, PartialEq)]
5083#[non_exhaustive]
5084pub struct Challenge {
5085 /// Output only. The challenge to be signed by the 2FA key indicated by the
5086 /// public key.
5087 pub challenge: ::bytes::Bytes,
5088
5089 /// Output only. The public key associated with the 2FA key that should sign
5090 /// the challenge.
5091 pub public_key_pem: std::string::String,
5092
5093 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5094}
5095
5096impl Challenge {
5097 /// Creates a new default instance.
5098 pub fn new() -> Self {
5099 std::default::Default::default()
5100 }
5101
5102 /// Sets the value of [challenge][crate::model::Challenge::challenge].
5103 ///
5104 /// # Example
5105 /// ```ignore,no_run
5106 /// # use google_cloud_kms_v1::model::Challenge;
5107 /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
5108 /// ```
5109 pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5110 self.challenge = v.into();
5111 self
5112 }
5113
5114 /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
5115 ///
5116 /// # Example
5117 /// ```ignore,no_run
5118 /// # use google_cloud_kms_v1::model::Challenge;
5119 /// let x = Challenge::new().set_public_key_pem("example");
5120 /// ```
5121 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5122 self.public_key_pem = v.into();
5123 self
5124 }
5125}
5126
5127impl wkt::message::Message for Challenge {
5128 fn typename() -> &'static str {
5129 "type.googleapis.com/google.cloud.kms.v1.Challenge"
5130 }
5131}
5132
5133/// A reply to a challenge signed by a 2FA key.
5134#[derive(Clone, Default, PartialEq)]
5135#[non_exhaustive]
5136pub struct ChallengeReply {
5137 /// Required. The signed challenge associated with the 2FA key.
5138 /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
5139 pub signed_challenge: ::bytes::Bytes,
5140
5141 /// Required. The public key associated with the 2FA key.
5142 pub public_key_pem: std::string::String,
5143
5144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5145}
5146
5147impl ChallengeReply {
5148 /// Creates a new default instance.
5149 pub fn new() -> Self {
5150 std::default::Default::default()
5151 }
5152
5153 /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
5154 ///
5155 /// # Example
5156 /// ```ignore,no_run
5157 /// # use google_cloud_kms_v1::model::ChallengeReply;
5158 /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
5159 /// ```
5160 pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5161 self.signed_challenge = v.into();
5162 self
5163 }
5164
5165 /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
5166 ///
5167 /// # Example
5168 /// ```ignore,no_run
5169 /// # use google_cloud_kms_v1::model::ChallengeReply;
5170 /// let x = ChallengeReply::new().set_public_key_pem("example");
5171 /// ```
5172 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5173 self.public_key_pem = v.into();
5174 self
5175 }
5176}
5177
5178impl wkt::message::Message for ChallengeReply {
5179 fn typename() -> &'static str {
5180 "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
5181 }
5182}
5183
5184/// Request message for
5185/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5186///
5187/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5188#[derive(Clone, Default, PartialEq)]
5189#[non_exhaustive]
5190pub struct ListSingleTenantHsmInstancesRequest {
5191 /// Required. The resource name of the location associated with the
5192 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5193 /// list, in the format `projects/*/locations/*`.
5194 ///
5195 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5196 pub parent: std::string::String,
5197
5198 /// Optional. Optional limit on the number of
5199 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5200 /// include in the response. Further
5201 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
5202 /// subsequently be
5203 /// obtained by including the
5204 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
5205 /// in a subsequent request. If unspecified, the server will pick an
5206 /// appropriate default.
5207 ///
5208 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5209 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5210 pub page_size: i32,
5211
5212 /// Optional. Optional pagination token, returned earlier via
5213 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
5214 ///
5215 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5216 pub page_token: std::string::String,
5217
5218 /// Optional. Only include resources that match the filter in the response. For
5219 /// more information, see
5220 /// [Sorting and filtering list
5221 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5222 pub filter: std::string::String,
5223
5224 /// Optional. Specify how the results should be sorted. If not specified, the
5225 /// results will be sorted in the default order. For more information, see
5226 /// [Sorting and filtering list
5227 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5228 pub order_by: std::string::String,
5229
5230 /// Optional. If set to true,
5231 /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
5232 /// will also return
5233 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
5234 /// DELETED state.
5235 ///
5236 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5237 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5238 pub show_deleted: bool,
5239
5240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5241}
5242
5243impl ListSingleTenantHsmInstancesRequest {
5244 /// Creates a new default instance.
5245 pub fn new() -> Self {
5246 std::default::Default::default()
5247 }
5248
5249 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
5250 ///
5251 /// # Example
5252 /// ```ignore,no_run
5253 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5254 /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
5255 /// ```
5256 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5257 self.parent = v.into();
5258 self
5259 }
5260
5261 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
5262 ///
5263 /// # Example
5264 /// ```ignore,no_run
5265 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5266 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
5267 /// ```
5268 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5269 self.page_size = v.into();
5270 self
5271 }
5272
5273 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
5274 ///
5275 /// # Example
5276 /// ```ignore,no_run
5277 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5278 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
5279 /// ```
5280 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5281 self.page_token = v.into();
5282 self
5283 }
5284
5285 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
5286 ///
5287 /// # Example
5288 /// ```ignore,no_run
5289 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5290 /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
5291 /// ```
5292 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5293 self.filter = v.into();
5294 self
5295 }
5296
5297 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
5298 ///
5299 /// # Example
5300 /// ```ignore,no_run
5301 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5302 /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
5303 /// ```
5304 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5305 self.order_by = v.into();
5306 self
5307 }
5308
5309 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
5310 ///
5311 /// # Example
5312 /// ```ignore,no_run
5313 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5314 /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
5315 /// ```
5316 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5317 self.show_deleted = v.into();
5318 self
5319 }
5320}
5321
5322impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
5323 fn typename() -> &'static str {
5324 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
5325 }
5326}
5327
5328/// Response message for
5329/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5330///
5331/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5332#[derive(Clone, Default, PartialEq)]
5333#[non_exhaustive]
5334pub struct ListSingleTenantHsmInstancesResponse {
5335 /// The list of
5336 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
5337 ///
5338 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5339 pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
5340
5341 /// A token to retrieve next page of results. Pass this value in
5342 /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
5343 /// to retrieve the next page of results.
5344 ///
5345 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
5346 pub next_page_token: std::string::String,
5347
5348 /// The total number of
5349 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
5350 /// that matched the query.
5351 ///
5352 /// This field is not populated if
5353 /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
5354 /// is applied.
5355 ///
5356 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
5357 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5358 pub total_size: i32,
5359
5360 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5361}
5362
5363impl ListSingleTenantHsmInstancesResponse {
5364 /// Creates a new default instance.
5365 pub fn new() -> Self {
5366 std::default::Default::default()
5367 }
5368
5369 /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
5370 ///
5371 /// # Example
5372 /// ```ignore,no_run
5373 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5374 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5375 /// let x = ListSingleTenantHsmInstancesResponse::new()
5376 /// .set_single_tenant_hsm_instances([
5377 /// SingleTenantHsmInstance::default()/* use setters */,
5378 /// SingleTenantHsmInstance::default()/* use (different) setters */,
5379 /// ]);
5380 /// ```
5381 pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
5382 where
5383 T: std::iter::IntoIterator<Item = V>,
5384 V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5385 {
5386 use std::iter::Iterator;
5387 self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
5388 self
5389 }
5390
5391 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
5392 ///
5393 /// # Example
5394 /// ```ignore,no_run
5395 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5396 /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
5397 /// ```
5398 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5399 self.next_page_token = v.into();
5400 self
5401 }
5402
5403 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
5404 ///
5405 /// # Example
5406 /// ```ignore,no_run
5407 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5408 /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
5409 /// ```
5410 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5411 self.total_size = v.into();
5412 self
5413 }
5414}
5415
5416impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
5417 fn typename() -> &'static str {
5418 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
5419 }
5420}
5421
5422#[doc(hidden)]
5423impl google_cloud_gax::paginator::internal::PageableResponse
5424 for ListSingleTenantHsmInstancesResponse
5425{
5426 type PageItem = crate::model::SingleTenantHsmInstance;
5427
5428 fn items(self) -> std::vec::Vec<Self::PageItem> {
5429 self.single_tenant_hsm_instances
5430 }
5431
5432 fn next_page_token(&self) -> std::string::String {
5433 use std::clone::Clone;
5434 self.next_page_token.clone()
5435 }
5436}
5437
5438/// Request message for
5439/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5440///
5441/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5442#[derive(Clone, Default, PartialEq)]
5443#[non_exhaustive]
5444pub struct GetSingleTenantHsmInstanceRequest {
5445 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5446 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5447 /// to get.
5448 ///
5449 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5450 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5451 pub name: std::string::String,
5452
5453 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5454}
5455
5456impl GetSingleTenantHsmInstanceRequest {
5457 /// Creates a new default instance.
5458 pub fn new() -> Self {
5459 std::default::Default::default()
5460 }
5461
5462 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5463 ///
5464 /// # Example
5465 /// ```ignore,no_run
5466 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5467 /// # let project_id = "project_id";
5468 /// # let location_id = "location_id";
5469 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5470 /// let x = GetSingleTenantHsmInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
5471 /// ```
5472 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5473 self.name = v.into();
5474 self
5475 }
5476}
5477
5478impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5479 fn typename() -> &'static str {
5480 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5481 }
5482}
5483
5484/// Request message for
5485/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5486///
5487/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5488#[derive(Clone, Default, PartialEq)]
5489#[non_exhaustive]
5490pub struct CreateSingleTenantHsmInstanceRequest {
5491 /// Required. The resource name of the location associated with the
5492 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5493 /// the format `projects/*/locations/*`.
5494 ///
5495 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5496 pub parent: std::string::String,
5497
5498 /// Optional. It must be unique within a location and match the regular
5499 /// expression `[a-zA-Z0-9_-]{1,63}`.
5500 pub single_tenant_hsm_instance_id: std::string::String,
5501
5502 /// Required. An
5503 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5504 /// initial field values.
5505 ///
5506 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5507 pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5508
5509 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5510}
5511
5512impl CreateSingleTenantHsmInstanceRequest {
5513 /// Creates a new default instance.
5514 pub fn new() -> Self {
5515 std::default::Default::default()
5516 }
5517
5518 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5519 ///
5520 /// # Example
5521 /// ```ignore,no_run
5522 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5523 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5524 /// ```
5525 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5526 self.parent = v.into();
5527 self
5528 }
5529
5530 /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5531 ///
5532 /// # Example
5533 /// ```ignore,no_run
5534 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5535 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5536 /// ```
5537 pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5538 mut self,
5539 v: T,
5540 ) -> Self {
5541 self.single_tenant_hsm_instance_id = v.into();
5542 self
5543 }
5544
5545 /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5546 ///
5547 /// # Example
5548 /// ```ignore,no_run
5549 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5550 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5551 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5552 /// ```
5553 pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5554 where
5555 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5556 {
5557 self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5558 self
5559 }
5560
5561 /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5562 ///
5563 /// # Example
5564 /// ```ignore,no_run
5565 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5566 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5567 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5568 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5569 /// ```
5570 pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5571 where
5572 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5573 {
5574 self.single_tenant_hsm_instance = v.map(|x| x.into());
5575 self
5576 }
5577}
5578
5579impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5580 fn typename() -> &'static str {
5581 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5582 }
5583}
5584
5585/// Metadata message for
5586/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5587/// long-running operation response.
5588///
5589/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5590#[derive(Clone, Default, PartialEq)]
5591#[non_exhaustive]
5592pub struct CreateSingleTenantHsmInstanceMetadata {
5593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5594}
5595
5596impl CreateSingleTenantHsmInstanceMetadata {
5597 /// Creates a new default instance.
5598 pub fn new() -> Self {
5599 std::default::Default::default()
5600 }
5601}
5602
5603impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5604 fn typename() -> &'static str {
5605 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5606 }
5607}
5608
5609/// Request message for
5610/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5611///
5612/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5613#[derive(Clone, Default, PartialEq)]
5614#[non_exhaustive]
5615pub struct CreateSingleTenantHsmInstanceProposalRequest {
5616 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5617 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5618 /// associated with the
5619 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5620 ///
5621 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5622 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5623 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5624 pub parent: std::string::String,
5625
5626 /// Optional. It must be unique within a location and match the regular
5627 /// expression `[a-zA-Z0-9_-]{1,63}`.
5628 pub single_tenant_hsm_instance_proposal_id: std::string::String,
5629
5630 /// Required. The
5631 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5632 /// to create.
5633 ///
5634 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5635 pub single_tenant_hsm_instance_proposal:
5636 std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5637
5638 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5639}
5640
5641impl CreateSingleTenantHsmInstanceProposalRequest {
5642 /// Creates a new default instance.
5643 pub fn new() -> Self {
5644 std::default::Default::default()
5645 }
5646
5647 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5648 ///
5649 /// # Example
5650 /// ```ignore,no_run
5651 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5652 /// # let project_id = "project_id";
5653 /// # let location_id = "location_id";
5654 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5655 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
5656 /// ```
5657 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5658 self.parent = v.into();
5659 self
5660 }
5661
5662 /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5663 ///
5664 /// # Example
5665 /// ```ignore,no_run
5666 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5667 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5668 /// ```
5669 pub fn set_single_tenant_hsm_instance_proposal_id<
5670 T: std::convert::Into<std::string::String>,
5671 >(
5672 mut self,
5673 v: T,
5674 ) -> Self {
5675 self.single_tenant_hsm_instance_proposal_id = v.into();
5676 self
5677 }
5678
5679 /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5680 ///
5681 /// # Example
5682 /// ```ignore,no_run
5683 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5684 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5685 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5686 /// ```
5687 pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5688 where
5689 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5690 {
5691 self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5692 self
5693 }
5694
5695 /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5696 ///
5697 /// # Example
5698 /// ```ignore,no_run
5699 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5700 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5701 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5702 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5703 /// ```
5704 pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5705 mut self,
5706 v: std::option::Option<T>,
5707 ) -> Self
5708 where
5709 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5710 {
5711 self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5712 self
5713 }
5714}
5715
5716impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5717 fn typename() -> &'static str {
5718 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5719 }
5720}
5721
5722/// Metadata message for
5723/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5724/// long-running operation response.
5725///
5726/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5727#[derive(Clone, Default, PartialEq)]
5728#[non_exhaustive]
5729pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5730 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5731}
5732
5733impl CreateSingleTenantHsmInstanceProposalMetadata {
5734 /// Creates a new default instance.
5735 pub fn new() -> Self {
5736 std::default::Default::default()
5737 }
5738}
5739
5740impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5741 fn typename() -> &'static str {
5742 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5743 }
5744}
5745
5746/// Request message for
5747/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5748///
5749/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5750#[derive(Clone, Default, PartialEq)]
5751#[non_exhaustive]
5752pub struct GetSingleTenantHsmInstanceProposalRequest {
5753 /// Required. The
5754 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5755 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5756 /// to get.
5757 ///
5758 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5759 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5760 pub name: std::string::String,
5761
5762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5763}
5764
5765impl GetSingleTenantHsmInstanceProposalRequest {
5766 /// Creates a new default instance.
5767 pub fn new() -> Self {
5768 std::default::Default::default()
5769 }
5770
5771 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5772 ///
5773 /// # Example
5774 /// ```ignore,no_run
5775 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5776 /// # let project_id = "project_id";
5777 /// # let location_id = "location_id";
5778 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5779 /// # let proposal_id = "proposal_id";
5780 /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
5781 /// ```
5782 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5783 self.name = v.into();
5784 self
5785 }
5786}
5787
5788impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5789 fn typename() -> &'static str {
5790 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5791 }
5792}
5793
5794/// Request message for
5795/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5796///
5797/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5798#[derive(Clone, Default, PartialEq)]
5799#[non_exhaustive]
5800pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5801 /// Required. The
5802 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5803 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5804 /// to approve.
5805 ///
5806 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5807 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5808 pub name: std::string::String,
5809
5810 /// The approval payload. The type of approval payload must correspond to the
5811 /// type of approval_parameters in the proposal.
5812 pub approval_payload: std::option::Option<
5813 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5814 >,
5815
5816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5817}
5818
5819impl ApproveSingleTenantHsmInstanceProposalRequest {
5820 /// Creates a new default instance.
5821 pub fn new() -> Self {
5822 std::default::Default::default()
5823 }
5824
5825 /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5826 ///
5827 /// # Example
5828 /// ```ignore,no_run
5829 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5830 /// # let project_id = "project_id";
5831 /// # let location_id = "location_id";
5832 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5833 /// # let proposal_id = "proposal_id";
5834 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
5835 /// ```
5836 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5837 self.name = v.into();
5838 self
5839 }
5840
5841 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5842 ///
5843 /// Note that all the setters affecting `approval_payload` are mutually
5844 /// exclusive.
5845 ///
5846 /// # Example
5847 /// ```ignore,no_run
5848 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5849 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5850 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5851 /// google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5852 /// ```
5853 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
5854 {
5855 self.approval_payload = v.into();
5856 self
5857 }
5858
5859 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5860 /// if it holds a `QuorumReply`, `None` if the field is not set or
5861 /// holds a different branch.
5862 pub fn quorum_reply(
5863 &self,
5864 ) -> std::option::Option<
5865 &std::boxed::Box<
5866 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5867 >,
5868 > {
5869 #[allow(unreachable_patterns)]
5870 self.approval_payload.as_ref().and_then(|v| match v {
5871 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5872 _ => std::option::Option::None,
5873 })
5874 }
5875
5876 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5877 /// to hold a `QuorumReply`.
5878 ///
5879 /// Note that all the setters affecting `approval_payload` are
5880 /// mutually exclusive.
5881 ///
5882 /// # Example
5883 /// ```ignore,no_run
5884 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5885 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5886 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5887 /// assert!(x.quorum_reply().is_some());
5888 /// assert!(x.required_action_quorum_reply().is_none());
5889 /// ```
5890 pub fn set_quorum_reply<
5891 T: std::convert::Into<
5892 std::boxed::Box<
5893 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5894 >,
5895 >,
5896 >(
5897 mut self,
5898 v: T,
5899 ) -> Self {
5900 self.approval_payload = std::option::Option::Some(
5901 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5902 v.into()
5903 )
5904 );
5905 self
5906 }
5907
5908 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5909 /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5910 /// holds a different branch.
5911 pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5912 #[allow(unreachable_patterns)]
5913 self.approval_payload.as_ref().and_then(|v| match v {
5914 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5915 _ => std::option::Option::None,
5916 })
5917 }
5918
5919 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5920 /// to hold a `RequiredActionQuorumReply`.
5921 ///
5922 /// Note that all the setters affecting `approval_payload` are
5923 /// mutually exclusive.
5924 ///
5925 /// # Example
5926 /// ```ignore,no_run
5927 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5928 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5929 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5930 /// assert!(x.required_action_quorum_reply().is_some());
5931 /// assert!(x.quorum_reply().is_none());
5932 /// ```
5933 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{
5934 self.approval_payload = std::option::Option::Some(
5935 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5936 v.into()
5937 )
5938 );
5939 self
5940 }
5941}
5942
5943impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5944 fn typename() -> &'static str {
5945 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5946 }
5947}
5948
5949/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5950pub mod approve_single_tenant_hsm_instance_proposal_request {
5951 #[allow(unused_imports)]
5952 use super::*;
5953
5954 /// The reply to
5955 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5956 /// for approving the proposal.
5957 ///
5958 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5959 #[derive(Clone, Default, PartialEq)]
5960 #[non_exhaustive]
5961 pub struct QuorumReply {
5962 /// Required. The challenge replies to approve the proposal. Challenge
5963 /// replies can be sent across multiple requests. The proposal will be
5964 /// approved when
5965 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5966 /// challenge replies are provided.
5967 ///
5968 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5969 pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5970
5971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5972 }
5973
5974 impl QuorumReply {
5975 /// Creates a new default instance.
5976 pub fn new() -> Self {
5977 std::default::Default::default()
5978 }
5979
5980 /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5981 ///
5982 /// # Example
5983 /// ```ignore,no_run
5984 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5985 /// use google_cloud_kms_v1::model::ChallengeReply;
5986 /// let x = QuorumReply::new()
5987 /// .set_challenge_replies([
5988 /// ChallengeReply::default()/* use setters */,
5989 /// ChallengeReply::default()/* use (different) setters */,
5990 /// ]);
5991 /// ```
5992 pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5993 where
5994 T: std::iter::IntoIterator<Item = V>,
5995 V: std::convert::Into<crate::model::ChallengeReply>,
5996 {
5997 use std::iter::Iterator;
5998 self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5999 self
6000 }
6001 }
6002
6003 impl wkt::message::Message for QuorumReply {
6004 fn typename() -> &'static str {
6005 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
6006 }
6007 }
6008
6009 /// The reply to
6010 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
6011 /// for approving the proposal.
6012 ///
6013 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
6014 #[derive(Clone, Default, PartialEq)]
6015 #[non_exhaustive]
6016 pub struct RequiredActionQuorumReply {
6017 /// Required. All required challenges must be signed for the proposal to be
6018 /// approved. These can be sent across multiple requests.
6019 pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
6020
6021 /// Required. Quorum members' signed challenge replies. These can be provided
6022 /// across multiple requests. The proposal will be approved when
6023 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
6024 /// quorum_challenge_replies are provided and when all
6025 /// required_challenge_replies are provided.
6026 ///
6027 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
6028 pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
6029
6030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6031 }
6032
6033 impl RequiredActionQuorumReply {
6034 /// Creates a new default instance.
6035 pub fn new() -> Self {
6036 std::default::Default::default()
6037 }
6038
6039 /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
6040 ///
6041 /// # Example
6042 /// ```ignore,no_run
6043 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
6044 /// use google_cloud_kms_v1::model::ChallengeReply;
6045 /// let x = RequiredActionQuorumReply::new()
6046 /// .set_required_challenge_replies([
6047 /// ChallengeReply::default()/* use setters */,
6048 /// ChallengeReply::default()/* use (different) setters */,
6049 /// ]);
6050 /// ```
6051 pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
6052 where
6053 T: std::iter::IntoIterator<Item = V>,
6054 V: std::convert::Into<crate::model::ChallengeReply>,
6055 {
6056 use std::iter::Iterator;
6057 self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
6058 self
6059 }
6060
6061 /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
6062 ///
6063 /// # Example
6064 /// ```ignore,no_run
6065 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
6066 /// use google_cloud_kms_v1::model::ChallengeReply;
6067 /// let x = RequiredActionQuorumReply::new()
6068 /// .set_quorum_challenge_replies([
6069 /// ChallengeReply::default()/* use setters */,
6070 /// ChallengeReply::default()/* use (different) setters */,
6071 /// ]);
6072 /// ```
6073 pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
6074 where
6075 T: std::iter::IntoIterator<Item = V>,
6076 V: std::convert::Into<crate::model::ChallengeReply>,
6077 {
6078 use std::iter::Iterator;
6079 self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
6080 self
6081 }
6082 }
6083
6084 impl wkt::message::Message for RequiredActionQuorumReply {
6085 fn typename() -> &'static str {
6086 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
6087 }
6088 }
6089
6090 /// The approval payload. The type of approval payload must correspond to the
6091 /// type of approval_parameters in the proposal.
6092 #[derive(Clone, Debug, PartialEq)]
6093 #[non_exhaustive]
6094 pub enum ApprovalPayload {
6095 /// Required. The reply to
6096 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
6097 /// for approving the proposal.
6098 ///
6099 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
6100 QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
6101 /// Required. The reply to
6102 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
6103 /// for approving the proposal.
6104 ///
6105 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
6106 RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
6107 }
6108}
6109
6110/// Response message for
6111/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
6112///
6113/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
6114#[derive(Clone, Default, PartialEq)]
6115#[non_exhaustive]
6116pub struct ApproveSingleTenantHsmInstanceProposalResponse {
6117 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6118}
6119
6120impl ApproveSingleTenantHsmInstanceProposalResponse {
6121 /// Creates a new default instance.
6122 pub fn new() -> Self {
6123 std::default::Default::default()
6124 }
6125}
6126
6127impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
6128 fn typename() -> &'static str {
6129 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
6130 }
6131}
6132
6133/// Request message for
6134/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
6135///
6136/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6137#[derive(Clone, Default, PartialEq)]
6138#[non_exhaustive]
6139pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
6140 /// Required. The
6141 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6142 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6143 /// to execute.
6144 ///
6145 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6146 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6147 pub name: std::string::String,
6148
6149 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6150}
6151
6152impl ExecuteSingleTenantHsmInstanceProposalRequest {
6153 /// Creates a new default instance.
6154 pub fn new() -> Self {
6155 std::default::Default::default()
6156 }
6157
6158 /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
6159 ///
6160 /// # Example
6161 /// ```ignore,no_run
6162 /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
6163 /// # let project_id = "project_id";
6164 /// # let location_id = "location_id";
6165 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6166 /// # let proposal_id = "proposal_id";
6167 /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
6168 /// ```
6169 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6170 self.name = v.into();
6171 self
6172 }
6173}
6174
6175impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
6176 fn typename() -> &'static str {
6177 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
6178 }
6179}
6180
6181/// Response message for
6182/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
6183///
6184/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6185#[derive(Clone, Default, PartialEq)]
6186#[non_exhaustive]
6187pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
6188 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6189}
6190
6191impl ExecuteSingleTenantHsmInstanceProposalResponse {
6192 /// Creates a new default instance.
6193 pub fn new() -> Self {
6194 std::default::Default::default()
6195 }
6196}
6197
6198impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
6199 fn typename() -> &'static str {
6200 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
6201 }
6202}
6203
6204/// Metadata message for
6205/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
6206/// long-running operation response.
6207///
6208/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6209#[derive(Clone, Default, PartialEq)]
6210#[non_exhaustive]
6211pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
6212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6213}
6214
6215impl ExecuteSingleTenantHsmInstanceProposalMetadata {
6216 /// Creates a new default instance.
6217 pub fn new() -> Self {
6218 std::default::Default::default()
6219 }
6220}
6221
6222impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
6223 fn typename() -> &'static str {
6224 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
6225 }
6226}
6227
6228/// Request message for
6229/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6230///
6231/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6232#[derive(Clone, Default, PartialEq)]
6233#[non_exhaustive]
6234pub struct ListSingleTenantHsmInstanceProposalsRequest {
6235 /// Required. The resource name of the single tenant HSM instance associated
6236 /// with the
6237 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6238 /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
6239 ///
6240 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6241 pub parent: std::string::String,
6242
6243 /// Optional. Optional limit on the number of
6244 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6245 /// to include in the response. Further
6246 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6247 /// can subsequently be obtained by including the
6248 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
6249 /// in a subsequent request. If unspecified, the server will pick an
6250 /// appropriate default.
6251 ///
6252 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6253 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6254 pub page_size: i32,
6255
6256 /// Optional. Optional pagination token, returned earlier via
6257 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
6258 ///
6259 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6260 pub page_token: std::string::String,
6261
6262 /// Optional. Only include resources that match the filter in the response. For
6263 /// more information, see
6264 /// [Sorting and filtering list
6265 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6266 pub filter: std::string::String,
6267
6268 /// Optional. Specify how the results should be sorted. If not specified, the
6269 /// results will be sorted in the default order. For more information, see
6270 /// [Sorting and filtering list
6271 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6272 pub order_by: std::string::String,
6273
6274 /// Optional. If set to true,
6275 /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
6276 /// will also return
6277 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6278 /// in DELETED state.
6279 ///
6280 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6281 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6282 pub show_deleted: bool,
6283
6284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6285}
6286
6287impl ListSingleTenantHsmInstanceProposalsRequest {
6288 /// Creates a new default instance.
6289 pub fn new() -> Self {
6290 std::default::Default::default()
6291 }
6292
6293 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
6294 ///
6295 /// # Example
6296 /// ```ignore,no_run
6297 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6298 /// # let project_id = "project_id";
6299 /// # let location_id = "location_id";
6300 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6301 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
6302 /// ```
6303 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6304 self.parent = v.into();
6305 self
6306 }
6307
6308 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
6309 ///
6310 /// # Example
6311 /// ```ignore,no_run
6312 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6313 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
6314 /// ```
6315 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6316 self.page_size = v.into();
6317 self
6318 }
6319
6320 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
6321 ///
6322 /// # Example
6323 /// ```ignore,no_run
6324 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6325 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
6326 /// ```
6327 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6328 self.page_token = v.into();
6329 self
6330 }
6331
6332 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
6333 ///
6334 /// # Example
6335 /// ```ignore,no_run
6336 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6337 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
6338 /// ```
6339 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6340 self.filter = v.into();
6341 self
6342 }
6343
6344 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
6345 ///
6346 /// # Example
6347 /// ```ignore,no_run
6348 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6349 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
6350 /// ```
6351 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6352 self.order_by = v.into();
6353 self
6354 }
6355
6356 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
6357 ///
6358 /// # Example
6359 /// ```ignore,no_run
6360 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6361 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
6362 /// ```
6363 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6364 self.show_deleted = v.into();
6365 self
6366 }
6367}
6368
6369impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
6370 fn typename() -> &'static str {
6371 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
6372 }
6373}
6374
6375/// Response message for
6376/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6377///
6378/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6379#[derive(Clone, Default, PartialEq)]
6380#[non_exhaustive]
6381pub struct ListSingleTenantHsmInstanceProposalsResponse {
6382 /// The list of
6383 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
6384 ///
6385 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6386 pub single_tenant_hsm_instance_proposals:
6387 std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
6388
6389 /// A token to retrieve next page of results. Pass this value in
6390 /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
6391 /// to retrieve the next page of results.
6392 ///
6393 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
6394 pub next_page_token: std::string::String,
6395
6396 /// The total number of
6397 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6398 /// that matched the query.
6399 ///
6400 /// This field is not populated if
6401 /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
6402 /// is applied.
6403 ///
6404 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
6405 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6406 pub total_size: i32,
6407
6408 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6409}
6410
6411impl ListSingleTenantHsmInstanceProposalsResponse {
6412 /// Creates a new default instance.
6413 pub fn new() -> Self {
6414 std::default::Default::default()
6415 }
6416
6417 /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
6418 ///
6419 /// # Example
6420 /// ```ignore,no_run
6421 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6422 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
6423 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
6424 /// .set_single_tenant_hsm_instance_proposals([
6425 /// SingleTenantHsmInstanceProposal::default()/* use setters */,
6426 /// SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
6427 /// ]);
6428 /// ```
6429 pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
6430 where
6431 T: std::iter::IntoIterator<Item = V>,
6432 V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
6433 {
6434 use std::iter::Iterator;
6435 self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
6436 self
6437 }
6438
6439 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
6440 ///
6441 /// # Example
6442 /// ```ignore,no_run
6443 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6444 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
6445 /// ```
6446 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6447 self.next_page_token = v.into();
6448 self
6449 }
6450
6451 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
6452 ///
6453 /// # Example
6454 /// ```ignore,no_run
6455 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6456 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6457 /// ```
6458 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6459 self.total_size = v.into();
6460 self
6461 }
6462}
6463
6464impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6465 fn typename() -> &'static str {
6466 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6467 }
6468}
6469
6470#[doc(hidden)]
6471impl google_cloud_gax::paginator::internal::PageableResponse
6472 for ListSingleTenantHsmInstanceProposalsResponse
6473{
6474 type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6475
6476 fn items(self) -> std::vec::Vec<Self::PageItem> {
6477 self.single_tenant_hsm_instance_proposals
6478 }
6479
6480 fn next_page_token(&self) -> std::string::String {
6481 use std::clone::Clone;
6482 self.next_page_token.clone()
6483 }
6484}
6485
6486/// Request message for
6487/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6488///
6489/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6490#[derive(Clone, Default, PartialEq)]
6491#[non_exhaustive]
6492pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6493 /// Required. The
6494 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6495 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6496 /// to delete.
6497 ///
6498 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6499 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6500 pub name: std::string::String,
6501
6502 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6503}
6504
6505impl DeleteSingleTenantHsmInstanceProposalRequest {
6506 /// Creates a new default instance.
6507 pub fn new() -> Self {
6508 std::default::Default::default()
6509 }
6510
6511 /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6512 ///
6513 /// # Example
6514 /// ```ignore,no_run
6515 /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6516 /// # let project_id = "project_id";
6517 /// # let location_id = "location_id";
6518 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6519 /// # let proposal_id = "proposal_id";
6520 /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
6521 /// ```
6522 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6523 self.name = v.into();
6524 self
6525 }
6526}
6527
6528impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6529 fn typename() -> &'static str {
6530 "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6531 }
6532}
6533
6534/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6535/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6536///
6537/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6538/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6539#[derive(Clone, Default, PartialEq)]
6540#[non_exhaustive]
6541pub struct KeyRing {
6542 /// Output only. The resource name for the
6543 /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6544 /// `projects/*/locations/*/keyRings/*`.
6545 ///
6546 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6547 pub name: std::string::String,
6548
6549 /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6550 /// was created.
6551 ///
6552 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6553 pub create_time: std::option::Option<wkt::Timestamp>,
6554
6555 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6556}
6557
6558impl KeyRing {
6559 /// Creates a new default instance.
6560 pub fn new() -> Self {
6561 std::default::Default::default()
6562 }
6563
6564 /// Sets the value of [name][crate::model::KeyRing::name].
6565 ///
6566 /// # Example
6567 /// ```ignore,no_run
6568 /// # use google_cloud_kms_v1::model::KeyRing;
6569 /// # let project_id = "project_id";
6570 /// # let location_id = "location_id";
6571 /// # let key_ring_id = "key_ring_id";
6572 /// let x = KeyRing::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
6573 /// ```
6574 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6575 self.name = v.into();
6576 self
6577 }
6578
6579 /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6580 ///
6581 /// # Example
6582 /// ```ignore,no_run
6583 /// # use google_cloud_kms_v1::model::KeyRing;
6584 /// use wkt::Timestamp;
6585 /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6586 /// ```
6587 pub fn set_create_time<T>(mut self, v: T) -> Self
6588 where
6589 T: std::convert::Into<wkt::Timestamp>,
6590 {
6591 self.create_time = std::option::Option::Some(v.into());
6592 self
6593 }
6594
6595 /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6596 ///
6597 /// # Example
6598 /// ```ignore,no_run
6599 /// # use google_cloud_kms_v1::model::KeyRing;
6600 /// use wkt::Timestamp;
6601 /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6602 /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6603 /// ```
6604 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6605 where
6606 T: std::convert::Into<wkt::Timestamp>,
6607 {
6608 self.create_time = v.map(|x| x.into());
6609 self
6610 }
6611}
6612
6613impl wkt::message::Message for KeyRing {
6614 fn typename() -> &'static str {
6615 "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6616 }
6617}
6618
6619/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6620/// can be used for cryptographic operations.
6621///
6622/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6623/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6624/// key material used in cryptographic operations.
6625///
6626/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6627/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6628#[derive(Clone, Default, PartialEq)]
6629#[non_exhaustive]
6630pub struct CryptoKey {
6631 /// Output only. The resource name for this
6632 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6633 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6634 ///
6635 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6636 pub name: std::string::String,
6637
6638 /// Output only. A copy of the "primary"
6639 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6640 /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6641 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6642 /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6643 ///
6644 /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6645 /// updated via
6646 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6647 ///
6648 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6649 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6650 /// may have a primary. For other keys, this field will be omitted.
6651 ///
6652 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6653 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6654 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6655 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6656 /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6657 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6658 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6659 pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6660
6661 /// Immutable. The immutable purpose of this
6662 /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6663 ///
6664 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6665 pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6666
6667 /// Output only. The time at which this
6668 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6669 ///
6670 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6671 pub create_time: std::option::Option<wkt::Timestamp>,
6672
6673 /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6674 /// the Key Management Service will automatically:
6675 ///
6676 /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6677 /// 1. Mark the new version as primary.
6678 ///
6679 /// Key rotations performed manually via
6680 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6681 /// and
6682 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6683 /// do not affect
6684 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6685 ///
6686 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6687 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6688 /// support automatic rotation. For other keys, this field must be omitted.
6689 ///
6690 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6691 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6692 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6693 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6694 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6695 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6696 pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6697
6698 /// A template describing settings for new
6699 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6700 /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6701 /// instances created by either
6702 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6703 /// or auto-rotation are controlled by this template.
6704 ///
6705 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6706 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6707 pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6708
6709 /// Labels with user-defined metadata. For more information, see
6710 /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6711 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6712
6713 /// Immutable. Whether this key may contain imported versions only.
6714 pub import_only: bool,
6715
6716 /// Immutable. The period of time that versions of this key spend in the
6717 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6718 /// state before transitioning to
6719 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6720 /// If not specified at creation time, the default duration is 30 days.
6721 ///
6722 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6723 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6724 pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6725
6726 /// Immutable. The resource name of the backend environment where the key
6727 /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6728 /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6729 /// where all related cryptographic operations are performed. Only applicable
6730 /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6731 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6732 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6733 /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6734 /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6735 /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6736 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6737 /// with the resource name in the format
6738 /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6739 /// Note, this list is non-exhaustive and may apply to additional
6740 /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6741 ///
6742 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6743 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6744 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6745 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6746 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6747 pub crypto_key_backend: std::string::String,
6748
6749 /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6750 /// If this field is present and this key is enrolled in Key Access
6751 /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6752 /// decrypt, and sign operations, and the operation will fail if rejected by
6753 /// the policy. The policy is defined by specifying zero or more allowed
6754 /// justification codes.
6755 /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6756 /// By default, this field is absent, and all justification codes are allowed.
6757 /// If the
6758 /// `key_access_justifications_policy.allowed_access_reasons`
6759 /// is empty (zero allowed justification code), all encrypt, decrypt, and sign
6760 /// operations will fail.
6761 pub key_access_justifications_policy:
6762 std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6763
6764 /// Controls the rate of automatic rotation.
6765 pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6766
6767 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6768}
6769
6770impl CryptoKey {
6771 /// Creates a new default instance.
6772 pub fn new() -> Self {
6773 std::default::Default::default()
6774 }
6775
6776 /// Sets the value of [name][crate::model::CryptoKey::name].
6777 ///
6778 /// # Example
6779 /// ```ignore,no_run
6780 /// # use google_cloud_kms_v1::model::CryptoKey;
6781 /// # let project_id = "project_id";
6782 /// # let location_id = "location_id";
6783 /// # let key_ring_id = "key_ring_id";
6784 /// # let crypto_key_id = "crypto_key_id";
6785 /// let x = CryptoKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
6786 /// ```
6787 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6788 self.name = v.into();
6789 self
6790 }
6791
6792 /// Sets the value of [primary][crate::model::CryptoKey::primary].
6793 ///
6794 /// # Example
6795 /// ```ignore,no_run
6796 /// # use google_cloud_kms_v1::model::CryptoKey;
6797 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6798 /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6799 /// ```
6800 pub fn set_primary<T>(mut self, v: T) -> Self
6801 where
6802 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6803 {
6804 self.primary = std::option::Option::Some(v.into());
6805 self
6806 }
6807
6808 /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6809 ///
6810 /// # Example
6811 /// ```ignore,no_run
6812 /// # use google_cloud_kms_v1::model::CryptoKey;
6813 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6814 /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6815 /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6816 /// ```
6817 pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6818 where
6819 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6820 {
6821 self.primary = v.map(|x| x.into());
6822 self
6823 }
6824
6825 /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6826 ///
6827 /// # Example
6828 /// ```ignore,no_run
6829 /// # use google_cloud_kms_v1::model::CryptoKey;
6830 /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6831 /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6832 /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6833 /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6834 /// ```
6835 pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6836 mut self,
6837 v: T,
6838 ) -> Self {
6839 self.purpose = v.into();
6840 self
6841 }
6842
6843 /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6844 ///
6845 /// # Example
6846 /// ```ignore,no_run
6847 /// # use google_cloud_kms_v1::model::CryptoKey;
6848 /// use wkt::Timestamp;
6849 /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6850 /// ```
6851 pub fn set_create_time<T>(mut self, v: T) -> Self
6852 where
6853 T: std::convert::Into<wkt::Timestamp>,
6854 {
6855 self.create_time = std::option::Option::Some(v.into());
6856 self
6857 }
6858
6859 /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6860 ///
6861 /// # Example
6862 /// ```ignore,no_run
6863 /// # use google_cloud_kms_v1::model::CryptoKey;
6864 /// use wkt::Timestamp;
6865 /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6866 /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6867 /// ```
6868 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6869 where
6870 T: std::convert::Into<wkt::Timestamp>,
6871 {
6872 self.create_time = v.map(|x| x.into());
6873 self
6874 }
6875
6876 /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6877 ///
6878 /// # Example
6879 /// ```ignore,no_run
6880 /// # use google_cloud_kms_v1::model::CryptoKey;
6881 /// use wkt::Timestamp;
6882 /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6883 /// ```
6884 pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6885 where
6886 T: std::convert::Into<wkt::Timestamp>,
6887 {
6888 self.next_rotation_time = std::option::Option::Some(v.into());
6889 self
6890 }
6891
6892 /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6893 ///
6894 /// # Example
6895 /// ```ignore,no_run
6896 /// # use google_cloud_kms_v1::model::CryptoKey;
6897 /// use wkt::Timestamp;
6898 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6899 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6900 /// ```
6901 pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6902 where
6903 T: std::convert::Into<wkt::Timestamp>,
6904 {
6905 self.next_rotation_time = v.map(|x| x.into());
6906 self
6907 }
6908
6909 /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6910 ///
6911 /// # Example
6912 /// ```ignore,no_run
6913 /// # use google_cloud_kms_v1::model::CryptoKey;
6914 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6915 /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6916 /// ```
6917 pub fn set_version_template<T>(mut self, v: T) -> Self
6918 where
6919 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6920 {
6921 self.version_template = std::option::Option::Some(v.into());
6922 self
6923 }
6924
6925 /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6926 ///
6927 /// # Example
6928 /// ```ignore,no_run
6929 /// # use google_cloud_kms_v1::model::CryptoKey;
6930 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6931 /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6932 /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6933 /// ```
6934 pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6935 where
6936 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6937 {
6938 self.version_template = v.map(|x| x.into());
6939 self
6940 }
6941
6942 /// Sets the value of [labels][crate::model::CryptoKey::labels].
6943 ///
6944 /// # Example
6945 /// ```ignore,no_run
6946 /// # use google_cloud_kms_v1::model::CryptoKey;
6947 /// let x = CryptoKey::new().set_labels([
6948 /// ("key0", "abc"),
6949 /// ("key1", "xyz"),
6950 /// ]);
6951 /// ```
6952 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6953 where
6954 T: std::iter::IntoIterator<Item = (K, V)>,
6955 K: std::convert::Into<std::string::String>,
6956 V: std::convert::Into<std::string::String>,
6957 {
6958 use std::iter::Iterator;
6959 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6960 self
6961 }
6962
6963 /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6964 ///
6965 /// # Example
6966 /// ```ignore,no_run
6967 /// # use google_cloud_kms_v1::model::CryptoKey;
6968 /// let x = CryptoKey::new().set_import_only(true);
6969 /// ```
6970 pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6971 self.import_only = v.into();
6972 self
6973 }
6974
6975 /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6976 ///
6977 /// # Example
6978 /// ```ignore,no_run
6979 /// # use google_cloud_kms_v1::model::CryptoKey;
6980 /// use wkt::Duration;
6981 /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6982 /// ```
6983 pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6984 where
6985 T: std::convert::Into<wkt::Duration>,
6986 {
6987 self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6988 self
6989 }
6990
6991 /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6992 ///
6993 /// # Example
6994 /// ```ignore,no_run
6995 /// # use google_cloud_kms_v1::model::CryptoKey;
6996 /// use wkt::Duration;
6997 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6998 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6999 /// ```
7000 pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
7001 where
7002 T: std::convert::Into<wkt::Duration>,
7003 {
7004 self.destroy_scheduled_duration = v.map(|x| x.into());
7005 self
7006 }
7007
7008 /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
7009 ///
7010 /// # Example
7011 /// ```ignore,no_run
7012 /// # use google_cloud_kms_v1::model::CryptoKey;
7013 /// let x = CryptoKey::new().set_crypto_key_backend("example");
7014 /// ```
7015 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
7016 mut self,
7017 v: T,
7018 ) -> Self {
7019 self.crypto_key_backend = v.into();
7020 self
7021 }
7022
7023 /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
7024 ///
7025 /// # Example
7026 /// ```ignore,no_run
7027 /// # use google_cloud_kms_v1::model::CryptoKey;
7028 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
7029 /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
7030 /// ```
7031 pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
7032 where
7033 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
7034 {
7035 self.key_access_justifications_policy = std::option::Option::Some(v.into());
7036 self
7037 }
7038
7039 /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
7040 ///
7041 /// # Example
7042 /// ```ignore,no_run
7043 /// # use google_cloud_kms_v1::model::CryptoKey;
7044 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
7045 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
7046 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
7047 /// ```
7048 pub fn set_or_clear_key_access_justifications_policy<T>(
7049 mut self,
7050 v: std::option::Option<T>,
7051 ) -> Self
7052 where
7053 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
7054 {
7055 self.key_access_justifications_policy = v.map(|x| x.into());
7056 self
7057 }
7058
7059 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
7060 ///
7061 /// Note that all the setters affecting `rotation_schedule` are mutually
7062 /// exclusive.
7063 ///
7064 /// # Example
7065 /// ```ignore,no_run
7066 /// # use google_cloud_kms_v1::model::CryptoKey;
7067 /// use wkt::Duration;
7068 /// let x = CryptoKey::new().set_rotation_schedule(Some(
7069 /// google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
7070 /// ```
7071 pub fn set_rotation_schedule<
7072 T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
7073 >(
7074 mut self,
7075 v: T,
7076 ) -> Self {
7077 self.rotation_schedule = v.into();
7078 self
7079 }
7080
7081 /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
7082 /// if it holds a `RotationPeriod`, `None` if the field is not set or
7083 /// holds a different branch.
7084 pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
7085 #[allow(unreachable_patterns)]
7086 self.rotation_schedule.as_ref().and_then(|v| match v {
7087 crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
7088 std::option::Option::Some(v)
7089 }
7090 _ => std::option::Option::None,
7091 })
7092 }
7093
7094 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
7095 /// to hold a `RotationPeriod`.
7096 ///
7097 /// Note that all the setters affecting `rotation_schedule` are
7098 /// mutually exclusive.
7099 ///
7100 /// # Example
7101 /// ```ignore,no_run
7102 /// # use google_cloud_kms_v1::model::CryptoKey;
7103 /// use wkt::Duration;
7104 /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
7105 /// assert!(x.rotation_period().is_some());
7106 /// ```
7107 pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
7108 mut self,
7109 v: T,
7110 ) -> Self {
7111 self.rotation_schedule = std::option::Option::Some(
7112 crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
7113 );
7114 self
7115 }
7116}
7117
7118impl wkt::message::Message for CryptoKey {
7119 fn typename() -> &'static str {
7120 "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
7121 }
7122}
7123
7124/// Defines additional types related to [CryptoKey].
7125pub mod crypto_key {
7126 #[allow(unused_imports)]
7127 use super::*;
7128
7129 /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
7130 /// describes the cryptographic capabilities of a
7131 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
7132 /// for the operations allowed by its purpose. For more information, see [Key
7133 /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
7134 ///
7135 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7136 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
7137 ///
7138 /// # Working with unknown values
7139 ///
7140 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7141 /// additional enum variants at any time. Adding new variants is not considered
7142 /// a breaking change. Applications should write their code in anticipation of:
7143 ///
7144 /// - New values appearing in future releases of the client library, **and**
7145 /// - New values received dynamically, without application changes.
7146 ///
7147 /// Please consult the [Working with enums] section in the user guide for some
7148 /// guidelines.
7149 ///
7150 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7151 #[derive(Clone, Debug, PartialEq)]
7152 #[non_exhaustive]
7153 pub enum CryptoKeyPurpose {
7154 /// Not specified.
7155 Unspecified,
7156 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7157 /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
7158 /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
7159 ///
7160 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7161 /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
7162 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
7163 EncryptDecrypt,
7164 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7165 /// with
7166 /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
7167 /// and
7168 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
7169 ///
7170 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7171 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
7172 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7173 AsymmetricSign,
7174 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7175 /// with
7176 /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
7177 /// and
7178 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
7179 ///
7180 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7181 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
7182 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7183 AsymmetricDecrypt,
7184 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7185 /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
7186 /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
7187 /// This purpose is meant to be used for interoperable symmetric
7188 /// encryption and does not support automatic CryptoKey rotation.
7189 ///
7190 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7191 /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
7192 /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
7193 RawEncryptDecrypt,
7194 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7195 /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
7196 ///
7197 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7198 /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
7199 Mac,
7200 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7201 /// with
7202 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
7203 /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
7204 ///
7205 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7206 /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
7207 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7208 KeyEncapsulation,
7209 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7210 /// for AES key
7211 ///
7212 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7213 AesWrapping,
7214 /// If set, the enum was initialized with an unknown value.
7215 ///
7216 /// Applications can examine the value using [CryptoKeyPurpose::value] or
7217 /// [CryptoKeyPurpose::name].
7218 UnknownValue(crypto_key_purpose::UnknownValue),
7219 }
7220
7221 #[doc(hidden)]
7222 pub mod crypto_key_purpose {
7223 #[allow(unused_imports)]
7224 use super::*;
7225 #[derive(Clone, Debug, PartialEq)]
7226 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7227 }
7228
7229 impl CryptoKeyPurpose {
7230 /// Gets the enum value.
7231 ///
7232 /// Returns `None` if the enum contains an unknown value deserialized from
7233 /// the string representation of enums.
7234 pub fn value(&self) -> std::option::Option<i32> {
7235 match self {
7236 Self::Unspecified => std::option::Option::Some(0),
7237 Self::EncryptDecrypt => std::option::Option::Some(1),
7238 Self::AsymmetricSign => std::option::Option::Some(5),
7239 Self::AsymmetricDecrypt => std::option::Option::Some(6),
7240 Self::RawEncryptDecrypt => std::option::Option::Some(7),
7241 Self::Mac => std::option::Option::Some(9),
7242 Self::KeyEncapsulation => std::option::Option::Some(10),
7243 Self::AesWrapping => std::option::Option::Some(11),
7244 Self::UnknownValue(u) => u.0.value(),
7245 }
7246 }
7247
7248 /// Gets the enum value as a string.
7249 ///
7250 /// Returns `None` if the enum contains an unknown value deserialized from
7251 /// the integer representation of enums.
7252 pub fn name(&self) -> std::option::Option<&str> {
7253 match self {
7254 Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
7255 Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
7256 Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
7257 Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
7258 Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
7259 Self::Mac => std::option::Option::Some("MAC"),
7260 Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
7261 Self::AesWrapping => std::option::Option::Some("AES_WRAPPING"),
7262 Self::UnknownValue(u) => u.0.name(),
7263 }
7264 }
7265 }
7266
7267 impl std::default::Default for CryptoKeyPurpose {
7268 fn default() -> Self {
7269 use std::convert::From;
7270 Self::from(0)
7271 }
7272 }
7273
7274 impl std::fmt::Display for CryptoKeyPurpose {
7275 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7276 wkt::internal::display_enum(f, self.name(), self.value())
7277 }
7278 }
7279
7280 impl std::convert::From<i32> for CryptoKeyPurpose {
7281 fn from(value: i32) -> Self {
7282 match value {
7283 0 => Self::Unspecified,
7284 1 => Self::EncryptDecrypt,
7285 5 => Self::AsymmetricSign,
7286 6 => Self::AsymmetricDecrypt,
7287 7 => Self::RawEncryptDecrypt,
7288 9 => Self::Mac,
7289 10 => Self::KeyEncapsulation,
7290 11 => Self::AesWrapping,
7291 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7292 wkt::internal::UnknownEnumValue::Integer(value),
7293 )),
7294 }
7295 }
7296 }
7297
7298 impl std::convert::From<&str> for CryptoKeyPurpose {
7299 fn from(value: &str) -> Self {
7300 use std::string::ToString;
7301 match value {
7302 "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
7303 "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
7304 "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
7305 "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
7306 "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
7307 "MAC" => Self::Mac,
7308 "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
7309 "AES_WRAPPING" => Self::AesWrapping,
7310 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7311 wkt::internal::UnknownEnumValue::String(value.to_string()),
7312 )),
7313 }
7314 }
7315 }
7316
7317 impl serde::ser::Serialize for CryptoKeyPurpose {
7318 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7319 where
7320 S: serde::Serializer,
7321 {
7322 match self {
7323 Self::Unspecified => serializer.serialize_i32(0),
7324 Self::EncryptDecrypt => serializer.serialize_i32(1),
7325 Self::AsymmetricSign => serializer.serialize_i32(5),
7326 Self::AsymmetricDecrypt => serializer.serialize_i32(6),
7327 Self::RawEncryptDecrypt => serializer.serialize_i32(7),
7328 Self::Mac => serializer.serialize_i32(9),
7329 Self::KeyEncapsulation => serializer.serialize_i32(10),
7330 Self::AesWrapping => serializer.serialize_i32(11),
7331 Self::UnknownValue(u) => u.0.serialize(serializer),
7332 }
7333 }
7334 }
7335
7336 impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
7337 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7338 where
7339 D: serde::Deserializer<'de>,
7340 {
7341 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
7342 ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
7343 ))
7344 }
7345 }
7346
7347 /// Controls the rate of automatic rotation.
7348 #[derive(Clone, Debug, PartialEq)]
7349 #[non_exhaustive]
7350 pub enum RotationSchedule {
7351 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7352 /// will be advanced by this period when the service automatically rotates a
7353 /// key. Must be at least 24 hours and at most 876,000 hours.
7354 ///
7355 /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
7356 /// set,
7357 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7358 /// must also be set.
7359 ///
7360 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
7361 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
7362 /// support automatic rotation. For other keys, this field must be omitted.
7363 ///
7364 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7365 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
7366 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7367 /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
7368 RotationPeriod(std::boxed::Box<wkt::Duration>),
7369 }
7370}
7371
7372/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
7373/// specifies the properties to use when creating a new
7374/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
7375/// with
7376/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
7377/// or automatically as a result of auto-rotation.
7378///
7379/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7380/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
7381/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7382#[derive(Clone, Default, PartialEq)]
7383#[non_exhaustive]
7384pub struct CryptoKeyVersionTemplate {
7385 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
7386 /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7387 /// template. Immutable. Defaults to
7388 /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
7389 ///
7390 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7391 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7392 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7393 pub protection_level: crate::model::ProtectionLevel,
7394
7395 /// Required.
7396 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7397 /// to use when creating a
7398 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7399 /// template.
7400 ///
7401 /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
7402 /// this field is omitted and
7403 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
7404 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7405 ///
7406 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7407 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7408 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7409 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7410 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7411
7412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7413}
7414
7415impl CryptoKeyVersionTemplate {
7416 /// Creates a new default instance.
7417 pub fn new() -> Self {
7418 std::default::Default::default()
7419 }
7420
7421 /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
7422 ///
7423 /// # Example
7424 /// ```ignore,no_run
7425 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7426 /// use google_cloud_kms_v1::model::ProtectionLevel;
7427 /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
7428 /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
7429 /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
7430 /// ```
7431 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7432 mut self,
7433 v: T,
7434 ) -> Self {
7435 self.protection_level = v.into();
7436 self
7437 }
7438
7439 /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
7440 ///
7441 /// # Example
7442 /// ```ignore,no_run
7443 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7444 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7445 /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7446 /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7447 /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7448 /// ```
7449 pub fn set_algorithm<
7450 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7451 >(
7452 mut self,
7453 v: T,
7454 ) -> Self {
7455 self.algorithm = v.into();
7456 self
7457 }
7458}
7459
7460impl wkt::message::Message for CryptoKeyVersionTemplate {
7461 fn typename() -> &'static str {
7462 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
7463 }
7464}
7465
7466/// Contains an HSM-generated attestation about a key operation. For more
7467/// information, see [Verifying attestations]
7468/// (<https://cloud.google.com/kms/docs/attest-key>).
7469#[derive(Clone, Default, PartialEq)]
7470#[non_exhaustive]
7471pub struct KeyOperationAttestation {
7472 /// Output only. The format of the attestation data.
7473 pub format: crate::model::key_operation_attestation::AttestationFormat,
7474
7475 /// Output only. The attestation data provided by the HSM when the key
7476 /// operation was performed.
7477 pub content: ::bytes::Bytes,
7478
7479 /// Output only. The certificate chains needed to validate the attestation
7480 pub cert_chains:
7481 std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
7482
7483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7484}
7485
7486impl KeyOperationAttestation {
7487 /// Creates a new default instance.
7488 pub fn new() -> Self {
7489 std::default::Default::default()
7490 }
7491
7492 /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7493 ///
7494 /// # Example
7495 /// ```ignore,no_run
7496 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7497 /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7498 /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7499 /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7500 /// ```
7501 pub fn set_format<
7502 T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7503 >(
7504 mut self,
7505 v: T,
7506 ) -> Self {
7507 self.format = v.into();
7508 self
7509 }
7510
7511 /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7512 ///
7513 /// # Example
7514 /// ```ignore,no_run
7515 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7516 /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7517 /// ```
7518 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7519 self.content = v.into();
7520 self
7521 }
7522
7523 /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7524 ///
7525 /// # Example
7526 /// ```ignore,no_run
7527 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7528 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7529 /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7530 /// ```
7531 pub fn set_cert_chains<T>(mut self, v: T) -> Self
7532 where
7533 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7534 {
7535 self.cert_chains = std::option::Option::Some(v.into());
7536 self
7537 }
7538
7539 /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7540 ///
7541 /// # Example
7542 /// ```ignore,no_run
7543 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7544 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7545 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7546 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7547 /// ```
7548 pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7549 where
7550 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7551 {
7552 self.cert_chains = v.map(|x| x.into());
7553 self
7554 }
7555}
7556
7557impl wkt::message::Message for KeyOperationAttestation {
7558 fn typename() -> &'static str {
7559 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7560 }
7561}
7562
7563/// Defines additional types related to [KeyOperationAttestation].
7564pub mod key_operation_attestation {
7565 #[allow(unused_imports)]
7566 use super::*;
7567
7568 /// Certificate chains needed to verify the attestation.
7569 /// Certificates in chains are PEM-encoded and are ordered based on
7570 /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7571 #[derive(Clone, Default, PartialEq)]
7572 #[non_exhaustive]
7573 pub struct CertificateChains {
7574 /// Cavium certificate chain corresponding to the attestation.
7575 pub cavium_certs: std::vec::Vec<std::string::String>,
7576
7577 /// Google card certificate chain corresponding to the attestation.
7578 pub google_card_certs: std::vec::Vec<std::string::String>,
7579
7580 /// Google partition certificate chain corresponding to the attestation.
7581 pub google_partition_certs: std::vec::Vec<std::string::String>,
7582
7583 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7584 }
7585
7586 impl CertificateChains {
7587 /// Creates a new default instance.
7588 pub fn new() -> Self {
7589 std::default::Default::default()
7590 }
7591
7592 /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7593 ///
7594 /// # Example
7595 /// ```ignore,no_run
7596 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7597 /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7598 /// ```
7599 pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7600 where
7601 T: std::iter::IntoIterator<Item = V>,
7602 V: std::convert::Into<std::string::String>,
7603 {
7604 use std::iter::Iterator;
7605 self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7606 self
7607 }
7608
7609 /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7610 ///
7611 /// # Example
7612 /// ```ignore,no_run
7613 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7614 /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7615 /// ```
7616 pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7617 where
7618 T: std::iter::IntoIterator<Item = V>,
7619 V: std::convert::Into<std::string::String>,
7620 {
7621 use std::iter::Iterator;
7622 self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7623 self
7624 }
7625
7626 /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7627 ///
7628 /// # Example
7629 /// ```ignore,no_run
7630 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7631 /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7632 /// ```
7633 pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7634 where
7635 T: std::iter::IntoIterator<Item = V>,
7636 V: std::convert::Into<std::string::String>,
7637 {
7638 use std::iter::Iterator;
7639 self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7640 self
7641 }
7642 }
7643
7644 impl wkt::message::Message for CertificateChains {
7645 fn typename() -> &'static str {
7646 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7647 }
7648 }
7649
7650 /// Attestation formats provided by the HSM.
7651 ///
7652 /// # Working with unknown values
7653 ///
7654 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7655 /// additional enum variants at any time. Adding new variants is not considered
7656 /// a breaking change. Applications should write their code in anticipation of:
7657 ///
7658 /// - New values appearing in future releases of the client library, **and**
7659 /// - New values received dynamically, without application changes.
7660 ///
7661 /// Please consult the [Working with enums] section in the user guide for some
7662 /// guidelines.
7663 ///
7664 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7665 #[derive(Clone, Debug, PartialEq)]
7666 #[non_exhaustive]
7667 pub enum AttestationFormat {
7668 /// Not specified.
7669 Unspecified,
7670 /// Cavium HSM attestation compressed with gzip. Note that this format is
7671 /// defined by Cavium and subject to change at any time.
7672 ///
7673 /// See
7674 /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7675 CaviumV1Compressed,
7676 /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7677 /// introduced in Cavium's version 3.2-08.
7678 CaviumV2Compressed,
7679 /// If set, the enum was initialized with an unknown value.
7680 ///
7681 /// Applications can examine the value using [AttestationFormat::value] or
7682 /// [AttestationFormat::name].
7683 UnknownValue(attestation_format::UnknownValue),
7684 }
7685
7686 #[doc(hidden)]
7687 pub mod attestation_format {
7688 #[allow(unused_imports)]
7689 use super::*;
7690 #[derive(Clone, Debug, PartialEq)]
7691 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7692 }
7693
7694 impl AttestationFormat {
7695 /// Gets the enum value.
7696 ///
7697 /// Returns `None` if the enum contains an unknown value deserialized from
7698 /// the string representation of enums.
7699 pub fn value(&self) -> std::option::Option<i32> {
7700 match self {
7701 Self::Unspecified => std::option::Option::Some(0),
7702 Self::CaviumV1Compressed => std::option::Option::Some(3),
7703 Self::CaviumV2Compressed => std::option::Option::Some(4),
7704 Self::UnknownValue(u) => u.0.value(),
7705 }
7706 }
7707
7708 /// Gets the enum value as a string.
7709 ///
7710 /// Returns `None` if the enum contains an unknown value deserialized from
7711 /// the integer representation of enums.
7712 pub fn name(&self) -> std::option::Option<&str> {
7713 match self {
7714 Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7715 Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7716 Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7717 Self::UnknownValue(u) => u.0.name(),
7718 }
7719 }
7720 }
7721
7722 impl std::default::Default for AttestationFormat {
7723 fn default() -> Self {
7724 use std::convert::From;
7725 Self::from(0)
7726 }
7727 }
7728
7729 impl std::fmt::Display for AttestationFormat {
7730 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7731 wkt::internal::display_enum(f, self.name(), self.value())
7732 }
7733 }
7734
7735 impl std::convert::From<i32> for AttestationFormat {
7736 fn from(value: i32) -> Self {
7737 match value {
7738 0 => Self::Unspecified,
7739 3 => Self::CaviumV1Compressed,
7740 4 => Self::CaviumV2Compressed,
7741 _ => Self::UnknownValue(attestation_format::UnknownValue(
7742 wkt::internal::UnknownEnumValue::Integer(value),
7743 )),
7744 }
7745 }
7746 }
7747
7748 impl std::convert::From<&str> for AttestationFormat {
7749 fn from(value: &str) -> Self {
7750 use std::string::ToString;
7751 match value {
7752 "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7753 "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7754 "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7755 _ => Self::UnknownValue(attestation_format::UnknownValue(
7756 wkt::internal::UnknownEnumValue::String(value.to_string()),
7757 )),
7758 }
7759 }
7760 }
7761
7762 impl serde::ser::Serialize for AttestationFormat {
7763 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7764 where
7765 S: serde::Serializer,
7766 {
7767 match self {
7768 Self::Unspecified => serializer.serialize_i32(0),
7769 Self::CaviumV1Compressed => serializer.serialize_i32(3),
7770 Self::CaviumV2Compressed => serializer.serialize_i32(4),
7771 Self::UnknownValue(u) => u.0.serialize(serializer),
7772 }
7773 }
7774 }
7775
7776 impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7777 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7778 where
7779 D: serde::Deserializer<'de>,
7780 {
7781 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7782 ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7783 ))
7784 }
7785 }
7786}
7787
7788/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7789/// individual cryptographic key, and the associated key material.
7790///
7791/// An
7792/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7793/// version can be used for cryptographic operations.
7794///
7795/// For security reasons, the raw cryptographic key material represented by a
7796/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7797/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7798/// authorized user or application invokes Cloud KMS.
7799///
7800/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7801/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7802#[derive(Clone, Default, PartialEq)]
7803#[non_exhaustive]
7804pub struct CryptoKeyVersion {
7805 /// Output only. The resource name for this
7806 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7807 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7808 ///
7809 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7810 pub name: std::string::String,
7811
7812 /// The current state of the
7813 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7814 ///
7815 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7816 pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7817
7818 /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7819 /// describing how crypto operations are performed with this
7820 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7821 ///
7822 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7823 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7824 pub protection_level: crate::model::ProtectionLevel,
7825
7826 /// Output only. The
7827 /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7828 /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7829 /// supports.
7830 ///
7831 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7832 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7833 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7834
7835 /// Output only. Statement that was generated and signed by the HSM at key
7836 /// creation time. Use this statement to verify attributes of the key as stored
7837 /// on the HSM, independently of Google. Only provided for key versions with
7838 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7839 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7840 ///
7841 /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7842 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7843 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7844
7845 /// Output only. The time at which this
7846 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7847 ///
7848 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7849 pub create_time: std::option::Option<wkt::Timestamp>,
7850
7851 /// Output only. The time this
7852 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7853 /// generated.
7854 ///
7855 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7856 pub generate_time: std::option::Option<wkt::Timestamp>,
7857
7858 /// Output only. The time this
7859 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7860 /// scheduled for destruction. Only present if
7861 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7862 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7863 ///
7864 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7865 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7866 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7867 pub destroy_time: std::option::Option<wkt::Timestamp>,
7868
7869 /// Output only. The time this CryptoKeyVersion's key material was
7870 /// destroyed. Only present if
7871 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7872 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7873 ///
7874 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7875 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7876 pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7877
7878 /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7879 /// used in the most recent import of this
7880 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7881 /// the underlying key material was imported.
7882 ///
7883 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7884 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7885 pub import_job: std::string::String,
7886
7887 /// Output only. The time at which this
7888 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7889 /// most recently imported.
7890 ///
7891 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7892 pub import_time: std::option::Option<wkt::Timestamp>,
7893
7894 /// Output only. The root cause of the most recent import failure. Only present
7895 /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7896 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7897 ///
7898 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7899 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7900 pub import_failure_reason: std::string::String,
7901
7902 /// Output only. The root cause of the most recent generation failure. Only
7903 /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7904 /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7905 ///
7906 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7907 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7908 pub generation_failure_reason: std::string::String,
7909
7910 /// Output only. The root cause of the most recent external destruction
7911 /// failure. Only present if
7912 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7913 /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7914 ///
7915 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7916 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7917 pub external_destruction_failure_reason: std::string::String,
7918
7919 /// ExternalProtectionLevelOptions stores a group of additional fields for
7920 /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7921 /// are specific to the
7922 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7923 /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7924 /// protection levels.
7925 ///
7926 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7927 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7928 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7929 pub external_protection_level_options:
7930 std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7931
7932 /// Output only. Whether or not this key version is eligible for reimport, by
7933 /// being specified as a target in
7934 /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7935 ///
7936 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7937 pub reimport_eligible: bool,
7938
7939 /// Immutable. Field indicating that the key may be wrapped by a trusted key.
7940 /// This field can be set for all key purposes except
7941 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT],
7942 /// and is only valid for keys with protection level
7943 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT].
7944 /// This field can only be set at creation or import time via
7945 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion],
7946 /// or
7947 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
7948 ///
7949 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7950 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7951 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
7952 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
7953 pub trusted_wrapping_enabled: bool,
7954
7955 /// Output only. Field indicating that the key wrapping key is trusted.
7956 /// This field is only valid for key purpose
7957 /// [AES_256_WRAPPING][CryptoKey.CryptoKeyPurpose.AES_256_WRAPPING], and
7958 /// protection level
7959 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT].
7960 ///
7961 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
7962 pub hsm_trusted: bool,
7963
7964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7965}
7966
7967impl CryptoKeyVersion {
7968 /// Creates a new default instance.
7969 pub fn new() -> Self {
7970 std::default::Default::default()
7971 }
7972
7973 /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7974 ///
7975 /// # Example
7976 /// ```ignore,no_run
7977 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7978 /// # let project_id = "project_id";
7979 /// # let location_id = "location_id";
7980 /// # let key_ring_id = "key_ring_id";
7981 /// # let crypto_key_id = "crypto_key_id";
7982 /// # let crypto_key_version_id = "crypto_key_version_id";
7983 /// let x = CryptoKeyVersion::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
7984 /// ```
7985 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7986 self.name = v.into();
7987 self
7988 }
7989
7990 /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7991 ///
7992 /// # Example
7993 /// ```ignore,no_run
7994 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7995 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7996 /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7997 /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7998 /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7999 /// ```
8000 pub fn set_state<
8001 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
8002 >(
8003 mut self,
8004 v: T,
8005 ) -> Self {
8006 self.state = v.into();
8007 self
8008 }
8009
8010 /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
8011 ///
8012 /// # Example
8013 /// ```ignore,no_run
8014 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8015 /// use google_cloud_kms_v1::model::ProtectionLevel;
8016 /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
8017 /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
8018 /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
8019 /// ```
8020 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
8021 mut self,
8022 v: T,
8023 ) -> Self {
8024 self.protection_level = v.into();
8025 self
8026 }
8027
8028 /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
8029 ///
8030 /// # Example
8031 /// ```ignore,no_run
8032 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8033 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
8034 /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
8035 /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
8036 /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
8037 /// ```
8038 pub fn set_algorithm<
8039 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
8040 >(
8041 mut self,
8042 v: T,
8043 ) -> Self {
8044 self.algorithm = v.into();
8045 self
8046 }
8047
8048 /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
8049 ///
8050 /// # Example
8051 /// ```ignore,no_run
8052 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8053 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
8054 /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
8055 /// ```
8056 pub fn set_attestation<T>(mut self, v: T) -> Self
8057 where
8058 T: std::convert::Into<crate::model::KeyOperationAttestation>,
8059 {
8060 self.attestation = std::option::Option::Some(v.into());
8061 self
8062 }
8063
8064 /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
8065 ///
8066 /// # Example
8067 /// ```ignore,no_run
8068 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8069 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
8070 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
8071 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
8072 /// ```
8073 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
8074 where
8075 T: std::convert::Into<crate::model::KeyOperationAttestation>,
8076 {
8077 self.attestation = v.map(|x| x.into());
8078 self
8079 }
8080
8081 /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
8082 ///
8083 /// # Example
8084 /// ```ignore,no_run
8085 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8086 /// use wkt::Timestamp;
8087 /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
8088 /// ```
8089 pub fn set_create_time<T>(mut self, v: T) -> Self
8090 where
8091 T: std::convert::Into<wkt::Timestamp>,
8092 {
8093 self.create_time = std::option::Option::Some(v.into());
8094 self
8095 }
8096
8097 /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
8098 ///
8099 /// # Example
8100 /// ```ignore,no_run
8101 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8102 /// use wkt::Timestamp;
8103 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
8104 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
8105 /// ```
8106 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
8107 where
8108 T: std::convert::Into<wkt::Timestamp>,
8109 {
8110 self.create_time = v.map(|x| x.into());
8111 self
8112 }
8113
8114 /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
8115 ///
8116 /// # Example
8117 /// ```ignore,no_run
8118 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8119 /// use wkt::Timestamp;
8120 /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
8121 /// ```
8122 pub fn set_generate_time<T>(mut self, v: T) -> Self
8123 where
8124 T: std::convert::Into<wkt::Timestamp>,
8125 {
8126 self.generate_time = std::option::Option::Some(v.into());
8127 self
8128 }
8129
8130 /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
8131 ///
8132 /// # Example
8133 /// ```ignore,no_run
8134 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8135 /// use wkt::Timestamp;
8136 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
8137 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
8138 /// ```
8139 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
8140 where
8141 T: std::convert::Into<wkt::Timestamp>,
8142 {
8143 self.generate_time = v.map(|x| x.into());
8144 self
8145 }
8146
8147 /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
8148 ///
8149 /// # Example
8150 /// ```ignore,no_run
8151 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8152 /// use wkt::Timestamp;
8153 /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
8154 /// ```
8155 pub fn set_destroy_time<T>(mut self, v: T) -> Self
8156 where
8157 T: std::convert::Into<wkt::Timestamp>,
8158 {
8159 self.destroy_time = std::option::Option::Some(v.into());
8160 self
8161 }
8162
8163 /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
8164 ///
8165 /// # Example
8166 /// ```ignore,no_run
8167 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8168 /// use wkt::Timestamp;
8169 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
8170 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
8171 /// ```
8172 pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
8173 where
8174 T: std::convert::Into<wkt::Timestamp>,
8175 {
8176 self.destroy_time = v.map(|x| x.into());
8177 self
8178 }
8179
8180 /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
8181 ///
8182 /// # Example
8183 /// ```ignore,no_run
8184 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8185 /// use wkt::Timestamp;
8186 /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
8187 /// ```
8188 pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
8189 where
8190 T: std::convert::Into<wkt::Timestamp>,
8191 {
8192 self.destroy_event_time = std::option::Option::Some(v.into());
8193 self
8194 }
8195
8196 /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
8197 ///
8198 /// # Example
8199 /// ```ignore,no_run
8200 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8201 /// use wkt::Timestamp;
8202 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
8203 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
8204 /// ```
8205 pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
8206 where
8207 T: std::convert::Into<wkt::Timestamp>,
8208 {
8209 self.destroy_event_time = v.map(|x| x.into());
8210 self
8211 }
8212
8213 /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
8214 ///
8215 /// # Example
8216 /// ```ignore,no_run
8217 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8218 /// let x = CryptoKeyVersion::new().set_import_job("example");
8219 /// ```
8220 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8221 self.import_job = v.into();
8222 self
8223 }
8224
8225 /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
8226 ///
8227 /// # Example
8228 /// ```ignore,no_run
8229 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8230 /// use wkt::Timestamp;
8231 /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
8232 /// ```
8233 pub fn set_import_time<T>(mut self, v: T) -> Self
8234 where
8235 T: std::convert::Into<wkt::Timestamp>,
8236 {
8237 self.import_time = std::option::Option::Some(v.into());
8238 self
8239 }
8240
8241 /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
8242 ///
8243 /// # Example
8244 /// ```ignore,no_run
8245 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8246 /// use wkt::Timestamp;
8247 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
8248 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
8249 /// ```
8250 pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
8251 where
8252 T: std::convert::Into<wkt::Timestamp>,
8253 {
8254 self.import_time = v.map(|x| x.into());
8255 self
8256 }
8257
8258 /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
8259 ///
8260 /// # Example
8261 /// ```ignore,no_run
8262 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8263 /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
8264 /// ```
8265 pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
8266 mut self,
8267 v: T,
8268 ) -> Self {
8269 self.import_failure_reason = v.into();
8270 self
8271 }
8272
8273 /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
8274 ///
8275 /// # Example
8276 /// ```ignore,no_run
8277 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8278 /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
8279 /// ```
8280 pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
8281 mut self,
8282 v: T,
8283 ) -> Self {
8284 self.generation_failure_reason = v.into();
8285 self
8286 }
8287
8288 /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
8289 ///
8290 /// # Example
8291 /// ```ignore,no_run
8292 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8293 /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
8294 /// ```
8295 pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
8296 mut self,
8297 v: T,
8298 ) -> Self {
8299 self.external_destruction_failure_reason = v.into();
8300 self
8301 }
8302
8303 /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8304 ///
8305 /// # Example
8306 /// ```ignore,no_run
8307 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8308 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8309 /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
8310 /// ```
8311 pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
8312 where
8313 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8314 {
8315 self.external_protection_level_options = std::option::Option::Some(v.into());
8316 self
8317 }
8318
8319 /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8320 ///
8321 /// # Example
8322 /// ```ignore,no_run
8323 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8324 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8325 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
8326 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
8327 /// ```
8328 pub fn set_or_clear_external_protection_level_options<T>(
8329 mut self,
8330 v: std::option::Option<T>,
8331 ) -> Self
8332 where
8333 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8334 {
8335 self.external_protection_level_options = v.map(|x| x.into());
8336 self
8337 }
8338
8339 /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
8340 ///
8341 /// # Example
8342 /// ```ignore,no_run
8343 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8344 /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
8345 /// ```
8346 pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8347 self.reimport_eligible = v.into();
8348 self
8349 }
8350
8351 /// Sets the value of [trusted_wrapping_enabled][crate::model::CryptoKeyVersion::trusted_wrapping_enabled].
8352 ///
8353 /// # Example
8354 /// ```ignore,no_run
8355 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8356 /// let x = CryptoKeyVersion::new().set_trusted_wrapping_enabled(true);
8357 /// ```
8358 pub fn set_trusted_wrapping_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8359 self.trusted_wrapping_enabled = v.into();
8360 self
8361 }
8362
8363 /// Sets the value of [hsm_trusted][crate::model::CryptoKeyVersion::hsm_trusted].
8364 ///
8365 /// # Example
8366 /// ```ignore,no_run
8367 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8368 /// let x = CryptoKeyVersion::new().set_hsm_trusted(true);
8369 /// ```
8370 pub fn set_hsm_trusted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8371 self.hsm_trusted = v.into();
8372 self
8373 }
8374}
8375
8376impl wkt::message::Message for CryptoKeyVersion {
8377 fn typename() -> &'static str {
8378 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
8379 }
8380}
8381
8382/// Defines additional types related to [CryptoKeyVersion].
8383pub mod crypto_key_version {
8384 #[allow(unused_imports)]
8385 use super::*;
8386
8387 /// The algorithm of the
8388 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
8389 /// parameters must be used for each cryptographic operation.
8390 ///
8391 /// The
8392 /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
8393 /// algorithm is usable with
8394 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8395 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
8396 ///
8397 /// Algorithms beginning with `RSA_SIGN_` are usable with
8398 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8399 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8400 ///
8401 /// The fields in the name after `RSA_SIGN_` correspond to the following
8402 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8403 ///
8404 /// For PSS, the salt length used is equal to the length of digest
8405 /// algorithm. For example,
8406 /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
8407 /// will use PSS with a salt length of 256 bits or 32 bytes.
8408 ///
8409 /// Algorithms beginning with `RSA_DECRYPT_` are usable with
8410 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8411 /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
8412 ///
8413 /// The fields in the name after `RSA_DECRYPT_` correspond to the following
8414 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8415 ///
8416 /// Algorithms beginning with `EC_SIGN_` are usable with
8417 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8418 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8419 ///
8420 /// The fields in the name after `EC_SIGN_` correspond to the following
8421 /// parameters: elliptic curve, digest algorithm.
8422 ///
8423 /// Algorithms beginning with `HMAC_` are usable with
8424 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8425 /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
8426 ///
8427 /// The suffix following `HMAC_` corresponds to the hash algorithm being used
8428 /// (eg. SHA256).
8429 ///
8430 /// Algorithms beginning with `PQ_` are post-quantum.
8431 ///
8432 /// For more information, see [Key purposes and algorithms]
8433 /// (<https://cloud.google.com/kms/docs/algorithms>).
8434 ///
8435 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
8436 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
8437 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
8438 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
8439 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
8440 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8441 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
8442 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
8443 ///
8444 /// # Working with unknown values
8445 ///
8446 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8447 /// additional enum variants at any time. Adding new variants is not considered
8448 /// a breaking change. Applications should write their code in anticipation of:
8449 ///
8450 /// - New values appearing in future releases of the client library, **and**
8451 /// - New values received dynamically, without application changes.
8452 ///
8453 /// Please consult the [Working with enums] section in the user guide for some
8454 /// guidelines.
8455 ///
8456 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8457 #[derive(Clone, Debug, PartialEq)]
8458 #[non_exhaustive]
8459 pub enum CryptoKeyVersionAlgorithm {
8460 /// Not specified.
8461 Unspecified,
8462 /// Creates symmetric encryption keys.
8463 GoogleSymmetricEncryption,
8464 /// AES-GCM (Galois Counter Mode) using 128-bit keys.
8465 Aes128Gcm,
8466 /// AES-GCM (Galois Counter Mode) using 256-bit keys.
8467 Aes256Gcm,
8468 /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
8469 Aes128Cbc,
8470 /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
8471 Aes256Cbc,
8472 /// AES-CTR (Counter Mode) using 128-bit keys.
8473 Aes128Ctr,
8474 /// AES-CTR (Counter Mode) using 256-bit keys.
8475 Aes256Ctr,
8476 /// RSASSA-PSS 2048 bit key with a SHA256 digest.
8477 RsaSignPss2048Sha256,
8478 /// RSASSA-PSS 3072 bit key with a SHA256 digest.
8479 RsaSignPss3072Sha256,
8480 /// RSASSA-PSS 4096 bit key with a SHA256 digest.
8481 RsaSignPss4096Sha256,
8482 /// RSASSA-PSS 4096 bit key with a SHA512 digest.
8483 RsaSignPss4096Sha512,
8484 /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
8485 RsaSignPkcs12048Sha256,
8486 /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
8487 RsaSignPkcs13072Sha256,
8488 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
8489 RsaSignPkcs14096Sha256,
8490 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
8491 RsaSignPkcs14096Sha512,
8492 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
8493 RsaSignRawPkcs12048,
8494 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
8495 RsaSignRawPkcs13072,
8496 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
8497 RsaSignRawPkcs14096,
8498 /// RSAES-OAEP 2048 bit key with a SHA256 digest.
8499 RsaDecryptOaep2048Sha256,
8500 /// RSAES-OAEP 3072 bit key with a SHA256 digest.
8501 RsaDecryptOaep3072Sha256,
8502 /// RSAES-OAEP 4096 bit key with a SHA256 digest.
8503 RsaDecryptOaep4096Sha256,
8504 /// RSAES-OAEP 4096 bit key with a SHA512 digest.
8505 RsaDecryptOaep4096Sha512,
8506 /// RSAES-OAEP 2048 bit key with a SHA1 digest.
8507 RsaDecryptOaep2048Sha1,
8508 /// RSAES-OAEP 3072 bit key with a SHA1 digest.
8509 RsaDecryptOaep3072Sha1,
8510 /// RSAES-OAEP 4096 bit key with a SHA1 digest.
8511 RsaDecryptOaep4096Sha1,
8512 /// ECDSA on the NIST P-256 curve with a SHA256 digest.
8513 /// Other hash functions can also be used:
8514 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8515 EcSignP256Sha256,
8516 /// ECDSA on the NIST P-384 curve with a SHA384 digest.
8517 /// Other hash functions can also be used:
8518 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8519 EcSignP384Sha384,
8520 /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
8521 /// HSM protection level.
8522 /// Other hash functions can also be used:
8523 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8524 EcSignSecp256K1Sha256,
8525 /// EdDSA on the Curve25519 in pure mode (taking data as input).
8526 EcSignEd25519,
8527 /// HMAC-SHA256 signing with a 256 bit key.
8528 HmacSha256,
8529 /// HMAC-SHA1 signing with a 160 bit key.
8530 HmacSha1,
8531 /// HMAC-SHA384 signing with a 384 bit key.
8532 HmacSha384,
8533 /// HMAC-SHA512 signing with a 512 bit key.
8534 HmacSha512,
8535 /// HMAC-SHA224 signing with a 224 bit key.
8536 HmacSha224,
8537 /// Algorithm representing symmetric encryption by an external key manager.
8538 ExternalSymmetricEncryption,
8539 /// ML-KEM-768 (FIPS 203)
8540 MlKem768,
8541 /// ML-KEM-1024 (FIPS 203)
8542 MlKem1024,
8543 /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
8544 /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8545 KemXwing,
8546 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8547 /// security level 1. Randomized version.
8548 PqSignMlDsa44,
8549 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8550 /// security level 3. Randomized version.
8551 PqSignMlDsa65,
8552 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8553 /// security level 5. Randomized version.
8554 PqSignMlDsa87,
8555 /// The post-quantum stateless hash-based digital signature algorithm, at
8556 /// security level 1. Randomized version.
8557 PqSignSlhDsaSha2128S,
8558 /// The post-quantum stateless hash-based digital signature algorithm, at
8559 /// security level 1. Randomized pre-hash version supporting SHA256 digests.
8560 PqSignHashSlhDsaSha2128SSha256,
8561 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8562 /// security level 1. Randomized version supporting externally-computed
8563 /// message representatives.
8564 PqSignMlDsa44ExternalMu,
8565 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8566 /// security level 3. Randomized version supporting externally-computed
8567 /// message representatives.
8568 PqSignMlDsa65ExternalMu,
8569 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8570 /// security level 5. Randomized version supporting externally-computed
8571 /// message representatives.
8572 PqSignMlDsa87ExternalMu,
8573 /// AES key wrap with zero padding algorithm (RFC 5649). Can only be used
8574 /// by keys with purpose AES_WRAPPING.
8575 Aes256Kwp,
8576 /// If set, the enum was initialized with an unknown value.
8577 ///
8578 /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8579 /// [CryptoKeyVersionAlgorithm::name].
8580 UnknownValue(crypto_key_version_algorithm::UnknownValue),
8581 }
8582
8583 #[doc(hidden)]
8584 pub mod crypto_key_version_algorithm {
8585 #[allow(unused_imports)]
8586 use super::*;
8587 #[derive(Clone, Debug, PartialEq)]
8588 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8589 }
8590
8591 impl CryptoKeyVersionAlgorithm {
8592 /// Gets the enum value.
8593 ///
8594 /// Returns `None` if the enum contains an unknown value deserialized from
8595 /// the string representation of enums.
8596 pub fn value(&self) -> std::option::Option<i32> {
8597 match self {
8598 Self::Unspecified => std::option::Option::Some(0),
8599 Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8600 Self::Aes128Gcm => std::option::Option::Some(41),
8601 Self::Aes256Gcm => std::option::Option::Some(19),
8602 Self::Aes128Cbc => std::option::Option::Some(42),
8603 Self::Aes256Cbc => std::option::Option::Some(43),
8604 Self::Aes128Ctr => std::option::Option::Some(44),
8605 Self::Aes256Ctr => std::option::Option::Some(45),
8606 Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8607 Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8608 Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8609 Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8610 Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8611 Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8612 Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8613 Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8614 Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8615 Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8616 Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8617 Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8618 Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8619 Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8620 Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8621 Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8622 Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8623 Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8624 Self::EcSignP256Sha256 => std::option::Option::Some(12),
8625 Self::EcSignP384Sha384 => std::option::Option::Some(13),
8626 Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8627 Self::EcSignEd25519 => std::option::Option::Some(40),
8628 Self::HmacSha256 => std::option::Option::Some(32),
8629 Self::HmacSha1 => std::option::Option::Some(33),
8630 Self::HmacSha384 => std::option::Option::Some(34),
8631 Self::HmacSha512 => std::option::Option::Some(35),
8632 Self::HmacSha224 => std::option::Option::Some(36),
8633 Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8634 Self::MlKem768 => std::option::Option::Some(47),
8635 Self::MlKem1024 => std::option::Option::Some(48),
8636 Self::KemXwing => std::option::Option::Some(63),
8637 Self::PqSignMlDsa44 => std::option::Option::Some(68),
8638 Self::PqSignMlDsa65 => std::option::Option::Some(56),
8639 Self::PqSignMlDsa87 => std::option::Option::Some(69),
8640 Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8641 Self::PqSignHashSlhDsaSha2128SSha256 => std::option::Option::Some(60),
8642 Self::PqSignMlDsa44ExternalMu => std::option::Option::Some(70),
8643 Self::PqSignMlDsa65ExternalMu => std::option::Option::Some(67),
8644 Self::PqSignMlDsa87ExternalMu => std::option::Option::Some(71),
8645 Self::Aes256Kwp => std::option::Option::Some(73),
8646 Self::UnknownValue(u) => u.0.value(),
8647 }
8648 }
8649
8650 /// Gets the enum value as a string.
8651 ///
8652 /// Returns `None` if the enum contains an unknown value deserialized from
8653 /// the integer representation of enums.
8654 pub fn name(&self) -> std::option::Option<&str> {
8655 match self {
8656 Self::Unspecified => {
8657 std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8658 }
8659 Self::GoogleSymmetricEncryption => {
8660 std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8661 }
8662 Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8663 Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8664 Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8665 Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8666 Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8667 Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8668 Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8669 Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8670 Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8671 Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8672 Self::RsaSignPkcs12048Sha256 => {
8673 std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8674 }
8675 Self::RsaSignPkcs13072Sha256 => {
8676 std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8677 }
8678 Self::RsaSignPkcs14096Sha256 => {
8679 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8680 }
8681 Self::RsaSignPkcs14096Sha512 => {
8682 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8683 }
8684 Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8685 Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8686 Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8687 Self::RsaDecryptOaep2048Sha256 => {
8688 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8689 }
8690 Self::RsaDecryptOaep3072Sha256 => {
8691 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8692 }
8693 Self::RsaDecryptOaep4096Sha256 => {
8694 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8695 }
8696 Self::RsaDecryptOaep4096Sha512 => {
8697 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8698 }
8699 Self::RsaDecryptOaep2048Sha1 => {
8700 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8701 }
8702 Self::RsaDecryptOaep3072Sha1 => {
8703 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8704 }
8705 Self::RsaDecryptOaep4096Sha1 => {
8706 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8707 }
8708 Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8709 Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8710 Self::EcSignSecp256K1Sha256 => {
8711 std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8712 }
8713 Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8714 Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8715 Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8716 Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8717 Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8718 Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8719 Self::ExternalSymmetricEncryption => {
8720 std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8721 }
8722 Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8723 Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8724 Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8725 Self::PqSignMlDsa44 => std::option::Option::Some("PQ_SIGN_ML_DSA_44"),
8726 Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8727 Self::PqSignMlDsa87 => std::option::Option::Some("PQ_SIGN_ML_DSA_87"),
8728 Self::PqSignSlhDsaSha2128S => {
8729 std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8730 }
8731 Self::PqSignHashSlhDsaSha2128SSha256 => {
8732 std::option::Option::Some("PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256")
8733 }
8734 Self::PqSignMlDsa44ExternalMu => {
8735 std::option::Option::Some("PQ_SIGN_ML_DSA_44_EXTERNAL_MU")
8736 }
8737 Self::PqSignMlDsa65ExternalMu => {
8738 std::option::Option::Some("PQ_SIGN_ML_DSA_65_EXTERNAL_MU")
8739 }
8740 Self::PqSignMlDsa87ExternalMu => {
8741 std::option::Option::Some("PQ_SIGN_ML_DSA_87_EXTERNAL_MU")
8742 }
8743 Self::Aes256Kwp => std::option::Option::Some("AES_256_KWP"),
8744 Self::UnknownValue(u) => u.0.name(),
8745 }
8746 }
8747 }
8748
8749 impl std::default::Default for CryptoKeyVersionAlgorithm {
8750 fn default() -> Self {
8751 use std::convert::From;
8752 Self::from(0)
8753 }
8754 }
8755
8756 impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8757 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8758 wkt::internal::display_enum(f, self.name(), self.value())
8759 }
8760 }
8761
8762 impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8763 fn from(value: i32) -> Self {
8764 match value {
8765 0 => Self::Unspecified,
8766 1 => Self::GoogleSymmetricEncryption,
8767 2 => Self::RsaSignPss2048Sha256,
8768 3 => Self::RsaSignPss3072Sha256,
8769 4 => Self::RsaSignPss4096Sha256,
8770 5 => Self::RsaSignPkcs12048Sha256,
8771 6 => Self::RsaSignPkcs13072Sha256,
8772 7 => Self::RsaSignPkcs14096Sha256,
8773 8 => Self::RsaDecryptOaep2048Sha256,
8774 9 => Self::RsaDecryptOaep3072Sha256,
8775 10 => Self::RsaDecryptOaep4096Sha256,
8776 12 => Self::EcSignP256Sha256,
8777 13 => Self::EcSignP384Sha384,
8778 15 => Self::RsaSignPss4096Sha512,
8779 16 => Self::RsaSignPkcs14096Sha512,
8780 17 => Self::RsaDecryptOaep4096Sha512,
8781 18 => Self::ExternalSymmetricEncryption,
8782 19 => Self::Aes256Gcm,
8783 28 => Self::RsaSignRawPkcs12048,
8784 29 => Self::RsaSignRawPkcs13072,
8785 30 => Self::RsaSignRawPkcs14096,
8786 31 => Self::EcSignSecp256K1Sha256,
8787 32 => Self::HmacSha256,
8788 33 => Self::HmacSha1,
8789 34 => Self::HmacSha384,
8790 35 => Self::HmacSha512,
8791 36 => Self::HmacSha224,
8792 37 => Self::RsaDecryptOaep2048Sha1,
8793 38 => Self::RsaDecryptOaep3072Sha1,
8794 39 => Self::RsaDecryptOaep4096Sha1,
8795 40 => Self::EcSignEd25519,
8796 41 => Self::Aes128Gcm,
8797 42 => Self::Aes128Cbc,
8798 43 => Self::Aes256Cbc,
8799 44 => Self::Aes128Ctr,
8800 45 => Self::Aes256Ctr,
8801 47 => Self::MlKem768,
8802 48 => Self::MlKem1024,
8803 56 => Self::PqSignMlDsa65,
8804 57 => Self::PqSignSlhDsaSha2128S,
8805 60 => Self::PqSignHashSlhDsaSha2128SSha256,
8806 63 => Self::KemXwing,
8807 67 => Self::PqSignMlDsa65ExternalMu,
8808 68 => Self::PqSignMlDsa44,
8809 69 => Self::PqSignMlDsa87,
8810 70 => Self::PqSignMlDsa44ExternalMu,
8811 71 => Self::PqSignMlDsa87ExternalMu,
8812 73 => Self::Aes256Kwp,
8813 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8814 wkt::internal::UnknownEnumValue::Integer(value),
8815 )),
8816 }
8817 }
8818 }
8819
8820 impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8821 fn from(value: &str) -> Self {
8822 use std::string::ToString;
8823 match value {
8824 "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8825 "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8826 "AES_128_GCM" => Self::Aes128Gcm,
8827 "AES_256_GCM" => Self::Aes256Gcm,
8828 "AES_128_CBC" => Self::Aes128Cbc,
8829 "AES_256_CBC" => Self::Aes256Cbc,
8830 "AES_128_CTR" => Self::Aes128Ctr,
8831 "AES_256_CTR" => Self::Aes256Ctr,
8832 "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8833 "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8834 "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8835 "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8836 "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8837 "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8838 "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8839 "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8840 "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8841 "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8842 "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8843 "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8844 "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8845 "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8846 "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8847 "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8848 "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8849 "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8850 "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8851 "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8852 "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8853 "EC_SIGN_ED25519" => Self::EcSignEd25519,
8854 "HMAC_SHA256" => Self::HmacSha256,
8855 "HMAC_SHA1" => Self::HmacSha1,
8856 "HMAC_SHA384" => Self::HmacSha384,
8857 "HMAC_SHA512" => Self::HmacSha512,
8858 "HMAC_SHA224" => Self::HmacSha224,
8859 "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8860 "ML_KEM_768" => Self::MlKem768,
8861 "ML_KEM_1024" => Self::MlKem1024,
8862 "KEM_XWING" => Self::KemXwing,
8863 "PQ_SIGN_ML_DSA_44" => Self::PqSignMlDsa44,
8864 "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8865 "PQ_SIGN_ML_DSA_87" => Self::PqSignMlDsa87,
8866 "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8867 "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256" => Self::PqSignHashSlhDsaSha2128SSha256,
8868 "PQ_SIGN_ML_DSA_44_EXTERNAL_MU" => Self::PqSignMlDsa44ExternalMu,
8869 "PQ_SIGN_ML_DSA_65_EXTERNAL_MU" => Self::PqSignMlDsa65ExternalMu,
8870 "PQ_SIGN_ML_DSA_87_EXTERNAL_MU" => Self::PqSignMlDsa87ExternalMu,
8871 "AES_256_KWP" => Self::Aes256Kwp,
8872 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8873 wkt::internal::UnknownEnumValue::String(value.to_string()),
8874 )),
8875 }
8876 }
8877 }
8878
8879 impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8880 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8881 where
8882 S: serde::Serializer,
8883 {
8884 match self {
8885 Self::Unspecified => serializer.serialize_i32(0),
8886 Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8887 Self::Aes128Gcm => serializer.serialize_i32(41),
8888 Self::Aes256Gcm => serializer.serialize_i32(19),
8889 Self::Aes128Cbc => serializer.serialize_i32(42),
8890 Self::Aes256Cbc => serializer.serialize_i32(43),
8891 Self::Aes128Ctr => serializer.serialize_i32(44),
8892 Self::Aes256Ctr => serializer.serialize_i32(45),
8893 Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8894 Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8895 Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8896 Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8897 Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8898 Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8899 Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8900 Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8901 Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8902 Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8903 Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8904 Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8905 Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8906 Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8907 Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8908 Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8909 Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8910 Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8911 Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8912 Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8913 Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8914 Self::EcSignEd25519 => serializer.serialize_i32(40),
8915 Self::HmacSha256 => serializer.serialize_i32(32),
8916 Self::HmacSha1 => serializer.serialize_i32(33),
8917 Self::HmacSha384 => serializer.serialize_i32(34),
8918 Self::HmacSha512 => serializer.serialize_i32(35),
8919 Self::HmacSha224 => serializer.serialize_i32(36),
8920 Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8921 Self::MlKem768 => serializer.serialize_i32(47),
8922 Self::MlKem1024 => serializer.serialize_i32(48),
8923 Self::KemXwing => serializer.serialize_i32(63),
8924 Self::PqSignMlDsa44 => serializer.serialize_i32(68),
8925 Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8926 Self::PqSignMlDsa87 => serializer.serialize_i32(69),
8927 Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8928 Self::PqSignHashSlhDsaSha2128SSha256 => serializer.serialize_i32(60),
8929 Self::PqSignMlDsa44ExternalMu => serializer.serialize_i32(70),
8930 Self::PqSignMlDsa65ExternalMu => serializer.serialize_i32(67),
8931 Self::PqSignMlDsa87ExternalMu => serializer.serialize_i32(71),
8932 Self::Aes256Kwp => serializer.serialize_i32(73),
8933 Self::UnknownValue(u) => u.0.serialize(serializer),
8934 }
8935 }
8936 }
8937
8938 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8939 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8940 where
8941 D: serde::Deserializer<'de>,
8942 {
8943 deserializer.deserialize_any(
8944 wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8945 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8946 ),
8947 )
8948 }
8949 }
8950
8951 /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8952 /// indicating if it can be used.
8953 ///
8954 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8955 ///
8956 /// # Working with unknown values
8957 ///
8958 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8959 /// additional enum variants at any time. Adding new variants is not considered
8960 /// a breaking change. Applications should write their code in anticipation of:
8961 ///
8962 /// - New values appearing in future releases of the client library, **and**
8963 /// - New values received dynamically, without application changes.
8964 ///
8965 /// Please consult the [Working with enums] section in the user guide for some
8966 /// guidelines.
8967 ///
8968 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8969 #[derive(Clone, Debug, PartialEq)]
8970 #[non_exhaustive]
8971 pub enum CryptoKeyVersionState {
8972 /// Not specified.
8973 Unspecified,
8974 /// This version is still being generated. It may not be used, enabled,
8975 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8976 /// version
8977 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8978 /// as soon as the version is ready.
8979 ///
8980 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8981 PendingGeneration,
8982 /// This version may be used for cryptographic operations.
8983 Enabled,
8984 /// This version may not be used, but the key material is still available,
8985 /// and the version can be placed back into the
8986 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8987 /// state.
8988 ///
8989 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8990 Disabled,
8991 /// The key material of this version is destroyed and no longer stored.
8992 /// This version may only become
8993 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8994 /// again if this version is
8995 /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8996 /// and the original key material is reimported with a call to
8997 /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8998 ///
8999 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
9000 /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
9001 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9002 Destroyed,
9003 /// This version is scheduled for destruction, and will be destroyed soon.
9004 /// Call
9005 /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
9006 /// to put it back into the
9007 /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
9008 /// state.
9009 ///
9010 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
9011 /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
9012 DestroyScheduled,
9013 /// This version is still being imported. It may not be used, enabled,
9014 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
9015 /// version
9016 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
9017 /// as soon as the version is ready.
9018 ///
9019 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
9020 PendingImport,
9021 /// This version was not imported successfully. It may not be used, enabled,
9022 /// disabled, or destroyed. The submitted key material has been discarded.
9023 /// Additional details can be found in
9024 /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
9025 ///
9026 /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
9027 ImportFailed,
9028 /// This version was not generated successfully. It may not be used, enabled,
9029 /// disabled, or destroyed. Additional details can be found in
9030 /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
9031 ///
9032 /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
9033 GenerationFailed,
9034 /// This version was destroyed, and it may not be used or enabled again.
9035 /// Cloud KMS is waiting for the corresponding key material residing in an
9036 /// external key manager to be destroyed.
9037 PendingExternalDestruction,
9038 /// This version was destroyed, and it may not be used or enabled again.
9039 /// However, Cloud KMS could not confirm that the corresponding key material
9040 /// residing in an external key manager was destroyed. Additional details can
9041 /// be found in
9042 /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
9043 ///
9044 /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
9045 ExternalDestructionFailed,
9046 /// If set, the enum was initialized with an unknown value.
9047 ///
9048 /// Applications can examine the value using [CryptoKeyVersionState::value] or
9049 /// [CryptoKeyVersionState::name].
9050 UnknownValue(crypto_key_version_state::UnknownValue),
9051 }
9052
9053 #[doc(hidden)]
9054 pub mod crypto_key_version_state {
9055 #[allow(unused_imports)]
9056 use super::*;
9057 #[derive(Clone, Debug, PartialEq)]
9058 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9059 }
9060
9061 impl CryptoKeyVersionState {
9062 /// Gets the enum value.
9063 ///
9064 /// Returns `None` if the enum contains an unknown value deserialized from
9065 /// the string representation of enums.
9066 pub fn value(&self) -> std::option::Option<i32> {
9067 match self {
9068 Self::Unspecified => std::option::Option::Some(0),
9069 Self::PendingGeneration => std::option::Option::Some(5),
9070 Self::Enabled => std::option::Option::Some(1),
9071 Self::Disabled => std::option::Option::Some(2),
9072 Self::Destroyed => std::option::Option::Some(3),
9073 Self::DestroyScheduled => std::option::Option::Some(4),
9074 Self::PendingImport => std::option::Option::Some(6),
9075 Self::ImportFailed => std::option::Option::Some(7),
9076 Self::GenerationFailed => std::option::Option::Some(8),
9077 Self::PendingExternalDestruction => std::option::Option::Some(9),
9078 Self::ExternalDestructionFailed => std::option::Option::Some(10),
9079 Self::UnknownValue(u) => u.0.value(),
9080 }
9081 }
9082
9083 /// Gets the enum value as a string.
9084 ///
9085 /// Returns `None` if the enum contains an unknown value deserialized from
9086 /// the integer representation of enums.
9087 pub fn name(&self) -> std::option::Option<&str> {
9088 match self {
9089 Self::Unspecified => {
9090 std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
9091 }
9092 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
9093 Self::Enabled => std::option::Option::Some("ENABLED"),
9094 Self::Disabled => std::option::Option::Some("DISABLED"),
9095 Self::Destroyed => std::option::Option::Some("DESTROYED"),
9096 Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
9097 Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
9098 Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
9099 Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
9100 Self::PendingExternalDestruction => {
9101 std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
9102 }
9103 Self::ExternalDestructionFailed => {
9104 std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
9105 }
9106 Self::UnknownValue(u) => u.0.name(),
9107 }
9108 }
9109 }
9110
9111 impl std::default::Default for CryptoKeyVersionState {
9112 fn default() -> Self {
9113 use std::convert::From;
9114 Self::from(0)
9115 }
9116 }
9117
9118 impl std::fmt::Display for CryptoKeyVersionState {
9119 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9120 wkt::internal::display_enum(f, self.name(), self.value())
9121 }
9122 }
9123
9124 impl std::convert::From<i32> for CryptoKeyVersionState {
9125 fn from(value: i32) -> Self {
9126 match value {
9127 0 => Self::Unspecified,
9128 1 => Self::Enabled,
9129 2 => Self::Disabled,
9130 3 => Self::Destroyed,
9131 4 => Self::DestroyScheduled,
9132 5 => Self::PendingGeneration,
9133 6 => Self::PendingImport,
9134 7 => Self::ImportFailed,
9135 8 => Self::GenerationFailed,
9136 9 => Self::PendingExternalDestruction,
9137 10 => Self::ExternalDestructionFailed,
9138 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
9139 wkt::internal::UnknownEnumValue::Integer(value),
9140 )),
9141 }
9142 }
9143 }
9144
9145 impl std::convert::From<&str> for CryptoKeyVersionState {
9146 fn from(value: &str) -> Self {
9147 use std::string::ToString;
9148 match value {
9149 "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
9150 "PENDING_GENERATION" => Self::PendingGeneration,
9151 "ENABLED" => Self::Enabled,
9152 "DISABLED" => Self::Disabled,
9153 "DESTROYED" => Self::Destroyed,
9154 "DESTROY_SCHEDULED" => Self::DestroyScheduled,
9155 "PENDING_IMPORT" => Self::PendingImport,
9156 "IMPORT_FAILED" => Self::ImportFailed,
9157 "GENERATION_FAILED" => Self::GenerationFailed,
9158 "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
9159 "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
9160 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
9161 wkt::internal::UnknownEnumValue::String(value.to_string()),
9162 )),
9163 }
9164 }
9165 }
9166
9167 impl serde::ser::Serialize for CryptoKeyVersionState {
9168 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9169 where
9170 S: serde::Serializer,
9171 {
9172 match self {
9173 Self::Unspecified => serializer.serialize_i32(0),
9174 Self::PendingGeneration => serializer.serialize_i32(5),
9175 Self::Enabled => serializer.serialize_i32(1),
9176 Self::Disabled => serializer.serialize_i32(2),
9177 Self::Destroyed => serializer.serialize_i32(3),
9178 Self::DestroyScheduled => serializer.serialize_i32(4),
9179 Self::PendingImport => serializer.serialize_i32(6),
9180 Self::ImportFailed => serializer.serialize_i32(7),
9181 Self::GenerationFailed => serializer.serialize_i32(8),
9182 Self::PendingExternalDestruction => serializer.serialize_i32(9),
9183 Self::ExternalDestructionFailed => serializer.serialize_i32(10),
9184 Self::UnknownValue(u) => u.0.serialize(serializer),
9185 }
9186 }
9187 }
9188
9189 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
9190 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9191 where
9192 D: serde::Deserializer<'de>,
9193 {
9194 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
9195 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
9196 ))
9197 }
9198 }
9199
9200 /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
9201 /// Controls the level of detail returned for
9202 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
9203 /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
9204 /// and
9205 /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
9206 ///
9207 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9208 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
9209 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
9210 ///
9211 /// # Working with unknown values
9212 ///
9213 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9214 /// additional enum variants at any time. Adding new variants is not considered
9215 /// a breaking change. Applications should write their code in anticipation of:
9216 ///
9217 /// - New values appearing in future releases of the client library, **and**
9218 /// - New values received dynamically, without application changes.
9219 ///
9220 /// Please consult the [Working with enums] section in the user guide for some
9221 /// guidelines.
9222 ///
9223 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9224 #[derive(Clone, Debug, PartialEq)]
9225 #[non_exhaustive]
9226 pub enum CryptoKeyVersionView {
9227 /// Default view for each
9228 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
9229 /// include the
9230 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
9231 ///
9232 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9233 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
9234 Unspecified,
9235 /// Provides all fields in each
9236 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
9237 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
9238 ///
9239 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9240 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
9241 Full,
9242 /// If set, the enum was initialized with an unknown value.
9243 ///
9244 /// Applications can examine the value using [CryptoKeyVersionView::value] or
9245 /// [CryptoKeyVersionView::name].
9246 UnknownValue(crypto_key_version_view::UnknownValue),
9247 }
9248
9249 #[doc(hidden)]
9250 pub mod crypto_key_version_view {
9251 #[allow(unused_imports)]
9252 use super::*;
9253 #[derive(Clone, Debug, PartialEq)]
9254 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9255 }
9256
9257 impl CryptoKeyVersionView {
9258 /// Gets the enum value.
9259 ///
9260 /// Returns `None` if the enum contains an unknown value deserialized from
9261 /// the string representation of enums.
9262 pub fn value(&self) -> std::option::Option<i32> {
9263 match self {
9264 Self::Unspecified => std::option::Option::Some(0),
9265 Self::Full => std::option::Option::Some(1),
9266 Self::UnknownValue(u) => u.0.value(),
9267 }
9268 }
9269
9270 /// Gets the enum value as a string.
9271 ///
9272 /// Returns `None` if the enum contains an unknown value deserialized from
9273 /// the integer representation of enums.
9274 pub fn name(&self) -> std::option::Option<&str> {
9275 match self {
9276 Self::Unspecified => {
9277 std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
9278 }
9279 Self::Full => std::option::Option::Some("FULL"),
9280 Self::UnknownValue(u) => u.0.name(),
9281 }
9282 }
9283 }
9284
9285 impl std::default::Default for CryptoKeyVersionView {
9286 fn default() -> Self {
9287 use std::convert::From;
9288 Self::from(0)
9289 }
9290 }
9291
9292 impl std::fmt::Display for CryptoKeyVersionView {
9293 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9294 wkt::internal::display_enum(f, self.name(), self.value())
9295 }
9296 }
9297
9298 impl std::convert::From<i32> for CryptoKeyVersionView {
9299 fn from(value: i32) -> Self {
9300 match value {
9301 0 => Self::Unspecified,
9302 1 => Self::Full,
9303 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9304 wkt::internal::UnknownEnumValue::Integer(value),
9305 )),
9306 }
9307 }
9308 }
9309
9310 impl std::convert::From<&str> for CryptoKeyVersionView {
9311 fn from(value: &str) -> Self {
9312 use std::string::ToString;
9313 match value {
9314 "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
9315 "FULL" => Self::Full,
9316 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9317 wkt::internal::UnknownEnumValue::String(value.to_string()),
9318 )),
9319 }
9320 }
9321 }
9322
9323 impl serde::ser::Serialize for CryptoKeyVersionView {
9324 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9325 where
9326 S: serde::Serializer,
9327 {
9328 match self {
9329 Self::Unspecified => serializer.serialize_i32(0),
9330 Self::Full => serializer.serialize_i32(1),
9331 Self::UnknownValue(u) => u.0.serialize(serializer),
9332 }
9333 }
9334 }
9335
9336 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
9337 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9338 where
9339 D: serde::Deserializer<'de>,
9340 {
9341 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
9342 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
9343 ))
9344 }
9345 }
9346}
9347
9348/// Data with integrity verification field.
9349#[derive(Clone, Default, PartialEq)]
9350#[non_exhaustive]
9351pub struct ChecksummedData {
9352 /// Raw Data.
9353 pub data: ::bytes::Bytes,
9354
9355 /// Integrity verification field. A CRC32C
9356 /// checksum of the returned
9357 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
9358 /// integrity check of
9359 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
9360 /// performed by computing the CRC32C checksum of
9361 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
9362 /// comparing your results to this field. Discard the response in case of
9363 /// non-matching checksum values, and perform a limited number of retries. A
9364 /// persistent mismatch may indicate an issue in your computation of the CRC32C
9365 /// checksum. Note: This field is defined as int64 for reasons of compatibility
9366 /// across different languages. However, it is a non-negative integer, which
9367 /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
9368 /// languages that support this type.
9369 ///
9370 /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
9371 pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
9372
9373 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9374}
9375
9376impl ChecksummedData {
9377 /// Creates a new default instance.
9378 pub fn new() -> Self {
9379 std::default::Default::default()
9380 }
9381
9382 /// Sets the value of [data][crate::model::ChecksummedData::data].
9383 ///
9384 /// # Example
9385 /// ```ignore,no_run
9386 /// # use google_cloud_kms_v1::model::ChecksummedData;
9387 /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
9388 /// ```
9389 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9390 self.data = v.into();
9391 self
9392 }
9393
9394 /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9395 ///
9396 /// # Example
9397 /// ```ignore,no_run
9398 /// # use google_cloud_kms_v1::model::ChecksummedData;
9399 /// use wkt::Int64Value;
9400 /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
9401 /// ```
9402 pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
9403 where
9404 T: std::convert::Into<wkt::Int64Value>,
9405 {
9406 self.crc32c_checksum = std::option::Option::Some(v.into());
9407 self
9408 }
9409
9410 /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9411 ///
9412 /// # Example
9413 /// ```ignore,no_run
9414 /// # use google_cloud_kms_v1::model::ChecksummedData;
9415 /// use wkt::Int64Value;
9416 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
9417 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
9418 /// ```
9419 pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
9420 where
9421 T: std::convert::Into<wkt::Int64Value>,
9422 {
9423 self.crc32c_checksum = v.map(|x| x.into());
9424 self
9425 }
9426}
9427
9428impl wkt::message::Message for ChecksummedData {
9429 fn typename() -> &'static str {
9430 "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
9431 }
9432}
9433
9434/// The public keys for a given
9435/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
9436/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
9437///
9438/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9439/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
9440#[derive(Clone, Default, PartialEq)]
9441#[non_exhaustive]
9442pub struct PublicKey {
9443 /// The public key, encoded in PEM format. For more information, see the
9444 /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
9445 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9446 /// [Textual Encoding of Subject Public Key Info]
9447 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9448 pub pem: std::string::String,
9449
9450 /// The
9451 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
9452 /// associated with this key.
9453 ///
9454 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
9455 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
9456
9457 /// Integrity verification field. A CRC32C checksum of the returned
9458 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
9459 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
9460 /// computing the CRC32C checksum of
9461 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
9462 /// results to this field. Discard the response in case of non-matching
9463 /// checksum values, and perform a limited number of retries. A persistent
9464 /// mismatch may indicate an issue in your computation of the CRC32C checksum.
9465 /// Note: This field is defined as int64 for reasons of compatibility across
9466 /// different languages. However, it is a non-negative integer, which will
9467 /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
9468 /// languages that support this type.
9469 ///
9470 /// NOTE: This field is in Beta.
9471 ///
9472 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9473 pub pem_crc32c: std::option::Option<wkt::Int64Value>,
9474
9475 /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
9476 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9477 /// Provided here for verification.
9478 ///
9479 /// NOTE: This field is in Beta.
9480 ///
9481 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9482 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
9483 pub name: std::string::String,
9484
9485 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9486 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9487 ///
9488 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9489 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9490 pub protection_level: crate::model::ProtectionLevel,
9491
9492 /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
9493 /// customer through the
9494 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9495 /// field.
9496 ///
9497 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9498 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9499 pub public_key_format: crate::model::public_key::PublicKeyFormat,
9500
9501 /// This field contains the public key (with integrity verification), formatted
9502 /// according to the
9503 /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
9504 ///
9505 /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
9506 pub public_key: std::option::Option<crate::model::ChecksummedData>,
9507
9508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9509}
9510
9511impl PublicKey {
9512 /// Creates a new default instance.
9513 pub fn new() -> Self {
9514 std::default::Default::default()
9515 }
9516
9517 /// Sets the value of [pem][crate::model::PublicKey::pem].
9518 ///
9519 /// # Example
9520 /// ```ignore,no_run
9521 /// # use google_cloud_kms_v1::model::PublicKey;
9522 /// let x = PublicKey::new().set_pem("example");
9523 /// ```
9524 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9525 self.pem = v.into();
9526 self
9527 }
9528
9529 /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
9530 ///
9531 /// # Example
9532 /// ```ignore,no_run
9533 /// # use google_cloud_kms_v1::model::PublicKey;
9534 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
9535 /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
9536 /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
9537 /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
9538 /// ```
9539 pub fn set_algorithm<
9540 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
9541 >(
9542 mut self,
9543 v: T,
9544 ) -> Self {
9545 self.algorithm = v.into();
9546 self
9547 }
9548
9549 /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9550 ///
9551 /// # Example
9552 /// ```ignore,no_run
9553 /// # use google_cloud_kms_v1::model::PublicKey;
9554 /// use wkt::Int64Value;
9555 /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
9556 /// ```
9557 pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
9558 where
9559 T: std::convert::Into<wkt::Int64Value>,
9560 {
9561 self.pem_crc32c = std::option::Option::Some(v.into());
9562 self
9563 }
9564
9565 /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9566 ///
9567 /// # Example
9568 /// ```ignore,no_run
9569 /// # use google_cloud_kms_v1::model::PublicKey;
9570 /// use wkt::Int64Value;
9571 /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
9572 /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
9573 /// ```
9574 pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9575 where
9576 T: std::convert::Into<wkt::Int64Value>,
9577 {
9578 self.pem_crc32c = v.map(|x| x.into());
9579 self
9580 }
9581
9582 /// Sets the value of [name][crate::model::PublicKey::name].
9583 ///
9584 /// # Example
9585 /// ```ignore,no_run
9586 /// # use google_cloud_kms_v1::model::PublicKey;
9587 /// # let project_id = "project_id";
9588 /// # let location_id = "location_id";
9589 /// # let key_ring_id = "key_ring_id";
9590 /// # let crypto_key_id = "crypto_key_id";
9591 /// # let crypto_key_version_id = "crypto_key_version_id";
9592 /// let x = PublicKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}/publicKey"));
9593 /// ```
9594 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9595 self.name = v.into();
9596 self
9597 }
9598
9599 /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
9600 ///
9601 /// # Example
9602 /// ```ignore,no_run
9603 /// # use google_cloud_kms_v1::model::PublicKey;
9604 /// use google_cloud_kms_v1::model::ProtectionLevel;
9605 /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
9606 /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
9607 /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
9608 /// ```
9609 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9610 mut self,
9611 v: T,
9612 ) -> Self {
9613 self.protection_level = v.into();
9614 self
9615 }
9616
9617 /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
9618 ///
9619 /// # Example
9620 /// ```ignore,no_run
9621 /// # use google_cloud_kms_v1::model::PublicKey;
9622 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9623 /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9624 /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9625 /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9626 /// ```
9627 pub fn set_public_key_format<
9628 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9629 >(
9630 mut self,
9631 v: T,
9632 ) -> Self {
9633 self.public_key_format = v.into();
9634 self
9635 }
9636
9637 /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9638 ///
9639 /// # Example
9640 /// ```ignore,no_run
9641 /// # use google_cloud_kms_v1::model::PublicKey;
9642 /// use google_cloud_kms_v1::model::ChecksummedData;
9643 /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9644 /// ```
9645 pub fn set_public_key<T>(mut self, v: T) -> Self
9646 where
9647 T: std::convert::Into<crate::model::ChecksummedData>,
9648 {
9649 self.public_key = std::option::Option::Some(v.into());
9650 self
9651 }
9652
9653 /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9654 ///
9655 /// # Example
9656 /// ```ignore,no_run
9657 /// # use google_cloud_kms_v1::model::PublicKey;
9658 /// use google_cloud_kms_v1::model::ChecksummedData;
9659 /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9660 /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9661 /// ```
9662 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9663 where
9664 T: std::convert::Into<crate::model::ChecksummedData>,
9665 {
9666 self.public_key = v.map(|x| x.into());
9667 self
9668 }
9669}
9670
9671impl wkt::message::Message for PublicKey {
9672 fn typename() -> &'static str {
9673 "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9674 }
9675}
9676
9677/// Defines additional types related to [PublicKey].
9678pub mod public_key {
9679 #[allow(unused_imports)]
9680 use super::*;
9681
9682 /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9683 ///
9684 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9685 ///
9686 /// # Working with unknown values
9687 ///
9688 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9689 /// additional enum variants at any time. Adding new variants is not considered
9690 /// a breaking change. Applications should write their code in anticipation of:
9691 ///
9692 /// - New values appearing in future releases of the client library, **and**
9693 /// - New values received dynamically, without application changes.
9694 ///
9695 /// Please consult the [Working with enums] section in the user guide for some
9696 /// guidelines.
9697 ///
9698 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9699 #[derive(Clone, Debug, PartialEq)]
9700 #[non_exhaustive]
9701 pub enum PublicKeyFormat {
9702 /// If the
9703 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9704 /// field is not specified:
9705 ///
9706 /// - For PQC algorithms, an error will be returned.
9707 /// - For non-PQC algorithms, the default format is PEM, and the field
9708 /// [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9709 ///
9710 /// Otherwise, the public key will be exported through the
9711 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9712 /// requested format.
9713 ///
9714 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9715 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9716 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9717 Unspecified,
9718 /// The returned public key will be encoded in PEM format.
9719 /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9720 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9721 /// and [Textual Encoding of Subject Public Key Info]
9722 /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9723 Pem,
9724 /// The returned public key will be encoded in DER format (the
9725 /// PrivateKeyInfo structure from RFC 5208).
9726 Der,
9727 /// This is supported only for PQC algorithms.
9728 /// The key material is returned in the format defined by NIST PQC
9729 /// standards (FIPS 203, FIPS 204, and FIPS 205).
9730 NistPqc,
9731 /// The returned public key is in raw bytes format defined in its standard
9732 /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9733 XwingRawBytes,
9734 /// If set, the enum was initialized with an unknown value.
9735 ///
9736 /// Applications can examine the value using [PublicKeyFormat::value] or
9737 /// [PublicKeyFormat::name].
9738 UnknownValue(public_key_format::UnknownValue),
9739 }
9740
9741 #[doc(hidden)]
9742 pub mod public_key_format {
9743 #[allow(unused_imports)]
9744 use super::*;
9745 #[derive(Clone, Debug, PartialEq)]
9746 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9747 }
9748
9749 impl PublicKeyFormat {
9750 /// Gets the enum value.
9751 ///
9752 /// Returns `None` if the enum contains an unknown value deserialized from
9753 /// the string representation of enums.
9754 pub fn value(&self) -> std::option::Option<i32> {
9755 match self {
9756 Self::Unspecified => std::option::Option::Some(0),
9757 Self::Pem => std::option::Option::Some(1),
9758 Self::Der => std::option::Option::Some(2),
9759 Self::NistPqc => std::option::Option::Some(3),
9760 Self::XwingRawBytes => std::option::Option::Some(4),
9761 Self::UnknownValue(u) => u.0.value(),
9762 }
9763 }
9764
9765 /// Gets the enum value as a string.
9766 ///
9767 /// Returns `None` if the enum contains an unknown value deserialized from
9768 /// the integer representation of enums.
9769 pub fn name(&self) -> std::option::Option<&str> {
9770 match self {
9771 Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9772 Self::Pem => std::option::Option::Some("PEM"),
9773 Self::Der => std::option::Option::Some("DER"),
9774 Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9775 Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9776 Self::UnknownValue(u) => u.0.name(),
9777 }
9778 }
9779 }
9780
9781 impl std::default::Default for PublicKeyFormat {
9782 fn default() -> Self {
9783 use std::convert::From;
9784 Self::from(0)
9785 }
9786 }
9787
9788 impl std::fmt::Display for PublicKeyFormat {
9789 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9790 wkt::internal::display_enum(f, self.name(), self.value())
9791 }
9792 }
9793
9794 impl std::convert::From<i32> for PublicKeyFormat {
9795 fn from(value: i32) -> Self {
9796 match value {
9797 0 => Self::Unspecified,
9798 1 => Self::Pem,
9799 2 => Self::Der,
9800 3 => Self::NistPqc,
9801 4 => Self::XwingRawBytes,
9802 _ => Self::UnknownValue(public_key_format::UnknownValue(
9803 wkt::internal::UnknownEnumValue::Integer(value),
9804 )),
9805 }
9806 }
9807 }
9808
9809 impl std::convert::From<&str> for PublicKeyFormat {
9810 fn from(value: &str) -> Self {
9811 use std::string::ToString;
9812 match value {
9813 "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9814 "PEM" => Self::Pem,
9815 "DER" => Self::Der,
9816 "NIST_PQC" => Self::NistPqc,
9817 "XWING_RAW_BYTES" => Self::XwingRawBytes,
9818 _ => Self::UnknownValue(public_key_format::UnknownValue(
9819 wkt::internal::UnknownEnumValue::String(value.to_string()),
9820 )),
9821 }
9822 }
9823 }
9824
9825 impl serde::ser::Serialize for PublicKeyFormat {
9826 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9827 where
9828 S: serde::Serializer,
9829 {
9830 match self {
9831 Self::Unspecified => serializer.serialize_i32(0),
9832 Self::Pem => serializer.serialize_i32(1),
9833 Self::Der => serializer.serialize_i32(2),
9834 Self::NistPqc => serializer.serialize_i32(3),
9835 Self::XwingRawBytes => serializer.serialize_i32(4),
9836 Self::UnknownValue(u) => u.0.serialize(serializer),
9837 }
9838 }
9839 }
9840
9841 impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9842 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9843 where
9844 D: serde::Deserializer<'de>,
9845 {
9846 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9847 ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9848 ))
9849 }
9850 }
9851}
9852
9853/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9854/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9855/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9856/// key material, generated outside of Cloud KMS.
9857///
9858/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9859/// generate a "wrapping key", which is a public/private key pair. You use the
9860/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9861/// protect it during the import process. The nature of the wrapping key depends
9862/// on the choice of
9863/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9864/// wrapping key generation is complete, the
9865/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9866/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9867/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9868/// fetched public key can then be used to wrap your pre-existing key material.
9869///
9870/// Once the key material is wrapped, it can be imported into a new
9871/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9872/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9873/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9874/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9875/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9876/// uses the private key portion of the wrapping key to unwrap the key material.
9877/// Only Cloud KMS has access to the private key.
9878///
9879/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9880/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9881/// any key material that was wrapped with the
9882/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9883///
9884/// For more information, see
9885/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9886///
9887/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9888/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9889/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9890/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9891/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9892/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9893/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9894/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9895#[derive(Clone, Default, PartialEq)]
9896#[non_exhaustive]
9897pub struct ImportJob {
9898 /// Output only. The resource name for this
9899 /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9900 /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9901 ///
9902 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9903 pub name: std::string::String,
9904
9905 /// Required. Immutable. The wrapping method to be used for incoming key
9906 /// material.
9907 pub import_method: crate::model::import_job::ImportMethod,
9908
9909 /// Required. Immutable. The protection level of the
9910 /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9911 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9912 /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9913 /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9914 /// into.
9915 ///
9916 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9917 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9918 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9919 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9920 pub protection_level: crate::model::ProtectionLevel,
9921
9922 /// Output only. The time at which this
9923 /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9924 ///
9925 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9926 pub create_time: std::option::Option<wkt::Timestamp>,
9927
9928 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9929 /// material was generated.
9930 ///
9931 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9932 pub generate_time: std::option::Option<wkt::Timestamp>,
9933
9934 /// Output only. The time at which this
9935 /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9936 /// can no longer be used to import key material.
9937 ///
9938 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9939 pub expire_time: std::option::Option<wkt::Timestamp>,
9940
9941 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9942 /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9943 /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9944 ///
9945 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9946 /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9947 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9948 pub expire_event_time: std::option::Option<wkt::Timestamp>,
9949
9950 /// Output only. The current state of the
9951 /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9952 ///
9953 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9954 pub state: crate::model::import_job::ImportJobState,
9955
9956 /// Output only. The public key with which to wrap key material prior to
9957 /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9958 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9959 ///
9960 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9961 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9962 pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9963
9964 /// Output only. Specifies the
9965 /// [WrappingPublicKey][google.cloud.kms.v1.ImportJob.WrappingPublicKey] format
9966 /// provided by the customer in the
9967 /// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]
9968 /// request.
9969 ///
9970 /// [google.cloud.kms.v1.ImportJob.WrappingPublicKey]: crate::model::import_job::WrappingPublicKey
9971 /// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
9972 pub public_key_format: crate::model::public_key::PublicKeyFormat,
9973
9974 /// Output only. Statement that was generated and signed by the key creator
9975 /// (for example, an HSM) at key creation time. Use this statement to verify
9976 /// attributes of the key as stored on the HSM, independently of Google.
9977 /// Only present if the chosen
9978 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9979 /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9980 ///
9981 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9982 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9983 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9984
9985 /// Immutable. The resource name of the backend environment where the key
9986 /// material for the wrapping key resides and where all related cryptographic
9987 /// operations are performed. Currently, this field is only populated for keys
9988 /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9989 /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9990 /// in the future. Supported resources:
9991 ///
9992 /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9993 ///
9994 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9995 pub crypto_key_backend: std::string::String,
9996
9997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9998}
9999
10000impl ImportJob {
10001 /// Creates a new default instance.
10002 pub fn new() -> Self {
10003 std::default::Default::default()
10004 }
10005
10006 /// Sets the value of [name][crate::model::ImportJob::name].
10007 ///
10008 /// # Example
10009 /// ```ignore,no_run
10010 /// # use google_cloud_kms_v1::model::ImportJob;
10011 /// # let project_id = "project_id";
10012 /// # let location_id = "location_id";
10013 /// # let key_ring_id = "key_ring_id";
10014 /// # let import_job_id = "import_job_id";
10015 /// let x = ImportJob::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/importJobs/{import_job_id}"));
10016 /// ```
10017 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10018 self.name = v.into();
10019 self
10020 }
10021
10022 /// Sets the value of [import_method][crate::model::ImportJob::import_method].
10023 ///
10024 /// # Example
10025 /// ```ignore,no_run
10026 /// # use google_cloud_kms_v1::model::ImportJob;
10027 /// use google_cloud_kms_v1::model::import_job::ImportMethod;
10028 /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
10029 /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
10030 /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
10031 /// ```
10032 pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
10033 mut self,
10034 v: T,
10035 ) -> Self {
10036 self.import_method = v.into();
10037 self
10038 }
10039
10040 /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
10041 ///
10042 /// # Example
10043 /// ```ignore,no_run
10044 /// # use google_cloud_kms_v1::model::ImportJob;
10045 /// use google_cloud_kms_v1::model::ProtectionLevel;
10046 /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
10047 /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
10048 /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
10049 /// ```
10050 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
10051 mut self,
10052 v: T,
10053 ) -> Self {
10054 self.protection_level = v.into();
10055 self
10056 }
10057
10058 /// Sets the value of [create_time][crate::model::ImportJob::create_time].
10059 ///
10060 /// # Example
10061 /// ```ignore,no_run
10062 /// # use google_cloud_kms_v1::model::ImportJob;
10063 /// use wkt::Timestamp;
10064 /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
10065 /// ```
10066 pub fn set_create_time<T>(mut self, v: T) -> Self
10067 where
10068 T: std::convert::Into<wkt::Timestamp>,
10069 {
10070 self.create_time = std::option::Option::Some(v.into());
10071 self
10072 }
10073
10074 /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
10075 ///
10076 /// # Example
10077 /// ```ignore,no_run
10078 /// # use google_cloud_kms_v1::model::ImportJob;
10079 /// use wkt::Timestamp;
10080 /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10081 /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
10082 /// ```
10083 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10084 where
10085 T: std::convert::Into<wkt::Timestamp>,
10086 {
10087 self.create_time = v.map(|x| x.into());
10088 self
10089 }
10090
10091 /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
10092 ///
10093 /// # Example
10094 /// ```ignore,no_run
10095 /// # use google_cloud_kms_v1::model::ImportJob;
10096 /// use wkt::Timestamp;
10097 /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
10098 /// ```
10099 pub fn set_generate_time<T>(mut self, v: T) -> Self
10100 where
10101 T: std::convert::Into<wkt::Timestamp>,
10102 {
10103 self.generate_time = std::option::Option::Some(v.into());
10104 self
10105 }
10106
10107 /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
10108 ///
10109 /// # Example
10110 /// ```ignore,no_run
10111 /// # use google_cloud_kms_v1::model::ImportJob;
10112 /// use wkt::Timestamp;
10113 /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
10114 /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
10115 /// ```
10116 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
10117 where
10118 T: std::convert::Into<wkt::Timestamp>,
10119 {
10120 self.generate_time = v.map(|x| x.into());
10121 self
10122 }
10123
10124 /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
10125 ///
10126 /// # Example
10127 /// ```ignore,no_run
10128 /// # use google_cloud_kms_v1::model::ImportJob;
10129 /// use wkt::Timestamp;
10130 /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
10131 /// ```
10132 pub fn set_expire_time<T>(mut self, v: T) -> Self
10133 where
10134 T: std::convert::Into<wkt::Timestamp>,
10135 {
10136 self.expire_time = std::option::Option::Some(v.into());
10137 self
10138 }
10139
10140 /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
10141 ///
10142 /// # Example
10143 /// ```ignore,no_run
10144 /// # use google_cloud_kms_v1::model::ImportJob;
10145 /// use wkt::Timestamp;
10146 /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
10147 /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
10148 /// ```
10149 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
10150 where
10151 T: std::convert::Into<wkt::Timestamp>,
10152 {
10153 self.expire_time = v.map(|x| x.into());
10154 self
10155 }
10156
10157 /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
10158 ///
10159 /// # Example
10160 /// ```ignore,no_run
10161 /// # use google_cloud_kms_v1::model::ImportJob;
10162 /// use wkt::Timestamp;
10163 /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
10164 /// ```
10165 pub fn set_expire_event_time<T>(mut self, v: T) -> Self
10166 where
10167 T: std::convert::Into<wkt::Timestamp>,
10168 {
10169 self.expire_event_time = std::option::Option::Some(v.into());
10170 self
10171 }
10172
10173 /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
10174 ///
10175 /// # Example
10176 /// ```ignore,no_run
10177 /// # use google_cloud_kms_v1::model::ImportJob;
10178 /// use wkt::Timestamp;
10179 /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
10180 /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
10181 /// ```
10182 pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
10183 where
10184 T: std::convert::Into<wkt::Timestamp>,
10185 {
10186 self.expire_event_time = v.map(|x| x.into());
10187 self
10188 }
10189
10190 /// Sets the value of [state][crate::model::ImportJob::state].
10191 ///
10192 /// # Example
10193 /// ```ignore,no_run
10194 /// # use google_cloud_kms_v1::model::ImportJob;
10195 /// use google_cloud_kms_v1::model::import_job::ImportJobState;
10196 /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
10197 /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
10198 /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
10199 /// ```
10200 pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
10201 mut self,
10202 v: T,
10203 ) -> Self {
10204 self.state = v.into();
10205 self
10206 }
10207
10208 /// Sets the value of [public_key][crate::model::ImportJob::public_key].
10209 ///
10210 /// # Example
10211 /// ```ignore,no_run
10212 /// # use google_cloud_kms_v1::model::ImportJob;
10213 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10214 /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
10215 /// ```
10216 pub fn set_public_key<T>(mut self, v: T) -> Self
10217 where
10218 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
10219 {
10220 self.public_key = std::option::Option::Some(v.into());
10221 self
10222 }
10223
10224 /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
10225 ///
10226 /// # Example
10227 /// ```ignore,no_run
10228 /// # use google_cloud_kms_v1::model::ImportJob;
10229 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10230 /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
10231 /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
10232 /// ```
10233 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
10234 where
10235 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
10236 {
10237 self.public_key = v.map(|x| x.into());
10238 self
10239 }
10240
10241 /// Sets the value of [public_key_format][crate::model::ImportJob::public_key_format].
10242 ///
10243 /// # Example
10244 /// ```ignore,no_run
10245 /// # use google_cloud_kms_v1::model::ImportJob;
10246 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
10247 /// let x0 = ImportJob::new().set_public_key_format(PublicKeyFormat::Pem);
10248 /// let x1 = ImportJob::new().set_public_key_format(PublicKeyFormat::Der);
10249 /// let x2 = ImportJob::new().set_public_key_format(PublicKeyFormat::NistPqc);
10250 /// ```
10251 pub fn set_public_key_format<
10252 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
10253 >(
10254 mut self,
10255 v: T,
10256 ) -> Self {
10257 self.public_key_format = v.into();
10258 self
10259 }
10260
10261 /// Sets the value of [attestation][crate::model::ImportJob::attestation].
10262 ///
10263 /// # Example
10264 /// ```ignore,no_run
10265 /// # use google_cloud_kms_v1::model::ImportJob;
10266 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
10267 /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
10268 /// ```
10269 pub fn set_attestation<T>(mut self, v: T) -> Self
10270 where
10271 T: std::convert::Into<crate::model::KeyOperationAttestation>,
10272 {
10273 self.attestation = std::option::Option::Some(v.into());
10274 self
10275 }
10276
10277 /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
10278 ///
10279 /// # Example
10280 /// ```ignore,no_run
10281 /// # use google_cloud_kms_v1::model::ImportJob;
10282 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
10283 /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
10284 /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
10285 /// ```
10286 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
10287 where
10288 T: std::convert::Into<crate::model::KeyOperationAttestation>,
10289 {
10290 self.attestation = v.map(|x| x.into());
10291 self
10292 }
10293
10294 /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
10295 ///
10296 /// # Example
10297 /// ```ignore,no_run
10298 /// # use google_cloud_kms_v1::model::ImportJob;
10299 /// let x = ImportJob::new().set_crypto_key_backend("example");
10300 /// ```
10301 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
10302 mut self,
10303 v: T,
10304 ) -> Self {
10305 self.crypto_key_backend = v.into();
10306 self
10307 }
10308}
10309
10310impl wkt::message::Message for ImportJob {
10311 fn typename() -> &'static str {
10312 "type.googleapis.com/google.cloud.kms.v1.ImportJob"
10313 }
10314}
10315
10316/// Defines additional types related to [ImportJob].
10317pub mod import_job {
10318 #[allow(unused_imports)]
10319 use super::*;
10320
10321 /// The public key component of the wrapping key. For details of the type of
10322 /// key this public key corresponds to, see the
10323 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
10324 ///
10325 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10326 #[derive(Clone, Default, PartialEq)]
10327 #[non_exhaustive]
10328 pub struct WrappingPublicKey {
10329 /// The public key, encoded in PEM format. For more information, see the [RFC
10330 /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
10331 /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
10332 /// [Textual Encoding of Subject Public Key Info]
10333 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
10334 /// This field gets populated by default for RSA-based import methods, if no
10335 /// public_key_format is specified in the request.
10336 /// If you want to retrieve the wrapping key of an
10337 /// [ImportJob][google.cloud.kms.v1.ImportJob] in some other format, use
10338 /// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]
10339 /// and set the public_key_format to the desired public key format.
10340 ///
10341 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10342 /// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
10343 pub pem: std::string::String,
10344
10345 /// Output only. Contains the public key, formatted according to the
10346 /// [PublicKey.PublicKeyFormat][google.cloud.kms.v1.PublicKey.PublicKeyFormat]
10347 /// specified in the
10348 /// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]
10349 /// request.
10350 ///
10351 /// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
10352 /// [google.cloud.kms.v1.PublicKey.PublicKeyFormat]: crate::model::public_key::PublicKeyFormat
10353 pub data: ::bytes::Bytes,
10354
10355 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10356 }
10357
10358 impl WrappingPublicKey {
10359 /// Creates a new default instance.
10360 pub fn new() -> Self {
10361 std::default::Default::default()
10362 }
10363
10364 /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
10365 ///
10366 /// # Example
10367 /// ```ignore,no_run
10368 /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10369 /// let x = WrappingPublicKey::new().set_pem("example");
10370 /// ```
10371 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10372 self.pem = v.into();
10373 self
10374 }
10375
10376 /// Sets the value of [data][crate::model::import_job::WrappingPublicKey::data].
10377 ///
10378 /// # Example
10379 /// ```ignore,no_run
10380 /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10381 /// let x = WrappingPublicKey::new().set_data(bytes::Bytes::from_static(b"example"));
10382 /// ```
10383 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
10384 self.data = v.into();
10385 self
10386 }
10387 }
10388
10389 impl wkt::message::Message for WrappingPublicKey {
10390 fn typename() -> &'static str {
10391 "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
10392 }
10393 }
10394
10395 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
10396 /// key wrapping method chosen for this
10397 /// [ImportJob][google.cloud.kms.v1.ImportJob].
10398 ///
10399 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10400 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10401 ///
10402 /// # Working with unknown values
10403 ///
10404 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10405 /// additional enum variants at any time. Adding new variants is not considered
10406 /// a breaking change. Applications should write their code in anticipation of:
10407 ///
10408 /// - New values appearing in future releases of the client library, **and**
10409 /// - New values received dynamically, without application changes.
10410 ///
10411 /// Please consult the [Working with enums] section in the user guide for some
10412 /// guidelines.
10413 ///
10414 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10415 #[derive(Clone, Debug, PartialEq)]
10416 #[non_exhaustive]
10417 pub enum ImportMethod {
10418 /// Not specified.
10419 Unspecified,
10420 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10421 /// scheme defined in the PKCS #11 standard. In summary, this involves
10422 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10423 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10424 /// [RSA AES key wrap
10425 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10426 RsaOaep3072Sha1Aes256,
10427 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10428 /// scheme defined in the PKCS #11 standard. In summary, this involves
10429 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10430 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10431 /// [RSA AES key wrap
10432 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10433 RsaOaep4096Sha1Aes256,
10434 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10435 /// scheme defined in the PKCS #11 standard. In summary, this involves
10436 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10437 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10438 /// [RSA AES key wrap
10439 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10440 RsaOaep3072Sha256Aes256,
10441 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10442 /// scheme defined in the PKCS #11 standard. In summary, this involves
10443 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10444 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10445 /// [RSA AES key wrap
10446 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10447 RsaOaep4096Sha256Aes256,
10448 /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
10449 /// key material to be imported is wrapped directly with the RSA key. Due
10450 /// to technical limitations of RSA wrapping, this method cannot be used to
10451 /// wrap RSA keys for import.
10452 RsaOaep3072Sha256,
10453 /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
10454 /// key material to be imported is wrapped directly with the RSA key. Due
10455 /// to technical limitations of RSA wrapping, this method cannot be used to
10456 /// wrap RSA keys for import.
10457 RsaOaep4096Sha256,
10458 /// Represents the Hybrid Public Key Encryption (HPKE) Scheme originally
10459 /// defined in [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180). It
10460 /// involves wrapping the raw key with an ephemeral AES key, derived with
10461 /// HKDF-SHA256 from an encryption context, that is, in turn obtained from
10462 /// the receiver’s public key with the help of the ML-KEM-768 KEM. For more
10463 /// details, see the [ML-KEM HPKE
10464 /// standard](http://datatracker.ietf.org/doc/draft-ietf-hpke-pq/01/).
10465 HpkeKemMlKem768HkdfSha256Aes256Gcm,
10466 /// Represents the Hybrid Public Key Encryption (HPKE) Scheme originally
10467 /// defined in [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180). It
10468 /// involves wrapping the raw key with an ephemeral AES key, derived with
10469 /// HKDF-SHA256 from an encryption context, that is, in turn obtained from
10470 /// the receiver’s public key with the help of the ML-KEM-1024 KEM. For more
10471 /// details, see the [ML-KEM HPKE
10472 /// standard](http://datatracker.ietf.org/doc/draft-ietf-hpke-pq/01/).
10473 HpkeKemMlKem1024HkdfSha256Aes256Gcm,
10474 /// Represents the Hybrid Public Key Encryption (HPKE) Scheme originally
10475 /// defined in [RFC 9180](https://www.rfc-editor.org/rfc/rfc9180). It
10476 /// involves wrapping the raw key with an ephemeral AES key, derived with
10477 /// HKDF-SHA256 from an encryption context, that is, in turn obtained from
10478 /// the receiver’s public key with the help of the X-Wing hybrid KEM. For
10479 /// more details, see the [X-Wing
10480 /// standard](http://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/09/).
10481 HpkeKemXwingHkdfSha256Aes256Gcm,
10482 /// If set, the enum was initialized with an unknown value.
10483 ///
10484 /// Applications can examine the value using [ImportMethod::value] or
10485 /// [ImportMethod::name].
10486 UnknownValue(import_method::UnknownValue),
10487 }
10488
10489 #[doc(hidden)]
10490 pub mod import_method {
10491 #[allow(unused_imports)]
10492 use super::*;
10493 #[derive(Clone, Debug, PartialEq)]
10494 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10495 }
10496
10497 impl ImportMethod {
10498 /// Gets the enum value.
10499 ///
10500 /// Returns `None` if the enum contains an unknown value deserialized from
10501 /// the string representation of enums.
10502 pub fn value(&self) -> std::option::Option<i32> {
10503 match self {
10504 Self::Unspecified => std::option::Option::Some(0),
10505 Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
10506 Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
10507 Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
10508 Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
10509 Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
10510 Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
10511 Self::HpkeKemMlKem768HkdfSha256Aes256Gcm => std::option::Option::Some(8),
10512 Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm => std::option::Option::Some(9),
10513 Self::HpkeKemXwingHkdfSha256Aes256Gcm => std::option::Option::Some(10),
10514 Self::UnknownValue(u) => u.0.value(),
10515 }
10516 }
10517
10518 /// Gets the enum value as a string.
10519 ///
10520 /// Returns `None` if the enum contains an unknown value deserialized from
10521 /// the integer representation of enums.
10522 pub fn name(&self) -> std::option::Option<&str> {
10523 match self {
10524 Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
10525 Self::RsaOaep3072Sha1Aes256 => {
10526 std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
10527 }
10528 Self::RsaOaep4096Sha1Aes256 => {
10529 std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
10530 }
10531 Self::RsaOaep3072Sha256Aes256 => {
10532 std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
10533 }
10534 Self::RsaOaep4096Sha256Aes256 => {
10535 std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
10536 }
10537 Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
10538 Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
10539 Self::HpkeKemMlKem768HkdfSha256Aes256Gcm => {
10540 std::option::Option::Some("HPKE_KEM_ML_KEM_768_HKDF_SHA256_AES_256_GCM")
10541 }
10542 Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm => {
10543 std::option::Option::Some("HPKE_KEM_ML_KEM_1024_HKDF_SHA256_AES_256_GCM")
10544 }
10545 Self::HpkeKemXwingHkdfSha256Aes256Gcm => {
10546 std::option::Option::Some("HPKE_KEM_XWING_HKDF_SHA256_AES_256_GCM")
10547 }
10548 Self::UnknownValue(u) => u.0.name(),
10549 }
10550 }
10551 }
10552
10553 impl std::default::Default for ImportMethod {
10554 fn default() -> Self {
10555 use std::convert::From;
10556 Self::from(0)
10557 }
10558 }
10559
10560 impl std::fmt::Display for ImportMethod {
10561 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10562 wkt::internal::display_enum(f, self.name(), self.value())
10563 }
10564 }
10565
10566 impl std::convert::From<i32> for ImportMethod {
10567 fn from(value: i32) -> Self {
10568 match value {
10569 0 => Self::Unspecified,
10570 1 => Self::RsaOaep3072Sha1Aes256,
10571 2 => Self::RsaOaep4096Sha1Aes256,
10572 3 => Self::RsaOaep3072Sha256Aes256,
10573 4 => Self::RsaOaep4096Sha256Aes256,
10574 5 => Self::RsaOaep3072Sha256,
10575 6 => Self::RsaOaep4096Sha256,
10576 8 => Self::HpkeKemMlKem768HkdfSha256Aes256Gcm,
10577 9 => Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm,
10578 10 => Self::HpkeKemXwingHkdfSha256Aes256Gcm,
10579 _ => Self::UnknownValue(import_method::UnknownValue(
10580 wkt::internal::UnknownEnumValue::Integer(value),
10581 )),
10582 }
10583 }
10584 }
10585
10586 impl std::convert::From<&str> for ImportMethod {
10587 fn from(value: &str) -> Self {
10588 use std::string::ToString;
10589 match value {
10590 "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
10591 "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
10592 "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
10593 "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
10594 "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
10595 "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
10596 "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
10597 "HPKE_KEM_ML_KEM_768_HKDF_SHA256_AES_256_GCM" => {
10598 Self::HpkeKemMlKem768HkdfSha256Aes256Gcm
10599 }
10600 "HPKE_KEM_ML_KEM_1024_HKDF_SHA256_AES_256_GCM" => {
10601 Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm
10602 }
10603 "HPKE_KEM_XWING_HKDF_SHA256_AES_256_GCM" => Self::HpkeKemXwingHkdfSha256Aes256Gcm,
10604 _ => Self::UnknownValue(import_method::UnknownValue(
10605 wkt::internal::UnknownEnumValue::String(value.to_string()),
10606 )),
10607 }
10608 }
10609 }
10610
10611 impl serde::ser::Serialize for ImportMethod {
10612 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10613 where
10614 S: serde::Serializer,
10615 {
10616 match self {
10617 Self::Unspecified => serializer.serialize_i32(0),
10618 Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
10619 Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
10620 Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
10621 Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
10622 Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
10623 Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
10624 Self::HpkeKemMlKem768HkdfSha256Aes256Gcm => serializer.serialize_i32(8),
10625 Self::HpkeKemMlKem1024HkdfSha256Aes256Gcm => serializer.serialize_i32(9),
10626 Self::HpkeKemXwingHkdfSha256Aes256Gcm => serializer.serialize_i32(10),
10627 Self::UnknownValue(u) => u.0.serialize(serializer),
10628 }
10629 }
10630 }
10631
10632 impl<'de> serde::de::Deserialize<'de> for ImportMethod {
10633 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10634 where
10635 D: serde::Deserializer<'de>,
10636 {
10637 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
10638 ".google.cloud.kms.v1.ImportJob.ImportMethod",
10639 ))
10640 }
10641 }
10642
10643 /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
10644 /// it can be used.
10645 ///
10646 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10647 ///
10648 /// # Working with unknown values
10649 ///
10650 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10651 /// additional enum variants at any time. Adding new variants is not considered
10652 /// a breaking change. Applications should write their code in anticipation of:
10653 ///
10654 /// - New values appearing in future releases of the client library, **and**
10655 /// - New values received dynamically, without application changes.
10656 ///
10657 /// Please consult the [Working with enums] section in the user guide for some
10658 /// guidelines.
10659 ///
10660 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10661 #[derive(Clone, Debug, PartialEq)]
10662 #[non_exhaustive]
10663 pub enum ImportJobState {
10664 /// Not specified.
10665 Unspecified,
10666 /// The wrapping key for this job is still being generated. It may not be
10667 /// used. Cloud KMS will automatically mark this job as
10668 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
10669 /// the wrapping key is generated.
10670 ///
10671 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
10672 PendingGeneration,
10673 /// This job may be used in
10674 /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
10675 /// and
10676 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
10677 /// requests.
10678 ///
10679 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
10680 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
10681 Active,
10682 /// This job can no longer be used and may not leave this state once entered.
10683 Expired,
10684 /// If set, the enum was initialized with an unknown value.
10685 ///
10686 /// Applications can examine the value using [ImportJobState::value] or
10687 /// [ImportJobState::name].
10688 UnknownValue(import_job_state::UnknownValue),
10689 }
10690
10691 #[doc(hidden)]
10692 pub mod import_job_state {
10693 #[allow(unused_imports)]
10694 use super::*;
10695 #[derive(Clone, Debug, PartialEq)]
10696 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10697 }
10698
10699 impl ImportJobState {
10700 /// Gets the enum value.
10701 ///
10702 /// Returns `None` if the enum contains an unknown value deserialized from
10703 /// the string representation of enums.
10704 pub fn value(&self) -> std::option::Option<i32> {
10705 match self {
10706 Self::Unspecified => std::option::Option::Some(0),
10707 Self::PendingGeneration => std::option::Option::Some(1),
10708 Self::Active => std::option::Option::Some(2),
10709 Self::Expired => std::option::Option::Some(3),
10710 Self::UnknownValue(u) => u.0.value(),
10711 }
10712 }
10713
10714 /// Gets the enum value as a string.
10715 ///
10716 /// Returns `None` if the enum contains an unknown value deserialized from
10717 /// the integer representation of enums.
10718 pub fn name(&self) -> std::option::Option<&str> {
10719 match self {
10720 Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
10721 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
10722 Self::Active => std::option::Option::Some("ACTIVE"),
10723 Self::Expired => std::option::Option::Some("EXPIRED"),
10724 Self::UnknownValue(u) => u.0.name(),
10725 }
10726 }
10727 }
10728
10729 impl std::default::Default for ImportJobState {
10730 fn default() -> Self {
10731 use std::convert::From;
10732 Self::from(0)
10733 }
10734 }
10735
10736 impl std::fmt::Display for ImportJobState {
10737 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10738 wkt::internal::display_enum(f, self.name(), self.value())
10739 }
10740 }
10741
10742 impl std::convert::From<i32> for ImportJobState {
10743 fn from(value: i32) -> Self {
10744 match value {
10745 0 => Self::Unspecified,
10746 1 => Self::PendingGeneration,
10747 2 => Self::Active,
10748 3 => Self::Expired,
10749 _ => Self::UnknownValue(import_job_state::UnknownValue(
10750 wkt::internal::UnknownEnumValue::Integer(value),
10751 )),
10752 }
10753 }
10754 }
10755
10756 impl std::convert::From<&str> for ImportJobState {
10757 fn from(value: &str) -> Self {
10758 use std::string::ToString;
10759 match value {
10760 "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10761 "PENDING_GENERATION" => Self::PendingGeneration,
10762 "ACTIVE" => Self::Active,
10763 "EXPIRED" => Self::Expired,
10764 _ => Self::UnknownValue(import_job_state::UnknownValue(
10765 wkt::internal::UnknownEnumValue::String(value.to_string()),
10766 )),
10767 }
10768 }
10769 }
10770
10771 impl serde::ser::Serialize for ImportJobState {
10772 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10773 where
10774 S: serde::Serializer,
10775 {
10776 match self {
10777 Self::Unspecified => serializer.serialize_i32(0),
10778 Self::PendingGeneration => serializer.serialize_i32(1),
10779 Self::Active => serializer.serialize_i32(2),
10780 Self::Expired => serializer.serialize_i32(3),
10781 Self::UnknownValue(u) => u.0.serialize(serializer),
10782 }
10783 }
10784 }
10785
10786 impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10787 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10788 where
10789 D: serde::Deserializer<'de>,
10790 {
10791 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10792 ".google.cloud.kms.v1.ImportJob.ImportJobState",
10793 ))
10794 }
10795 }
10796}
10797
10798/// ExternalProtectionLevelOptions stores a group of additional fields for
10799/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10800/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10801/// protection level and
10802/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10803/// levels.
10804///
10805/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10806/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10807/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10808#[derive(Clone, Default, PartialEq)]
10809#[non_exhaustive]
10810pub struct ExternalProtectionLevelOptions {
10811 /// The URI for an external resource that this
10812 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10813 ///
10814 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10815 pub external_key_uri: std::string::String,
10816
10817 /// The path to the external key material on the EKM when using
10818 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10819 /// this field instead of external_key_uri when using an
10820 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10821 ///
10822 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10823 pub ekm_connection_key_path: std::string::String,
10824
10825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10826}
10827
10828impl ExternalProtectionLevelOptions {
10829 /// Creates a new default instance.
10830 pub fn new() -> Self {
10831 std::default::Default::default()
10832 }
10833
10834 /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10835 ///
10836 /// # Example
10837 /// ```ignore,no_run
10838 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10839 /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10840 /// ```
10841 pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10842 mut self,
10843 v: T,
10844 ) -> Self {
10845 self.external_key_uri = v.into();
10846 self
10847 }
10848
10849 /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10850 ///
10851 /// # Example
10852 /// ```ignore,no_run
10853 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10854 /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10855 /// ```
10856 pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10857 mut self,
10858 v: T,
10859 ) -> Self {
10860 self.ekm_connection_key_path = v.into();
10861 self
10862 }
10863}
10864
10865impl wkt::message::Message for ExternalProtectionLevelOptions {
10866 fn typename() -> &'static str {
10867 "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10868 }
10869}
10870
10871/// A
10872/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10873/// specifies zero or more allowed
10874/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10875/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey] or
10876/// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig]
10877/// (the default Key Access Justifications policy).
10878///
10879/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10880/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10881/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10882#[derive(Clone, Default, PartialEq)]
10883#[non_exhaustive]
10884pub struct KeyAccessJustificationsPolicy {
10885 /// The list of allowed reasons for access to a
10886 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Note that empty
10887 /// allowed_access_reasons has a different meaning depending on where this
10888 /// message appears. If this is under
10889 /// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig],
10890 /// it means allow-all. If this is under
10891 /// [CryptoKey][google.cloud.kms.v1.CryptoKey], it means deny-all.
10892 ///
10893 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10894 pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10895
10896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10897}
10898
10899impl KeyAccessJustificationsPolicy {
10900 /// Creates a new default instance.
10901 pub fn new() -> Self {
10902 std::default::Default::default()
10903 }
10904
10905 /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10906 ///
10907 /// # Example
10908 /// ```ignore,no_run
10909 /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10910 /// use google_cloud_kms_v1::model::AccessReason;
10911 /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10912 /// AccessReason::CustomerInitiatedSupport,
10913 /// AccessReason::GoogleInitiatedService,
10914 /// AccessReason::ThirdPartyDataRequest,
10915 /// ]);
10916 /// ```
10917 pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10918 where
10919 T: std::iter::IntoIterator<Item = V>,
10920 V: std::convert::Into<crate::model::AccessReason>,
10921 {
10922 use std::iter::Iterator;
10923 self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10924 self
10925 }
10926}
10927
10928impl wkt::message::Message for KeyAccessJustificationsPolicy {
10929 fn typename() -> &'static str {
10930 "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10931 }
10932}
10933
10934/// A RetiredResource resource represents the record of a deleted
10935/// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Its purpose is to provide
10936/// visibility into retained user data and to prevent reuse of these names for
10937/// new [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10938///
10939/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10940#[derive(Clone, Default, PartialEq)]
10941#[non_exhaustive]
10942pub struct RetiredResource {
10943 /// Output only. Identifier. The resource name for this
10944 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] in the format
10945 /// `projects/*/locations/*/retiredResources/*`.
10946 ///
10947 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10948 pub name: std::string::String,
10949
10950 /// Output only. The full resource name of the original
10951 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] that was deleted in the format
10952 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10953 ///
10954 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10955 pub original_resource: std::string::String,
10956
10957 /// Output only. The resource type of the original deleted resource.
10958 pub resource_type: std::string::String,
10959
10960 /// Output only. The time at which the original resource was deleted and this
10961 /// RetiredResource record was created.
10962 pub delete_time: std::option::Option<wkt::Timestamp>,
10963
10964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10965}
10966
10967impl RetiredResource {
10968 /// Creates a new default instance.
10969 pub fn new() -> Self {
10970 std::default::Default::default()
10971 }
10972
10973 /// Sets the value of [name][crate::model::RetiredResource::name].
10974 ///
10975 /// # Example
10976 /// ```ignore,no_run
10977 /// # use google_cloud_kms_v1::model::RetiredResource;
10978 /// # let project_id = "project_id";
10979 /// # let location_id = "location_id";
10980 /// # let retired_resource_id = "retired_resource_id";
10981 /// let x = RetiredResource::new().set_name(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
10982 /// ```
10983 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10984 self.name = v.into();
10985 self
10986 }
10987
10988 /// Sets the value of [original_resource][crate::model::RetiredResource::original_resource].
10989 ///
10990 /// # Example
10991 /// ```ignore,no_run
10992 /// # use google_cloud_kms_v1::model::RetiredResource;
10993 /// let x = RetiredResource::new().set_original_resource("example");
10994 /// ```
10995 pub fn set_original_resource<T: std::convert::Into<std::string::String>>(
10996 mut self,
10997 v: T,
10998 ) -> Self {
10999 self.original_resource = v.into();
11000 self
11001 }
11002
11003 /// Sets the value of [resource_type][crate::model::RetiredResource::resource_type].
11004 ///
11005 /// # Example
11006 /// ```ignore,no_run
11007 /// # use google_cloud_kms_v1::model::RetiredResource;
11008 /// let x = RetiredResource::new().set_resource_type("example");
11009 /// ```
11010 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11011 self.resource_type = v.into();
11012 self
11013 }
11014
11015 /// Sets the value of [delete_time][crate::model::RetiredResource::delete_time].
11016 ///
11017 /// # Example
11018 /// ```ignore,no_run
11019 /// # use google_cloud_kms_v1::model::RetiredResource;
11020 /// use wkt::Timestamp;
11021 /// let x = RetiredResource::new().set_delete_time(Timestamp::default()/* use setters */);
11022 /// ```
11023 pub fn set_delete_time<T>(mut self, v: T) -> Self
11024 where
11025 T: std::convert::Into<wkt::Timestamp>,
11026 {
11027 self.delete_time = std::option::Option::Some(v.into());
11028 self
11029 }
11030
11031 /// Sets or clears the value of [delete_time][crate::model::RetiredResource::delete_time].
11032 ///
11033 /// # Example
11034 /// ```ignore,no_run
11035 /// # use google_cloud_kms_v1::model::RetiredResource;
11036 /// use wkt::Timestamp;
11037 /// let x = RetiredResource::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
11038 /// let x = RetiredResource::new().set_or_clear_delete_time(None::<Timestamp>);
11039 /// ```
11040 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
11041 where
11042 T: std::convert::Into<wkt::Timestamp>,
11043 {
11044 self.delete_time = v.map(|x| x.into());
11045 self
11046 }
11047}
11048
11049impl wkt::message::Message for RetiredResource {
11050 fn typename() -> &'static str {
11051 "type.googleapis.com/google.cloud.kms.v1.RetiredResource"
11052 }
11053}
11054
11055/// Request message for
11056/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
11057///
11058/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
11059#[derive(Clone, Default, PartialEq)]
11060#[non_exhaustive]
11061pub struct ListKeyRingsRequest {
11062 /// Required. The resource name of the location associated with the
11063 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
11064 /// `projects/*/locations/*`.
11065 ///
11066 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11067 pub parent: std::string::String,
11068
11069 /// Optional. Optional limit on the number of
11070 /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
11071 /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
11072 /// including the
11073 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
11074 /// in a subsequent request. If unspecified, the server will pick an
11075 /// appropriate default.
11076 ///
11077 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11078 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
11079 pub page_size: i32,
11080
11081 /// Optional. Optional pagination token, returned earlier via
11082 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
11083 ///
11084 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
11085 pub page_token: std::string::String,
11086
11087 /// Optional. Only include resources that match the filter in the response. For
11088 /// more information, see
11089 /// [Sorting and filtering list
11090 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11091 pub filter: std::string::String,
11092
11093 /// Optional. Specify how the results should be sorted. If not specified, the
11094 /// results will be sorted in the default order. For more information, see
11095 /// [Sorting and filtering list
11096 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11097 pub order_by: std::string::String,
11098
11099 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11100}
11101
11102impl ListKeyRingsRequest {
11103 /// Creates a new default instance.
11104 pub fn new() -> Self {
11105 std::default::Default::default()
11106 }
11107
11108 /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
11109 ///
11110 /// # Example
11111 /// ```ignore,no_run
11112 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
11113 /// let x = ListKeyRingsRequest::new().set_parent("example");
11114 /// ```
11115 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11116 self.parent = v.into();
11117 self
11118 }
11119
11120 /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
11121 ///
11122 /// # Example
11123 /// ```ignore,no_run
11124 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
11125 /// let x = ListKeyRingsRequest::new().set_page_size(42);
11126 /// ```
11127 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11128 self.page_size = v.into();
11129 self
11130 }
11131
11132 /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
11133 ///
11134 /// # Example
11135 /// ```ignore,no_run
11136 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
11137 /// let x = ListKeyRingsRequest::new().set_page_token("example");
11138 /// ```
11139 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11140 self.page_token = v.into();
11141 self
11142 }
11143
11144 /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
11145 ///
11146 /// # Example
11147 /// ```ignore,no_run
11148 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
11149 /// let x = ListKeyRingsRequest::new().set_filter("example");
11150 /// ```
11151 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11152 self.filter = v.into();
11153 self
11154 }
11155
11156 /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
11157 ///
11158 /// # Example
11159 /// ```ignore,no_run
11160 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
11161 /// let x = ListKeyRingsRequest::new().set_order_by("example");
11162 /// ```
11163 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11164 self.order_by = v.into();
11165 self
11166 }
11167}
11168
11169impl wkt::message::Message for ListKeyRingsRequest {
11170 fn typename() -> &'static str {
11171 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
11172 }
11173}
11174
11175/// Request message for
11176/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11177///
11178/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11179#[derive(Clone, Default, PartialEq)]
11180#[non_exhaustive]
11181pub struct ListCryptoKeysRequest {
11182 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
11183 /// to list, in the format `projects/*/locations/*/keyRings/*`.
11184 ///
11185 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11186 pub parent: std::string::String,
11187
11188 /// Optional. Optional limit on the number of
11189 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
11190 /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
11191 /// obtained by including the
11192 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
11193 /// in a subsequent request. If unspecified, the server will pick an
11194 /// appropriate default.
11195 ///
11196 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11197 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
11198 pub page_size: i32,
11199
11200 /// Optional. Optional pagination token, returned earlier via
11201 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
11202 ///
11203 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
11204 pub page_token: std::string::String,
11205
11206 /// The fields of the primary version to include in the response.
11207 pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
11208
11209 /// Optional. Only include resources that match the filter in the response. For
11210 /// more information, see
11211 /// [Sorting and filtering list
11212 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11213 pub filter: std::string::String,
11214
11215 /// Optional. Specify how the results should be sorted. If not specified, the
11216 /// results will be sorted in the default order. For more information, see
11217 /// [Sorting and filtering list
11218 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11219 pub order_by: std::string::String,
11220
11221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11222}
11223
11224impl ListCryptoKeysRequest {
11225 /// Creates a new default instance.
11226 pub fn new() -> Self {
11227 std::default::Default::default()
11228 }
11229
11230 /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
11231 ///
11232 /// # Example
11233 /// ```ignore,no_run
11234 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11235 /// # let project_id = "project_id";
11236 /// # let location_id = "location_id";
11237 /// # let key_ring_id = "key_ring_id";
11238 /// let x = ListCryptoKeysRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
11239 /// ```
11240 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11241 self.parent = v.into();
11242 self
11243 }
11244
11245 /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
11246 ///
11247 /// # Example
11248 /// ```ignore,no_run
11249 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11250 /// let x = ListCryptoKeysRequest::new().set_page_size(42);
11251 /// ```
11252 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11253 self.page_size = v.into();
11254 self
11255 }
11256
11257 /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
11258 ///
11259 /// # Example
11260 /// ```ignore,no_run
11261 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11262 /// let x = ListCryptoKeysRequest::new().set_page_token("example");
11263 /// ```
11264 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11265 self.page_token = v.into();
11266 self
11267 }
11268
11269 /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
11270 ///
11271 /// # Example
11272 /// ```ignore,no_run
11273 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11274 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
11275 /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
11276 /// ```
11277 pub fn set_version_view<
11278 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
11279 >(
11280 mut self,
11281 v: T,
11282 ) -> Self {
11283 self.version_view = v.into();
11284 self
11285 }
11286
11287 /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
11288 ///
11289 /// # Example
11290 /// ```ignore,no_run
11291 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11292 /// let x = ListCryptoKeysRequest::new().set_filter("example");
11293 /// ```
11294 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11295 self.filter = v.into();
11296 self
11297 }
11298
11299 /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
11300 ///
11301 /// # Example
11302 /// ```ignore,no_run
11303 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
11304 /// let x = ListCryptoKeysRequest::new().set_order_by("example");
11305 /// ```
11306 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11307 self.order_by = v.into();
11308 self
11309 }
11310}
11311
11312impl wkt::message::Message for ListCryptoKeysRequest {
11313 fn typename() -> &'static str {
11314 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
11315 }
11316}
11317
11318/// Request message for
11319/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11320///
11321/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11322#[derive(Clone, Default, PartialEq)]
11323#[non_exhaustive]
11324pub struct ListCryptoKeyVersionsRequest {
11325 /// Required. The resource name of the
11326 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
11327 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
11328 ///
11329 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11330 pub parent: std::string::String,
11331
11332 /// Optional. Optional limit on the number of
11333 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
11334 /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
11335 /// can subsequently be obtained by including the
11336 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
11337 /// in a subsequent request. If unspecified, the server will pick an
11338 /// appropriate default.
11339 ///
11340 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11341 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
11342 pub page_size: i32,
11343
11344 /// Optional. Optional pagination token, returned earlier via
11345 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
11346 ///
11347 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
11348 pub page_token: std::string::String,
11349
11350 /// The fields to include in the response.
11351 pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
11352
11353 /// Optional. Only include resources that match the filter in the response. For
11354 /// more information, see
11355 /// [Sorting and filtering list
11356 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11357 pub filter: std::string::String,
11358
11359 /// Optional. Specify how the results should be sorted. If not specified, the
11360 /// results will be sorted in the default order. For more information, see
11361 /// [Sorting and filtering list
11362 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11363 pub order_by: std::string::String,
11364
11365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11366}
11367
11368impl ListCryptoKeyVersionsRequest {
11369 /// Creates a new default instance.
11370 pub fn new() -> Self {
11371 std::default::Default::default()
11372 }
11373
11374 /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
11375 ///
11376 /// # Example
11377 /// ```ignore,no_run
11378 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11379 /// # let project_id = "project_id";
11380 /// # let location_id = "location_id";
11381 /// # let key_ring_id = "key_ring_id";
11382 /// # let crypto_key_id = "crypto_key_id";
11383 /// let x = ListCryptoKeyVersionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
11384 /// ```
11385 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11386 self.parent = v.into();
11387 self
11388 }
11389
11390 /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
11391 ///
11392 /// # Example
11393 /// ```ignore,no_run
11394 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11395 /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
11396 /// ```
11397 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11398 self.page_size = v.into();
11399 self
11400 }
11401
11402 /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
11403 ///
11404 /// # Example
11405 /// ```ignore,no_run
11406 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11407 /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
11408 /// ```
11409 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11410 self.page_token = v.into();
11411 self
11412 }
11413
11414 /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
11415 ///
11416 /// # Example
11417 /// ```ignore,no_run
11418 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11419 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
11420 /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
11421 /// ```
11422 pub fn set_view<
11423 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
11424 >(
11425 mut self,
11426 v: T,
11427 ) -> Self {
11428 self.view = v.into();
11429 self
11430 }
11431
11432 /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
11433 ///
11434 /// # Example
11435 /// ```ignore,no_run
11436 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11437 /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
11438 /// ```
11439 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11440 self.filter = v.into();
11441 self
11442 }
11443
11444 /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
11445 ///
11446 /// # Example
11447 /// ```ignore,no_run
11448 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11449 /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
11450 /// ```
11451 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11452 self.order_by = v.into();
11453 self
11454 }
11455}
11456
11457impl wkt::message::Message for ListCryptoKeyVersionsRequest {
11458 fn typename() -> &'static str {
11459 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
11460 }
11461}
11462
11463/// Request message for
11464/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11465///
11466/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11467#[derive(Clone, Default, PartialEq)]
11468#[non_exhaustive]
11469pub struct ListImportJobsRequest {
11470 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
11471 /// to list, in the format `projects/*/locations/*/keyRings/*`.
11472 ///
11473 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11474 pub parent: std::string::String,
11475
11476 /// Optional. Optional limit on the number of
11477 /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
11478 /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
11479 /// obtained by including the
11480 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
11481 /// in a subsequent request. If unspecified, the server will pick an
11482 /// appropriate default.
11483 ///
11484 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11485 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11486 pub page_size: i32,
11487
11488 /// Optional. Optional pagination token, returned earlier via
11489 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
11490 ///
11491 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11492 pub page_token: std::string::String,
11493
11494 /// Optional. Only include resources that match the filter in the response. For
11495 /// more information, see
11496 /// [Sorting and filtering list
11497 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11498 pub filter: std::string::String,
11499
11500 /// Optional. Specify how the results should be sorted. If not specified, the
11501 /// results will be sorted in the default order. For more information, see
11502 /// [Sorting and filtering list
11503 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11504 pub order_by: std::string::String,
11505
11506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11507}
11508
11509impl ListImportJobsRequest {
11510 /// Creates a new default instance.
11511 pub fn new() -> Self {
11512 std::default::Default::default()
11513 }
11514
11515 /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
11516 ///
11517 /// # Example
11518 /// ```ignore,no_run
11519 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11520 /// # let project_id = "project_id";
11521 /// # let location_id = "location_id";
11522 /// # let key_ring_id = "key_ring_id";
11523 /// let x = ListImportJobsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
11524 /// ```
11525 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11526 self.parent = v.into();
11527 self
11528 }
11529
11530 /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
11531 ///
11532 /// # Example
11533 /// ```ignore,no_run
11534 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11535 /// let x = ListImportJobsRequest::new().set_page_size(42);
11536 /// ```
11537 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11538 self.page_size = v.into();
11539 self
11540 }
11541
11542 /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
11543 ///
11544 /// # Example
11545 /// ```ignore,no_run
11546 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11547 /// let x = ListImportJobsRequest::new().set_page_token("example");
11548 /// ```
11549 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11550 self.page_token = v.into();
11551 self
11552 }
11553
11554 /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
11555 ///
11556 /// # Example
11557 /// ```ignore,no_run
11558 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11559 /// let x = ListImportJobsRequest::new().set_filter("example");
11560 /// ```
11561 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11562 self.filter = v.into();
11563 self
11564 }
11565
11566 /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
11567 ///
11568 /// # Example
11569 /// ```ignore,no_run
11570 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11571 /// let x = ListImportJobsRequest::new().set_order_by("example");
11572 /// ```
11573 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11574 self.order_by = v.into();
11575 self
11576 }
11577}
11578
11579impl wkt::message::Message for ListImportJobsRequest {
11580 fn typename() -> &'static str {
11581 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
11582 }
11583}
11584
11585/// Request message for
11586/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11587///
11588/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11589#[derive(Clone, Default, PartialEq)]
11590#[non_exhaustive]
11591pub struct ListRetiredResourcesRequest {
11592 /// Required. The project-specific location holding the
11593 /// [RetiredResources][google.cloud.kms.v1.RetiredResource], in the format
11594 /// `projects/*/locations/*`.
11595 ///
11596 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11597 pub parent: std::string::String,
11598
11599 /// Optional. Optional limit on the number of
11600 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] to be included in
11601 /// the response. Further
11602 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] can subsequently be
11603 /// obtained by including the
11604 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]
11605 /// in a subsequent request. If unspecified, the server will pick an
11606 /// appropriate default.
11607 ///
11608 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11609 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11610 pub page_size: i32,
11611
11612 /// Optional. Optional pagination token, returned earlier via
11613 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token].
11614 ///
11615 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11616 pub page_token: std::string::String,
11617
11618 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11619}
11620
11621impl ListRetiredResourcesRequest {
11622 /// Creates a new default instance.
11623 pub fn new() -> Self {
11624 std::default::Default::default()
11625 }
11626
11627 /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
11628 ///
11629 /// # Example
11630 /// ```ignore,no_run
11631 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11632 /// # let project_id = "project_id";
11633 /// # let location_id = "location_id";
11634 /// let x = ListRetiredResourcesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
11635 /// ```
11636 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11637 self.parent = v.into();
11638 self
11639 }
11640
11641 /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
11642 ///
11643 /// # Example
11644 /// ```ignore,no_run
11645 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11646 /// let x = ListRetiredResourcesRequest::new().set_page_size(42);
11647 /// ```
11648 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11649 self.page_size = v.into();
11650 self
11651 }
11652
11653 /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
11654 ///
11655 /// # Example
11656 /// ```ignore,no_run
11657 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11658 /// let x = ListRetiredResourcesRequest::new().set_page_token("example");
11659 /// ```
11660 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11661 self.page_token = v.into();
11662 self
11663 }
11664}
11665
11666impl wkt::message::Message for ListRetiredResourcesRequest {
11667 fn typename() -> &'static str {
11668 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesRequest"
11669 }
11670}
11671
11672/// Response message for
11673/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
11674///
11675/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
11676#[derive(Clone, Default, PartialEq)]
11677#[non_exhaustive]
11678pub struct ListKeyRingsResponse {
11679 /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
11680 ///
11681 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11682 pub key_rings: std::vec::Vec<crate::model::KeyRing>,
11683
11684 /// A token to retrieve next page of results. Pass this value in
11685 /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
11686 /// to retrieve the next page of results.
11687 ///
11688 /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
11689 pub next_page_token: std::string::String,
11690
11691 /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
11692 /// the query.
11693 ///
11694 /// This field is not populated if
11695 /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
11696 /// is applied.
11697 ///
11698 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11699 /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
11700 pub total_size: i32,
11701
11702 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11703}
11704
11705impl ListKeyRingsResponse {
11706 /// Creates a new default instance.
11707 pub fn new() -> Self {
11708 std::default::Default::default()
11709 }
11710
11711 /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
11712 ///
11713 /// # Example
11714 /// ```ignore,no_run
11715 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11716 /// use google_cloud_kms_v1::model::KeyRing;
11717 /// let x = ListKeyRingsResponse::new()
11718 /// .set_key_rings([
11719 /// KeyRing::default()/* use setters */,
11720 /// KeyRing::default()/* use (different) setters */,
11721 /// ]);
11722 /// ```
11723 pub fn set_key_rings<T, V>(mut self, v: T) -> Self
11724 where
11725 T: std::iter::IntoIterator<Item = V>,
11726 V: std::convert::Into<crate::model::KeyRing>,
11727 {
11728 use std::iter::Iterator;
11729 self.key_rings = v.into_iter().map(|i| i.into()).collect();
11730 self
11731 }
11732
11733 /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
11734 ///
11735 /// # Example
11736 /// ```ignore,no_run
11737 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11738 /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
11739 /// ```
11740 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11741 self.next_page_token = v.into();
11742 self
11743 }
11744
11745 /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
11746 ///
11747 /// # Example
11748 /// ```ignore,no_run
11749 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11750 /// let x = ListKeyRingsResponse::new().set_total_size(42);
11751 /// ```
11752 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11753 self.total_size = v.into();
11754 self
11755 }
11756}
11757
11758impl wkt::message::Message for ListKeyRingsResponse {
11759 fn typename() -> &'static str {
11760 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
11761 }
11762}
11763
11764#[doc(hidden)]
11765impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
11766 type PageItem = crate::model::KeyRing;
11767
11768 fn items(self) -> std::vec::Vec<Self::PageItem> {
11769 self.key_rings
11770 }
11771
11772 fn next_page_token(&self) -> std::string::String {
11773 use std::clone::Clone;
11774 self.next_page_token.clone()
11775 }
11776}
11777
11778/// Response message for
11779/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11780///
11781/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11782#[derive(Clone, Default, PartialEq)]
11783#[non_exhaustive]
11784pub struct ListCryptoKeysResponse {
11785 /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11786 ///
11787 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11788 pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
11789
11790 /// A token to retrieve next page of results. Pass this value in
11791 /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
11792 /// to retrieve the next page of results.
11793 ///
11794 /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
11795 pub next_page_token: std::string::String,
11796
11797 /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
11798 /// matched the query.
11799 ///
11800 /// This field is not populated if
11801 /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
11802 /// is applied.
11803 ///
11804 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11805 /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
11806 pub total_size: i32,
11807
11808 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11809}
11810
11811impl ListCryptoKeysResponse {
11812 /// Creates a new default instance.
11813 pub fn new() -> Self {
11814 std::default::Default::default()
11815 }
11816
11817 /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
11818 ///
11819 /// # Example
11820 /// ```ignore,no_run
11821 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11822 /// use google_cloud_kms_v1::model::CryptoKey;
11823 /// let x = ListCryptoKeysResponse::new()
11824 /// .set_crypto_keys([
11825 /// CryptoKey::default()/* use setters */,
11826 /// CryptoKey::default()/* use (different) setters */,
11827 /// ]);
11828 /// ```
11829 pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
11830 where
11831 T: std::iter::IntoIterator<Item = V>,
11832 V: std::convert::Into<crate::model::CryptoKey>,
11833 {
11834 use std::iter::Iterator;
11835 self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
11836 self
11837 }
11838
11839 /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
11840 ///
11841 /// # Example
11842 /// ```ignore,no_run
11843 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11844 /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
11845 /// ```
11846 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11847 self.next_page_token = v.into();
11848 self
11849 }
11850
11851 /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
11852 ///
11853 /// # Example
11854 /// ```ignore,no_run
11855 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11856 /// let x = ListCryptoKeysResponse::new().set_total_size(42);
11857 /// ```
11858 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11859 self.total_size = v.into();
11860 self
11861 }
11862}
11863
11864impl wkt::message::Message for ListCryptoKeysResponse {
11865 fn typename() -> &'static str {
11866 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
11867 }
11868}
11869
11870#[doc(hidden)]
11871impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
11872 type PageItem = crate::model::CryptoKey;
11873
11874 fn items(self) -> std::vec::Vec<Self::PageItem> {
11875 self.crypto_keys
11876 }
11877
11878 fn next_page_token(&self) -> std::string::String {
11879 use std::clone::Clone;
11880 self.next_page_token.clone()
11881 }
11882}
11883
11884/// Response message for
11885/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11886///
11887/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11888#[derive(Clone, Default, PartialEq)]
11889#[non_exhaustive]
11890pub struct ListCryptoKeyVersionsResponse {
11891 /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11892 ///
11893 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11894 pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
11895
11896 /// A token to retrieve next page of results. Pass this value in
11897 /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
11898 /// to retrieve the next page of results.
11899 ///
11900 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
11901 pub next_page_token: std::string::String,
11902
11903 /// The total number of
11904 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
11905 /// query.
11906 ///
11907 /// This field is not populated if
11908 /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
11909 /// is applied.
11910 ///
11911 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11912 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
11913 pub total_size: i32,
11914
11915 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11916}
11917
11918impl ListCryptoKeyVersionsResponse {
11919 /// Creates a new default instance.
11920 pub fn new() -> Self {
11921 std::default::Default::default()
11922 }
11923
11924 /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
11925 ///
11926 /// # Example
11927 /// ```ignore,no_run
11928 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11929 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11930 /// let x = ListCryptoKeyVersionsResponse::new()
11931 /// .set_crypto_key_versions([
11932 /// CryptoKeyVersion::default()/* use setters */,
11933 /// CryptoKeyVersion::default()/* use (different) setters */,
11934 /// ]);
11935 /// ```
11936 pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
11937 where
11938 T: std::iter::IntoIterator<Item = V>,
11939 V: std::convert::Into<crate::model::CryptoKeyVersion>,
11940 {
11941 use std::iter::Iterator;
11942 self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
11943 self
11944 }
11945
11946 /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
11947 ///
11948 /// # Example
11949 /// ```ignore,no_run
11950 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11951 /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
11952 /// ```
11953 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11954 self.next_page_token = v.into();
11955 self
11956 }
11957
11958 /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
11959 ///
11960 /// # Example
11961 /// ```ignore,no_run
11962 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11963 /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
11964 /// ```
11965 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11966 self.total_size = v.into();
11967 self
11968 }
11969}
11970
11971impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11972 fn typename() -> &'static str {
11973 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11974 }
11975}
11976
11977#[doc(hidden)]
11978impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11979 type PageItem = crate::model::CryptoKeyVersion;
11980
11981 fn items(self) -> std::vec::Vec<Self::PageItem> {
11982 self.crypto_key_versions
11983 }
11984
11985 fn next_page_token(&self) -> std::string::String {
11986 use std::clone::Clone;
11987 self.next_page_token.clone()
11988 }
11989}
11990
11991/// Response message for
11992/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11993///
11994/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11995#[derive(Clone, Default, PartialEq)]
11996#[non_exhaustive]
11997pub struct ListImportJobsResponse {
11998 /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11999 ///
12000 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12001 pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
12002
12003 /// A token to retrieve next page of results. Pass this value in
12004 /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
12005 /// to retrieve the next page of results.
12006 ///
12007 /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
12008 pub next_page_token: std::string::String,
12009
12010 /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
12011 /// matched the query.
12012 ///
12013 /// This field is not populated if
12014 /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
12015 /// is applied.
12016 ///
12017 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12018 /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
12019 pub total_size: i32,
12020
12021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12022}
12023
12024impl ListImportJobsResponse {
12025 /// Creates a new default instance.
12026 pub fn new() -> Self {
12027 std::default::Default::default()
12028 }
12029
12030 /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
12031 ///
12032 /// # Example
12033 /// ```ignore,no_run
12034 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
12035 /// use google_cloud_kms_v1::model::ImportJob;
12036 /// let x = ListImportJobsResponse::new()
12037 /// .set_import_jobs([
12038 /// ImportJob::default()/* use setters */,
12039 /// ImportJob::default()/* use (different) setters */,
12040 /// ]);
12041 /// ```
12042 pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
12043 where
12044 T: std::iter::IntoIterator<Item = V>,
12045 V: std::convert::Into<crate::model::ImportJob>,
12046 {
12047 use std::iter::Iterator;
12048 self.import_jobs = v.into_iter().map(|i| i.into()).collect();
12049 self
12050 }
12051
12052 /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
12053 ///
12054 /// # Example
12055 /// ```ignore,no_run
12056 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
12057 /// let x = ListImportJobsResponse::new().set_next_page_token("example");
12058 /// ```
12059 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12060 self.next_page_token = v.into();
12061 self
12062 }
12063
12064 /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
12065 ///
12066 /// # Example
12067 /// ```ignore,no_run
12068 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
12069 /// let x = ListImportJobsResponse::new().set_total_size(42);
12070 /// ```
12071 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12072 self.total_size = v.into();
12073 self
12074 }
12075}
12076
12077impl wkt::message::Message for ListImportJobsResponse {
12078 fn typename() -> &'static str {
12079 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
12080 }
12081}
12082
12083#[doc(hidden)]
12084impl google_cloud_gax::paginator::internal::PageableResponse for ListImportJobsResponse {
12085 type PageItem = crate::model::ImportJob;
12086
12087 fn items(self) -> std::vec::Vec<Self::PageItem> {
12088 self.import_jobs
12089 }
12090
12091 fn next_page_token(&self) -> std::string::String {
12092 use std::clone::Clone;
12093 self.next_page_token.clone()
12094 }
12095}
12096
12097/// Response message for
12098/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
12099///
12100/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
12101#[derive(Clone, Default, PartialEq)]
12102#[non_exhaustive]
12103pub struct ListRetiredResourcesResponse {
12104 /// The list of [RetiredResources][google.cloud.kms.v1.RetiredResource].
12105 ///
12106 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
12107 pub retired_resources: std::vec::Vec<crate::model::RetiredResource>,
12108
12109 /// A token to retrieve the next page of results. Pass this value in
12110 /// [ListRetiredResourcesRequest.page_token][google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]
12111 /// to retrieve the next page of results.
12112 ///
12113 /// [google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]: crate::model::ListRetiredResourcesRequest::page_token
12114 pub next_page_token: std::string::String,
12115
12116 /// The total number of [RetiredResources][google.cloud.kms.v1.RetiredResource]
12117 /// that matched the query.
12118 ///
12119 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
12120 pub total_size: i64,
12121
12122 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12123}
12124
12125impl ListRetiredResourcesResponse {
12126 /// Creates a new default instance.
12127 pub fn new() -> Self {
12128 std::default::Default::default()
12129 }
12130
12131 /// Sets the value of [retired_resources][crate::model::ListRetiredResourcesResponse::retired_resources].
12132 ///
12133 /// # Example
12134 /// ```ignore,no_run
12135 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
12136 /// use google_cloud_kms_v1::model::RetiredResource;
12137 /// let x = ListRetiredResourcesResponse::new()
12138 /// .set_retired_resources([
12139 /// RetiredResource::default()/* use setters */,
12140 /// RetiredResource::default()/* use (different) setters */,
12141 /// ]);
12142 /// ```
12143 pub fn set_retired_resources<T, V>(mut self, v: T) -> Self
12144 where
12145 T: std::iter::IntoIterator<Item = V>,
12146 V: std::convert::Into<crate::model::RetiredResource>,
12147 {
12148 use std::iter::Iterator;
12149 self.retired_resources = v.into_iter().map(|i| i.into()).collect();
12150 self
12151 }
12152
12153 /// Sets the value of [next_page_token][crate::model::ListRetiredResourcesResponse::next_page_token].
12154 ///
12155 /// # Example
12156 /// ```ignore,no_run
12157 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
12158 /// let x = ListRetiredResourcesResponse::new().set_next_page_token("example");
12159 /// ```
12160 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12161 self.next_page_token = v.into();
12162 self
12163 }
12164
12165 /// Sets the value of [total_size][crate::model::ListRetiredResourcesResponse::total_size].
12166 ///
12167 /// # Example
12168 /// ```ignore,no_run
12169 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
12170 /// let x = ListRetiredResourcesResponse::new().set_total_size(42);
12171 /// ```
12172 pub fn set_total_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12173 self.total_size = v.into();
12174 self
12175 }
12176}
12177
12178impl wkt::message::Message for ListRetiredResourcesResponse {
12179 fn typename() -> &'static str {
12180 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesResponse"
12181 }
12182}
12183
12184#[doc(hidden)]
12185impl google_cloud_gax::paginator::internal::PageableResponse for ListRetiredResourcesResponse {
12186 type PageItem = crate::model::RetiredResource;
12187
12188 fn items(self) -> std::vec::Vec<Self::PageItem> {
12189 self.retired_resources
12190 }
12191
12192 fn next_page_token(&self) -> std::string::String {
12193 use std::clone::Clone;
12194 self.next_page_token.clone()
12195 }
12196}
12197
12198/// Request message for
12199/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
12200///
12201/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
12202#[derive(Clone, Default, PartialEq)]
12203#[non_exhaustive]
12204pub struct GetKeyRingRequest {
12205 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
12206 /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
12207 ///
12208 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12209 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12210 pub name: std::string::String,
12211
12212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12213}
12214
12215impl GetKeyRingRequest {
12216 /// Creates a new default instance.
12217 pub fn new() -> Self {
12218 std::default::Default::default()
12219 }
12220
12221 /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
12222 ///
12223 /// # Example
12224 /// ```ignore,no_run
12225 /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
12226 /// # let project_id = "project_id";
12227 /// # let location_id = "location_id";
12228 /// # let key_ring_id = "key_ring_id";
12229 /// let x = GetKeyRingRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
12230 /// ```
12231 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12232 self.name = v.into();
12233 self
12234 }
12235}
12236
12237impl wkt::message::Message for GetKeyRingRequest {
12238 fn typename() -> &'static str {
12239 "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
12240 }
12241}
12242
12243/// Request message for
12244/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
12245///
12246/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
12247#[derive(Clone, Default, PartialEq)]
12248#[non_exhaustive]
12249pub struct GetCryptoKeyRequest {
12250 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12251 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
12252 ///
12253 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12254 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12255 pub name: std::string::String,
12256
12257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12258}
12259
12260impl GetCryptoKeyRequest {
12261 /// Creates a new default instance.
12262 pub fn new() -> Self {
12263 std::default::Default::default()
12264 }
12265
12266 /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
12267 ///
12268 /// # Example
12269 /// ```ignore,no_run
12270 /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
12271 /// # let project_id = "project_id";
12272 /// # let location_id = "location_id";
12273 /// # let key_ring_id = "key_ring_id";
12274 /// # let crypto_key_id = "crypto_key_id";
12275 /// let x = GetCryptoKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12276 /// ```
12277 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12278 self.name = v.into();
12279 self
12280 }
12281}
12282
12283impl wkt::message::Message for GetCryptoKeyRequest {
12284 fn typename() -> &'static str {
12285 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
12286 }
12287}
12288
12289/// Request message for
12290/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
12291///
12292/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
12293#[derive(Clone, Default, PartialEq)]
12294#[non_exhaustive]
12295pub struct GetCryptoKeyVersionRequest {
12296 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12297 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
12298 ///
12299 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12300 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12301 pub name: std::string::String,
12302
12303 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12304}
12305
12306impl GetCryptoKeyVersionRequest {
12307 /// Creates a new default instance.
12308 pub fn new() -> Self {
12309 std::default::Default::default()
12310 }
12311
12312 /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
12313 ///
12314 /// # Example
12315 /// ```ignore,no_run
12316 /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
12317 /// # let project_id = "project_id";
12318 /// # let location_id = "location_id";
12319 /// # let key_ring_id = "key_ring_id";
12320 /// # let crypto_key_id = "crypto_key_id";
12321 /// # let crypto_key_version_id = "crypto_key_version_id";
12322 /// let x = GetCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12323 /// ```
12324 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12325 self.name = v.into();
12326 self
12327 }
12328}
12329
12330impl wkt::message::Message for GetCryptoKeyVersionRequest {
12331 fn typename() -> &'static str {
12332 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
12333 }
12334}
12335
12336/// Request message for
12337/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
12338///
12339/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
12340#[derive(Clone, Default, PartialEq)]
12341#[non_exhaustive]
12342pub struct GetPublicKeyRequest {
12343 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12344 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
12345 ///
12346 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12347 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12348 pub name: std::string::String,
12349
12350 /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
12351 /// by the user. This field is required for PQC algorithms. If specified, the
12352 /// public key will be exported through the
12353 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
12354 /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
12355 /// field will be populated for non-PQC algorithms, and an error will be
12356 /// returned for PQC algorithms.
12357 ///
12358 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
12359 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
12360 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
12361 pub public_key_format: crate::model::public_key::PublicKeyFormat,
12362
12363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12364}
12365
12366impl GetPublicKeyRequest {
12367 /// Creates a new default instance.
12368 pub fn new() -> Self {
12369 std::default::Default::default()
12370 }
12371
12372 /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
12373 ///
12374 /// # Example
12375 /// ```ignore,no_run
12376 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
12377 /// # let project_id = "project_id";
12378 /// # let location_id = "location_id";
12379 /// # let key_ring_id = "key_ring_id";
12380 /// # let crypto_key_id = "crypto_key_id";
12381 /// # let crypto_key_version_id = "crypto_key_version_id";
12382 /// let x = GetPublicKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12383 /// ```
12384 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12385 self.name = v.into();
12386 self
12387 }
12388
12389 /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
12390 ///
12391 /// # Example
12392 /// ```ignore,no_run
12393 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
12394 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
12395 /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
12396 /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
12397 /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
12398 /// ```
12399 pub fn set_public_key_format<
12400 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
12401 >(
12402 mut self,
12403 v: T,
12404 ) -> Self {
12405 self.public_key_format = v.into();
12406 self
12407 }
12408}
12409
12410impl wkt::message::Message for GetPublicKeyRequest {
12411 fn typename() -> &'static str {
12412 "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
12413 }
12414}
12415
12416/// Request message for
12417/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
12418///
12419/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
12420#[derive(Clone, Default, PartialEq)]
12421#[non_exhaustive]
12422pub struct GetImportJobRequest {
12423 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12424 /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
12425 ///
12426 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12427 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12428 pub name: std::string::String,
12429
12430 /// Optional. Specifies the [WrappingPublicKey][] format.
12431 /// If not specified:
12432 ///
12433 /// * For RSA-based import methods, the wrapping key will be returned in PEM
12434 /// format
12435 /// * For pure ML-KEM-based import methods, the wrapping key will be returned
12436 /// in the raw bytes format specified in FIPS-203
12437 /// * For X-Wing-based import methods, the wrapping key will be returned in
12438 /// the raw bytes format specified in
12439 /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
12440 pub public_key_format: crate::model::public_key::PublicKeyFormat,
12441
12442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12443}
12444
12445impl GetImportJobRequest {
12446 /// Creates a new default instance.
12447 pub fn new() -> Self {
12448 std::default::Default::default()
12449 }
12450
12451 /// Sets the value of [name][crate::model::GetImportJobRequest::name].
12452 ///
12453 /// # Example
12454 /// ```ignore,no_run
12455 /// # use google_cloud_kms_v1::model::GetImportJobRequest;
12456 /// # let project_id = "project_id";
12457 /// # let location_id = "location_id";
12458 /// # let key_ring_id = "key_ring_id";
12459 /// # let import_job_id = "import_job_id";
12460 /// let x = GetImportJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/importJobs/{import_job_id}"));
12461 /// ```
12462 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12463 self.name = v.into();
12464 self
12465 }
12466
12467 /// Sets the value of [public_key_format][crate::model::GetImportJobRequest::public_key_format].
12468 ///
12469 /// # Example
12470 /// ```ignore,no_run
12471 /// # use google_cloud_kms_v1::model::GetImportJobRequest;
12472 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
12473 /// let x0 = GetImportJobRequest::new().set_public_key_format(PublicKeyFormat::Pem);
12474 /// let x1 = GetImportJobRequest::new().set_public_key_format(PublicKeyFormat::Der);
12475 /// let x2 = GetImportJobRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
12476 /// ```
12477 pub fn set_public_key_format<
12478 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
12479 >(
12480 mut self,
12481 v: T,
12482 ) -> Self {
12483 self.public_key_format = v.into();
12484 self
12485 }
12486}
12487
12488impl wkt::message::Message for GetImportJobRequest {
12489 fn typename() -> &'static str {
12490 "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
12491 }
12492}
12493
12494/// Request message for
12495/// [KeyManagementService.GetRetiredResource][google.cloud.kms.v1.KeyManagementService.GetRetiredResource].
12496///
12497/// [google.cloud.kms.v1.KeyManagementService.GetRetiredResource]: crate::client::KeyManagementService::get_retired_resource
12498#[derive(Clone, Default, PartialEq)]
12499#[non_exhaustive]
12500pub struct GetRetiredResourceRequest {
12501 /// Required. The [name][google.cloud.kms.v1.RetiredResource.name] of the
12502 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] to get.
12503 ///
12504 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
12505 /// [google.cloud.kms.v1.RetiredResource.name]: crate::model::RetiredResource::name
12506 pub name: std::string::String,
12507
12508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12509}
12510
12511impl GetRetiredResourceRequest {
12512 /// Creates a new default instance.
12513 pub fn new() -> Self {
12514 std::default::Default::default()
12515 }
12516
12517 /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
12518 ///
12519 /// # Example
12520 /// ```ignore,no_run
12521 /// # use google_cloud_kms_v1::model::GetRetiredResourceRequest;
12522 /// # let project_id = "project_id";
12523 /// # let location_id = "location_id";
12524 /// # let retired_resource_id = "retired_resource_id";
12525 /// let x = GetRetiredResourceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
12526 /// ```
12527 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12528 self.name = v.into();
12529 self
12530 }
12531}
12532
12533impl wkt::message::Message for GetRetiredResourceRequest {
12534 fn typename() -> &'static str {
12535 "type.googleapis.com/google.cloud.kms.v1.GetRetiredResourceRequest"
12536 }
12537}
12538
12539/// Request message for
12540/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
12541///
12542/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
12543#[derive(Clone, Default, PartialEq)]
12544#[non_exhaustive]
12545pub struct CreateKeyRingRequest {
12546 /// Required. The resource name of the location associated with the
12547 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
12548 /// `projects/*/locations/*`.
12549 ///
12550 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12551 pub parent: std::string::String,
12552
12553 /// Required. It must be unique within a location and match the regular
12554 /// expression `[a-zA-Z0-9_-]{1,63}`
12555 pub key_ring_id: std::string::String,
12556
12557 /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
12558 /// values.
12559 ///
12560 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12561 pub key_ring: std::option::Option<crate::model::KeyRing>,
12562
12563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12564}
12565
12566impl CreateKeyRingRequest {
12567 /// Creates a new default instance.
12568 pub fn new() -> Self {
12569 std::default::Default::default()
12570 }
12571
12572 /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
12573 ///
12574 /// # Example
12575 /// ```ignore,no_run
12576 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12577 /// let x = CreateKeyRingRequest::new().set_parent("example");
12578 /// ```
12579 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12580 self.parent = v.into();
12581 self
12582 }
12583
12584 /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
12585 ///
12586 /// # Example
12587 /// ```ignore,no_run
12588 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12589 /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
12590 /// ```
12591 pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12592 self.key_ring_id = v.into();
12593 self
12594 }
12595
12596 /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12597 ///
12598 /// # Example
12599 /// ```ignore,no_run
12600 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12601 /// use google_cloud_kms_v1::model::KeyRing;
12602 /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
12603 /// ```
12604 pub fn set_key_ring<T>(mut self, v: T) -> Self
12605 where
12606 T: std::convert::Into<crate::model::KeyRing>,
12607 {
12608 self.key_ring = std::option::Option::Some(v.into());
12609 self
12610 }
12611
12612 /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12613 ///
12614 /// # Example
12615 /// ```ignore,no_run
12616 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12617 /// use google_cloud_kms_v1::model::KeyRing;
12618 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
12619 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
12620 /// ```
12621 pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
12622 where
12623 T: std::convert::Into<crate::model::KeyRing>,
12624 {
12625 self.key_ring = v.map(|x| x.into());
12626 self
12627 }
12628}
12629
12630impl wkt::message::Message for CreateKeyRingRequest {
12631 fn typename() -> &'static str {
12632 "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
12633 }
12634}
12635
12636/// Request message for
12637/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
12638///
12639/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
12640#[derive(Clone, Default, PartialEq)]
12641#[non_exhaustive]
12642pub struct CreateCryptoKeyRequest {
12643 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
12644 /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
12645 ///
12646 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12647 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12648 pub parent: std::string::String,
12649
12650 /// Required. It must be unique within a KeyRing and match the regular
12651 /// expression `[a-zA-Z0-9_-]{1,63}`
12652 pub crypto_key_id: std::string::String,
12653
12654 /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
12655 /// values.
12656 ///
12657 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12658 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12659
12660 /// If set to true, the request will create a
12661 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
12662 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
12663 /// manually call
12664 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
12665 /// or
12666 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
12667 /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
12668 ///
12669 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12670 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12671 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12672 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12673 pub skip_initial_version_creation: bool,
12674
12675 /// Optional. Whether trusted wrapping will be enabled on the first
12676 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] created for this
12677 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. This field is only supported
12678 /// for keys with
12679 /// [CryptoKeyVersionTemplate.protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
12680 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT].
12681 /// This field is supported for all
12682 /// [CryptoKeyPurposes][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] except
12683 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
12684 ///
12685 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12686 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
12687 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
12688 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12689 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12690 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
12691 pub trusted_wrapping_enabled: bool,
12692
12693 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12694}
12695
12696impl CreateCryptoKeyRequest {
12697 /// Creates a new default instance.
12698 pub fn new() -> Self {
12699 std::default::Default::default()
12700 }
12701
12702 /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
12703 ///
12704 /// # Example
12705 /// ```ignore,no_run
12706 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12707 /// # let project_id = "project_id";
12708 /// # let location_id = "location_id";
12709 /// # let key_ring_id = "key_ring_id";
12710 /// let x = CreateCryptoKeyRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
12711 /// ```
12712 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12713 self.parent = v.into();
12714 self
12715 }
12716
12717 /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
12718 ///
12719 /// # Example
12720 /// ```ignore,no_run
12721 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12722 /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
12723 /// ```
12724 pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12725 self.crypto_key_id = v.into();
12726 self
12727 }
12728
12729 /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12730 ///
12731 /// # Example
12732 /// ```ignore,no_run
12733 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12734 /// use google_cloud_kms_v1::model::CryptoKey;
12735 /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12736 /// ```
12737 pub fn set_crypto_key<T>(mut self, v: T) -> Self
12738 where
12739 T: std::convert::Into<crate::model::CryptoKey>,
12740 {
12741 self.crypto_key = std::option::Option::Some(v.into());
12742 self
12743 }
12744
12745 /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12746 ///
12747 /// # Example
12748 /// ```ignore,no_run
12749 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12750 /// use google_cloud_kms_v1::model::CryptoKey;
12751 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12752 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12753 /// ```
12754 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12755 where
12756 T: std::convert::Into<crate::model::CryptoKey>,
12757 {
12758 self.crypto_key = v.map(|x| x.into());
12759 self
12760 }
12761
12762 /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
12763 ///
12764 /// # Example
12765 /// ```ignore,no_run
12766 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12767 /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
12768 /// ```
12769 pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12770 self.skip_initial_version_creation = v.into();
12771 self
12772 }
12773
12774 /// Sets the value of [trusted_wrapping_enabled][crate::model::CreateCryptoKeyRequest::trusted_wrapping_enabled].
12775 ///
12776 /// # Example
12777 /// ```ignore,no_run
12778 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12779 /// let x = CreateCryptoKeyRequest::new().set_trusted_wrapping_enabled(true);
12780 /// ```
12781 pub fn set_trusted_wrapping_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12782 self.trusted_wrapping_enabled = v.into();
12783 self
12784 }
12785}
12786
12787impl wkt::message::Message for CreateCryptoKeyRequest {
12788 fn typename() -> &'static str {
12789 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
12790 }
12791}
12792
12793/// Request message for
12794/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
12795///
12796/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12797#[derive(Clone, Default, PartialEq)]
12798#[non_exhaustive]
12799pub struct CreateCryptoKeyVersionRequest {
12800 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12801 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
12802 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
12803 ///
12804 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12805 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12806 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12807 pub parent: std::string::String,
12808
12809 /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12810 /// initial field values.
12811 ///
12812 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12813 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12814
12815 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12816}
12817
12818impl CreateCryptoKeyVersionRequest {
12819 /// Creates a new default instance.
12820 pub fn new() -> Self {
12821 std::default::Default::default()
12822 }
12823
12824 /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
12825 ///
12826 /// # Example
12827 /// ```ignore,no_run
12828 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12829 /// # let project_id = "project_id";
12830 /// # let location_id = "location_id";
12831 /// # let key_ring_id = "key_ring_id";
12832 /// # let crypto_key_id = "crypto_key_id";
12833 /// let x = CreateCryptoKeyVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12834 /// ```
12835 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12836 self.parent = v.into();
12837 self
12838 }
12839
12840 /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12841 ///
12842 /// # Example
12843 /// ```ignore,no_run
12844 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12845 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12846 /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12847 /// ```
12848 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12849 where
12850 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12851 {
12852 self.crypto_key_version = std::option::Option::Some(v.into());
12853 self
12854 }
12855
12856 /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12857 ///
12858 /// # Example
12859 /// ```ignore,no_run
12860 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12861 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12862 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12863 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12864 /// ```
12865 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12866 where
12867 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12868 {
12869 self.crypto_key_version = v.map(|x| x.into());
12870 self
12871 }
12872}
12873
12874impl wkt::message::Message for CreateCryptoKeyVersionRequest {
12875 fn typename() -> &'static str {
12876 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
12877 }
12878}
12879
12880/// Request message for
12881/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey].
12882///
12883/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
12884#[derive(Clone, Default, PartialEq)]
12885#[non_exhaustive]
12886pub struct DeleteCryptoKeyRequest {
12887 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12888 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to delete.
12889 ///
12890 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12891 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12892 pub name: std::string::String,
12893
12894 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12895}
12896
12897impl DeleteCryptoKeyRequest {
12898 /// Creates a new default instance.
12899 pub fn new() -> Self {
12900 std::default::Default::default()
12901 }
12902
12903 /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
12904 ///
12905 /// # Example
12906 /// ```ignore,no_run
12907 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyRequest;
12908 /// # let project_id = "project_id";
12909 /// # let location_id = "location_id";
12910 /// # let key_ring_id = "key_ring_id";
12911 /// # let crypto_key_id = "crypto_key_id";
12912 /// let x = DeleteCryptoKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12913 /// ```
12914 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12915 self.name = v.into();
12916 self
12917 }
12918}
12919
12920impl wkt::message::Message for DeleteCryptoKeyRequest {
12921 fn typename() -> &'static str {
12922 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyRequest"
12923 }
12924}
12925
12926/// Request message for
12927/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion].
12928///
12929/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
12930#[derive(Clone, Default, PartialEq)]
12931#[non_exhaustive]
12932pub struct DeleteCryptoKeyVersionRequest {
12933 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12934 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to delete.
12935 ///
12936 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12937 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12938 pub name: std::string::String,
12939
12940 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12941}
12942
12943impl DeleteCryptoKeyVersionRequest {
12944 /// Creates a new default instance.
12945 pub fn new() -> Self {
12946 std::default::Default::default()
12947 }
12948
12949 /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
12950 ///
12951 /// # Example
12952 /// ```ignore,no_run
12953 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyVersionRequest;
12954 /// # let project_id = "project_id";
12955 /// # let location_id = "location_id";
12956 /// # let key_ring_id = "key_ring_id";
12957 /// # let crypto_key_id = "crypto_key_id";
12958 /// # let crypto_key_version_id = "crypto_key_version_id";
12959 /// let x = DeleteCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12960 /// ```
12961 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12962 self.name = v.into();
12963 self
12964 }
12965}
12966
12967impl wkt::message::Message for DeleteCryptoKeyVersionRequest {
12968 fn typename() -> &'static str {
12969 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionRequest"
12970 }
12971}
12972
12973/// Request message for
12974/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
12975///
12976/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12977#[derive(Clone, Default, PartialEq)]
12978#[non_exhaustive]
12979pub struct ImportCryptoKeyVersionRequest {
12980 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12981 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
12982 ///
12983 /// The create permission is only required on this key when creating a new
12984 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
12985 ///
12986 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12987 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12988 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12989 pub parent: std::string::String,
12990
12991 /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
12992 /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
12993 /// target for an import operation. If this field is not present, a new
12994 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
12995 /// supplied key material is created.
12996 ///
12997 /// If this field is present, the supplied key material is imported into
12998 /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
12999 /// import into an existing
13000 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
13001 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
13002 /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
13003 /// have been previously created via
13004 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
13005 /// and be in
13006 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
13007 /// or
13008 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
13009 /// state. The key material and algorithm must match the previous
13010 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
13011 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
13012 /// key material.
13013 ///
13014 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13015 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
13016 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
13017 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
13018 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
13019 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
13020 pub crypto_key_version: std::string::String,
13021
13022 /// Required. The
13023 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
13024 /// of the key being imported. This does not need to match the
13025 /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
13026 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
13027 ///
13028 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13029 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
13030 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
13031 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
13032
13033 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
13034 /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
13035 /// material.
13036 ///
13037 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
13038 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
13039 pub import_job: std::string::String,
13040
13041 /// Optional. The wrapped key material to import.
13042 ///
13043 /// Before wrapping, key material must be formatted. If importing symmetric key
13044 /// material, the expected key material format is plain bytes. If importing
13045 /// asymmetric key material, the expected key material format is PKCS#8-encoded
13046 /// DER (the PrivateKeyInfo structure from RFC 5208).
13047 ///
13048 /// When wrapping with import methods
13049 /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
13050 /// or
13051 /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
13052 /// or
13053 /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
13054 /// or
13055 /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
13056 ///
13057 /// this field must contain the concatenation of:
13058 ///
13059 /// This format is the same as the format produced by PKCS#11 mechanism
13060 /// CKM_RSA_AES_KEY_WRAP.
13061 ///
13062 /// When wrapping with import methods
13063 /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
13064 /// or
13065 /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
13066 ///
13067 /// this field must contain the formatted key to be imported, wrapped with the
13068 /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
13069 /// with SHA-256, MGF1 with SHA-256, and an empty label.
13070 ///
13071 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
13072 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
13073 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
13074 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
13075 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
13076 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
13077 /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
13078 pub wrapped_key: ::bytes::Bytes,
13079
13080 /// Optional. Whether trusted wrapping will be enabled on the imported
13081 /// [CryptoKeyVersion]. This field is only supported for keys with
13082 /// [CryptoKeyVersionTemplate.protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
13083 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT].
13084 /// This field is supported for all
13085 /// [CryptoKeyPurposes][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] besides
13086 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
13087 ///
13088 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
13089 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
13090 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13091 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
13092 pub trusted_wrapping_enabled: bool,
13093
13094 /// This field is legacy. Use the field
13095 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
13096 /// instead.
13097 ///
13098 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
13099 pub wrapped_key_material:
13100 std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
13101
13102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13103}
13104
13105impl ImportCryptoKeyVersionRequest {
13106 /// Creates a new default instance.
13107 pub fn new() -> Self {
13108 std::default::Default::default()
13109 }
13110
13111 /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
13112 ///
13113 /// # Example
13114 /// ```ignore,no_run
13115 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13116 /// # let project_id = "project_id";
13117 /// # let location_id = "location_id";
13118 /// # let key_ring_id = "key_ring_id";
13119 /// # let crypto_key_id = "crypto_key_id";
13120 /// let x = ImportCryptoKeyVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
13121 /// ```
13122 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13123 self.parent = v.into();
13124 self
13125 }
13126
13127 /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
13128 ///
13129 /// # Example
13130 /// ```ignore,no_run
13131 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13132 /// # let project_id = "project_id";
13133 /// # let location_id = "location_id";
13134 /// # let key_ring_id = "key_ring_id";
13135 /// # let crypto_key_id = "crypto_key_id";
13136 /// # let crypto_key_version_id = "crypto_key_version_id";
13137 /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
13138 /// ```
13139 pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
13140 mut self,
13141 v: T,
13142 ) -> Self {
13143 self.crypto_key_version = v.into();
13144 self
13145 }
13146
13147 /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
13148 ///
13149 /// # Example
13150 /// ```ignore,no_run
13151 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13152 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
13153 /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
13154 /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
13155 /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
13156 /// ```
13157 pub fn set_algorithm<
13158 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
13159 >(
13160 mut self,
13161 v: T,
13162 ) -> Self {
13163 self.algorithm = v.into();
13164 self
13165 }
13166
13167 /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
13168 ///
13169 /// # Example
13170 /// ```ignore,no_run
13171 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13172 /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
13173 /// ```
13174 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13175 self.import_job = v.into();
13176 self
13177 }
13178
13179 /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
13180 ///
13181 /// # Example
13182 /// ```ignore,no_run
13183 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13184 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
13185 /// ```
13186 pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13187 self.wrapped_key = v.into();
13188 self
13189 }
13190
13191 /// Sets the value of [trusted_wrapping_enabled][crate::model::ImportCryptoKeyVersionRequest::trusted_wrapping_enabled].
13192 ///
13193 /// # Example
13194 /// ```ignore,no_run
13195 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13196 /// let x = ImportCryptoKeyVersionRequest::new().set_trusted_wrapping_enabled(true);
13197 /// ```
13198 pub fn set_trusted_wrapping_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13199 self.trusted_wrapping_enabled = v.into();
13200 self
13201 }
13202
13203 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
13204 ///
13205 /// Note that all the setters affecting `wrapped_key_material` are mutually
13206 /// exclusive.
13207 ///
13208 /// # Example
13209 /// ```ignore,no_run
13210 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13211 /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
13212 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
13213 /// ```
13214 pub fn set_wrapped_key_material<
13215 T: std::convert::Into<
13216 std::option::Option<
13217 crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
13218 >,
13219 >,
13220 >(
13221 mut self,
13222 v: T,
13223 ) -> Self {
13224 self.wrapped_key_material = v.into();
13225 self
13226 }
13227
13228 /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
13229 /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
13230 /// holds a different branch.
13231 pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
13232 #[allow(unreachable_patterns)]
13233 self.wrapped_key_material.as_ref().and_then(|v| match v {
13234 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
13235 _ => std::option::Option::None,
13236 })
13237 }
13238
13239 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
13240 /// to hold a `RsaAesWrappedKey`.
13241 ///
13242 /// Note that all the setters affecting `wrapped_key_material` are
13243 /// mutually exclusive.
13244 ///
13245 /// # Example
13246 /// ```ignore,no_run
13247 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
13248 /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
13249 /// assert!(x.rsa_aes_wrapped_key().is_some());
13250 /// ```
13251 pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13252 self.wrapped_key_material = std::option::Option::Some(
13253 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
13254 v.into(),
13255 ),
13256 );
13257 self
13258 }
13259}
13260
13261impl wkt::message::Message for ImportCryptoKeyVersionRequest {
13262 fn typename() -> &'static str {
13263 "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
13264 }
13265}
13266
13267/// Defines additional types related to [ImportCryptoKeyVersionRequest].
13268pub mod import_crypto_key_version_request {
13269 #[allow(unused_imports)]
13270 use super::*;
13271
13272 /// This field is legacy. Use the field
13273 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
13274 /// instead.
13275 ///
13276 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
13277 #[derive(Clone, Debug, PartialEq)]
13278 #[non_exhaustive]
13279 pub enum WrappedKeyMaterial {
13280 /// Optional. This field has the same meaning as
13281 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
13282 /// Prefer to use that field in new work. Either that field or this field
13283 /// (but not both) must be specified.
13284 ///
13285 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
13286 RsaAesWrappedKey(::bytes::Bytes),
13287 }
13288}
13289
13290/// Request message for
13291/// [KeyManagementService.ImportTrustedKeyWrappedCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportTrustedKeyWrappedCryptoKeyVersion].
13292///
13293/// [google.cloud.kms.v1.KeyManagementService.ImportTrustedKeyWrappedCryptoKeyVersion]: crate::client::KeyManagementService::import_trusted_key_wrapped_crypto_key_version
13294#[derive(Clone, Default, PartialEq)]
13295#[non_exhaustive]
13296pub struct ImportTrustedKeyWrappedCryptoKeyVersionRequest {
13297 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
13298 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
13299 ///
13300 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13301 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
13302 pub parent: std::string::String,
13303
13304 /// Required. Required - the CKV of the trusted key used to import.
13305 /// This can be the name of a CryptoKeyVersion or a CryptoKey.
13306 pub importing_key: std::string::String,
13307
13308 /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
13309 /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
13310 /// target for an import operation. If this field is not present, a new
13311 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
13312 /// supplied key material is created.
13313 ///
13314 /// If this field is present, the supplied key material is imported into
13315 /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
13316 /// import into an existing
13317 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
13318 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
13319 /// [ImportTrustedKeyWrappedCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportTrustedKeyWrappedCryptoKeyVersionRequest.parent],
13320 /// have been previously created via
13321 /// [ImportTrustedKeyWrappedCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportTrustedKeyWrappedCryptoKeyVersion],
13322 /// and be in
13323 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
13324 /// or
13325 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
13326 /// state. The key material and algorithm must match the previous
13327 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
13328 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
13329 /// key material
13330 ///
13331 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13332 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
13333 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
13334 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
13335 /// [google.cloud.kms.v1.ImportTrustedKeyWrappedCryptoKeyVersionRequest.parent]: crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::parent
13336 /// [google.cloud.kms.v1.KeyManagementService.ImportTrustedKeyWrappedCryptoKeyVersion]: crate::client::KeyManagementService::import_trusted_key_wrapped_crypto_key_version
13337 pub crypto_key_version: std::string::String,
13338
13339 /// Required. The target key pre-wrapped on premises.
13340 pub wrapped_key: ::bytes::Bytes,
13341
13342 /// Required. Required - The
13343 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
13344 /// of the key being imported. This does not need to match the
13345 /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
13346 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
13347 ///
13348 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13349 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
13350 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
13351 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
13352
13353 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13354}
13355
13356impl ImportTrustedKeyWrappedCryptoKeyVersionRequest {
13357 /// Creates a new default instance.
13358 pub fn new() -> Self {
13359 std::default::Default::default()
13360 }
13361
13362 /// Sets the value of [parent][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::parent].
13363 ///
13364 /// # Example
13365 /// ```ignore,no_run
13366 /// # use google_cloud_kms_v1::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest;
13367 /// let x = ImportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_parent("example");
13368 /// ```
13369 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13370 self.parent = v.into();
13371 self
13372 }
13373
13374 /// Sets the value of [importing_key][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::importing_key].
13375 ///
13376 /// # Example
13377 /// ```ignore,no_run
13378 /// # use google_cloud_kms_v1::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest;
13379 /// let x = ImportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_importing_key("example");
13380 /// ```
13381 pub fn set_importing_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13382 self.importing_key = v.into();
13383 self
13384 }
13385
13386 /// Sets the value of [crypto_key_version][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::crypto_key_version].
13387 ///
13388 /// # Example
13389 /// ```ignore,no_run
13390 /// # use google_cloud_kms_v1::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest;
13391 /// let x = ImportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_crypto_key_version("example");
13392 /// ```
13393 pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
13394 mut self,
13395 v: T,
13396 ) -> Self {
13397 self.crypto_key_version = v.into();
13398 self
13399 }
13400
13401 /// Sets the value of [wrapped_key][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::wrapped_key].
13402 ///
13403 /// # Example
13404 /// ```ignore,no_run
13405 /// # use google_cloud_kms_v1::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest;
13406 /// let x = ImportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
13407 /// ```
13408 pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13409 self.wrapped_key = v.into();
13410 self
13411 }
13412
13413 /// Sets the value of [algorithm][crate::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest::algorithm].
13414 ///
13415 /// # Example
13416 /// ```ignore,no_run
13417 /// # use google_cloud_kms_v1::model::ImportTrustedKeyWrappedCryptoKeyVersionRequest;
13418 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
13419 /// let x0 = ImportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
13420 /// let x1 = ImportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
13421 /// let x2 = ImportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
13422 /// ```
13423 pub fn set_algorithm<
13424 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
13425 >(
13426 mut self,
13427 v: T,
13428 ) -> Self {
13429 self.algorithm = v.into();
13430 self
13431 }
13432}
13433
13434impl wkt::message::Message for ImportTrustedKeyWrappedCryptoKeyVersionRequest {
13435 fn typename() -> &'static str {
13436 "type.googleapis.com/google.cloud.kms.v1.ImportTrustedKeyWrappedCryptoKeyVersionRequest"
13437 }
13438}
13439
13440/// Request message for
13441/// [KeyManagementService.ExportTrustedKeyWrappedCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ExportTrustedKeyWrappedCryptoKeyVersion].
13442///
13443/// [google.cloud.kms.v1.KeyManagementService.ExportTrustedKeyWrappedCryptoKeyVersion]: crate::client::KeyManagementService::export_trusted_key_wrapped_crypto_key_version
13444#[derive(Clone, Default, PartialEq)]
13445#[non_exhaustive]
13446pub struct ExportTrustedKeyWrappedCryptoKeyVersionRequest {
13447 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
13448 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to export. The
13449 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must have
13450 /// [trusted_wrapping_enabled][google.cloud.kms.v1.CryptoKeyVersion.trusted_wrapping_enabled]
13451 /// set to true.
13452 ///
13453 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13454 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
13455 /// [google.cloud.kms.v1.CryptoKeyVersion.trusted_wrapping_enabled]: crate::model::CryptoKeyVersion::trusted_wrapping_enabled
13456 pub name: std::string::String,
13457
13458 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
13459 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as a
13460 /// wrapping key. The [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
13461 /// must have [hsm_trusted][google.cloud.kms.v1.CryptoKeyVersion.hsm_trusted]
13462 /// set to true.
13463 ///
13464 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13465 /// [google.cloud.kms.v1.CryptoKeyVersion.hsm_trusted]: crate::model::CryptoKeyVersion::hsm_trusted
13466 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
13467 pub wrapping_key: std::string::String,
13468
13469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13470}
13471
13472impl ExportTrustedKeyWrappedCryptoKeyVersionRequest {
13473 /// Creates a new default instance.
13474 pub fn new() -> Self {
13475 std::default::Default::default()
13476 }
13477
13478 /// Sets the value of [name][crate::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest::name].
13479 ///
13480 /// # Example
13481 /// ```ignore,no_run
13482 /// # use google_cloud_kms_v1::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest;
13483 /// # let project_id = "project_id";
13484 /// # let location_id = "location_id";
13485 /// # let key_ring_id = "key_ring_id";
13486 /// # let crypto_key_id = "crypto_key_id";
13487 /// # let crypto_key_version_id = "crypto_key_version_id";
13488 /// let x = ExportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
13489 /// ```
13490 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13491 self.name = v.into();
13492 self
13493 }
13494
13495 /// Sets the value of [wrapping_key][crate::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest::wrapping_key].
13496 ///
13497 /// # Example
13498 /// ```ignore,no_run
13499 /// # use google_cloud_kms_v1::model::ExportTrustedKeyWrappedCryptoKeyVersionRequest;
13500 /// # let project_id = "project_id";
13501 /// # let location_id = "location_id";
13502 /// # let key_ring_id = "key_ring_id";
13503 /// # let crypto_key_id = "crypto_key_id";
13504 /// # let crypto_key_version_id = "crypto_key_version_id";
13505 /// let x = ExportTrustedKeyWrappedCryptoKeyVersionRequest::new().set_wrapping_key(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
13506 /// ```
13507 pub fn set_wrapping_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13508 self.wrapping_key = v.into();
13509 self
13510 }
13511}
13512
13513impl wkt::message::Message for ExportTrustedKeyWrappedCryptoKeyVersionRequest {
13514 fn typename() -> &'static str {
13515 "type.googleapis.com/google.cloud.kms.v1.ExportTrustedKeyWrappedCryptoKeyVersionRequest"
13516 }
13517}
13518
13519/// Response message for
13520/// [KeyManagementService.ExportTrustedKeyWrappedCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ExportTrustedKeyWrappedCryptoKeyVersion].
13521///
13522/// [google.cloud.kms.v1.KeyManagementService.ExportTrustedKeyWrappedCryptoKeyVersion]: crate::client::KeyManagementService::export_trusted_key_wrapped_crypto_key_version
13523#[derive(Clone, Default, PartialEq)]
13524#[non_exhaustive]
13525pub struct ExportTrustedKeyWrappedCryptoKeyVersionResponse {
13526 /// The wrapped key material.
13527 pub wrapped_key: ::bytes::Bytes,
13528
13529 /// Integrity verification field. A CRC32C checksum of the returned
13530 /// [ExportTrustedKeyWrappedCryptoKeyVersionResponse.wrapped_key][google.cloud.kms.v1.ExportTrustedKeyWrappedCryptoKeyVersionResponse.wrapped_key].
13531 /// An integrity check of
13532 /// [ExportTrustedKeyWrappedCryptoKeyVersionResponse.wrapped_key][google.cloud.kms.v1.ExportTrustedKeyWrappedCryptoKeyVersionResponse.wrapped_key]
13533 /// can be performed by computing the CRC32C checksum of
13534 /// [ExportTrustedKeyWrappedCryptoKeyVersionResponse.wrapped_key][google.cloud.kms.v1.ExportTrustedKeyWrappedCryptoKeyVersionResponse.wrapped_key]
13535 /// and comparing your results to this field. Discard the response in case of
13536 /// non-matching checksum values, and perform a limited number of retries. A
13537 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13538 /// checksum.
13539 /// Note: This field is defined as int64 for reasons of compatibility across
13540 /// different languages. However, it is a non-negative integer, which will
13541 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13542 /// that support this type.
13543 ///
13544 /// [google.cloud.kms.v1.ExportTrustedKeyWrappedCryptoKeyVersionResponse.wrapped_key]: crate::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse::wrapped_key
13545 pub wrapped_key_crc32c: std::option::Option<wkt::Int64Value>,
13546
13547 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13548}
13549
13550impl ExportTrustedKeyWrappedCryptoKeyVersionResponse {
13551 /// Creates a new default instance.
13552 pub fn new() -> Self {
13553 std::default::Default::default()
13554 }
13555
13556 /// Sets the value of [wrapped_key][crate::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse::wrapped_key].
13557 ///
13558 /// # Example
13559 /// ```ignore,no_run
13560 /// # use google_cloud_kms_v1::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse;
13561 /// let x = ExportTrustedKeyWrappedCryptoKeyVersionResponse::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
13562 /// ```
13563 pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13564 self.wrapped_key = v.into();
13565 self
13566 }
13567
13568 /// Sets the value of [wrapped_key_crc32c][crate::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse::wrapped_key_crc32c].
13569 ///
13570 /// # Example
13571 /// ```ignore,no_run
13572 /// # use google_cloud_kms_v1::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse;
13573 /// use wkt::Int64Value;
13574 /// let x = ExportTrustedKeyWrappedCryptoKeyVersionResponse::new().set_wrapped_key_crc32c(Int64Value::default()/* use setters */);
13575 /// ```
13576 pub fn set_wrapped_key_crc32c<T>(mut self, v: T) -> Self
13577 where
13578 T: std::convert::Into<wkt::Int64Value>,
13579 {
13580 self.wrapped_key_crc32c = std::option::Option::Some(v.into());
13581 self
13582 }
13583
13584 /// Sets or clears the value of [wrapped_key_crc32c][crate::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse::wrapped_key_crc32c].
13585 ///
13586 /// # Example
13587 /// ```ignore,no_run
13588 /// # use google_cloud_kms_v1::model::ExportTrustedKeyWrappedCryptoKeyVersionResponse;
13589 /// use wkt::Int64Value;
13590 /// let x = ExportTrustedKeyWrappedCryptoKeyVersionResponse::new().set_or_clear_wrapped_key_crc32c(Some(Int64Value::default()/* use setters */));
13591 /// let x = ExportTrustedKeyWrappedCryptoKeyVersionResponse::new().set_or_clear_wrapped_key_crc32c(None::<Int64Value>);
13592 /// ```
13593 pub fn set_or_clear_wrapped_key_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13594 where
13595 T: std::convert::Into<wkt::Int64Value>,
13596 {
13597 self.wrapped_key_crc32c = v.map(|x| x.into());
13598 self
13599 }
13600}
13601
13602impl wkt::message::Message for ExportTrustedKeyWrappedCryptoKeyVersionResponse {
13603 fn typename() -> &'static str {
13604 "type.googleapis.com/google.cloud.kms.v1.ExportTrustedKeyWrappedCryptoKeyVersionResponse"
13605 }
13606}
13607
13608/// Request message for
13609/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
13610///
13611/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
13612#[derive(Clone, Default, PartialEq)]
13613#[non_exhaustive]
13614pub struct CreateImportJobRequest {
13615 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
13616 /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
13617 /// [ImportJobs][google.cloud.kms.v1.ImportJob].
13618 ///
13619 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
13620 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
13621 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
13622 pub parent: std::string::String,
13623
13624 /// Required. It must be unique within a KeyRing and match the regular
13625 /// expression `[a-zA-Z0-9_-]{1,63}`
13626 pub import_job_id: std::string::String,
13627
13628 /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
13629 /// values.
13630 ///
13631 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
13632 pub import_job: std::option::Option<crate::model::ImportJob>,
13633
13634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13635}
13636
13637impl CreateImportJobRequest {
13638 /// Creates a new default instance.
13639 pub fn new() -> Self {
13640 std::default::Default::default()
13641 }
13642
13643 /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
13644 ///
13645 /// # Example
13646 /// ```ignore,no_run
13647 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13648 /// # let project_id = "project_id";
13649 /// # let location_id = "location_id";
13650 /// # let key_ring_id = "key_ring_id";
13651 /// let x = CreateImportJobRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
13652 /// ```
13653 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13654 self.parent = v.into();
13655 self
13656 }
13657
13658 /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
13659 ///
13660 /// # Example
13661 /// ```ignore,no_run
13662 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13663 /// let x = CreateImportJobRequest::new().set_import_job_id("example");
13664 /// ```
13665 pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13666 self.import_job_id = v.into();
13667 self
13668 }
13669
13670 /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
13671 ///
13672 /// # Example
13673 /// ```ignore,no_run
13674 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13675 /// use google_cloud_kms_v1::model::ImportJob;
13676 /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
13677 /// ```
13678 pub fn set_import_job<T>(mut self, v: T) -> Self
13679 where
13680 T: std::convert::Into<crate::model::ImportJob>,
13681 {
13682 self.import_job = std::option::Option::Some(v.into());
13683 self
13684 }
13685
13686 /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
13687 ///
13688 /// # Example
13689 /// ```ignore,no_run
13690 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
13691 /// use google_cloud_kms_v1::model::ImportJob;
13692 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
13693 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
13694 /// ```
13695 pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
13696 where
13697 T: std::convert::Into<crate::model::ImportJob>,
13698 {
13699 self.import_job = v.map(|x| x.into());
13700 self
13701 }
13702}
13703
13704impl wkt::message::Message for CreateImportJobRequest {
13705 fn typename() -> &'static str {
13706 "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
13707 }
13708}
13709
13710/// Request message for
13711/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
13712///
13713/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
13714#[derive(Clone, Default, PartialEq)]
13715#[non_exhaustive]
13716pub struct UpdateCryptoKeyRequest {
13717 /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
13718 ///
13719 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13720 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
13721
13722 /// Required. List of fields to be updated in this request.
13723 pub update_mask: std::option::Option<wkt::FieldMask>,
13724
13725 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13726}
13727
13728impl UpdateCryptoKeyRequest {
13729 /// Creates a new default instance.
13730 pub fn new() -> Self {
13731 std::default::Default::default()
13732 }
13733
13734 /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
13735 ///
13736 /// # Example
13737 /// ```ignore,no_run
13738 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13739 /// use google_cloud_kms_v1::model::CryptoKey;
13740 /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
13741 /// ```
13742 pub fn set_crypto_key<T>(mut self, v: T) -> Self
13743 where
13744 T: std::convert::Into<crate::model::CryptoKey>,
13745 {
13746 self.crypto_key = std::option::Option::Some(v.into());
13747 self
13748 }
13749
13750 /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
13751 ///
13752 /// # Example
13753 /// ```ignore,no_run
13754 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13755 /// use google_cloud_kms_v1::model::CryptoKey;
13756 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
13757 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
13758 /// ```
13759 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
13760 where
13761 T: std::convert::Into<crate::model::CryptoKey>,
13762 {
13763 self.crypto_key = v.map(|x| x.into());
13764 self
13765 }
13766
13767 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
13768 ///
13769 /// # Example
13770 /// ```ignore,no_run
13771 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13772 /// use wkt::FieldMask;
13773 /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13774 /// ```
13775 pub fn set_update_mask<T>(mut self, v: T) -> Self
13776 where
13777 T: std::convert::Into<wkt::FieldMask>,
13778 {
13779 self.update_mask = std::option::Option::Some(v.into());
13780 self
13781 }
13782
13783 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
13784 ///
13785 /// # Example
13786 /// ```ignore,no_run
13787 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13788 /// use wkt::FieldMask;
13789 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13790 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13791 /// ```
13792 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13793 where
13794 T: std::convert::Into<wkt::FieldMask>,
13795 {
13796 self.update_mask = v.map(|x| x.into());
13797 self
13798 }
13799}
13800
13801impl wkt::message::Message for UpdateCryptoKeyRequest {
13802 fn typename() -> &'static str {
13803 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
13804 }
13805}
13806
13807/// Request message for
13808/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
13809///
13810/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
13811#[derive(Clone, Default, PartialEq)]
13812#[non_exhaustive]
13813pub struct UpdateCryptoKeyVersionRequest {
13814 /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
13815 /// updated values.
13816 ///
13817 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13818 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
13819
13820 /// Required. List of fields to be updated in this request.
13821 pub update_mask: std::option::Option<wkt::FieldMask>,
13822
13823 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13824}
13825
13826impl UpdateCryptoKeyVersionRequest {
13827 /// Creates a new default instance.
13828 pub fn new() -> Self {
13829 std::default::Default::default()
13830 }
13831
13832 /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
13833 ///
13834 /// # Example
13835 /// ```ignore,no_run
13836 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13837 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
13838 /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
13839 /// ```
13840 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
13841 where
13842 T: std::convert::Into<crate::model::CryptoKeyVersion>,
13843 {
13844 self.crypto_key_version = std::option::Option::Some(v.into());
13845 self
13846 }
13847
13848 /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
13849 ///
13850 /// # Example
13851 /// ```ignore,no_run
13852 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13853 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
13854 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
13855 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
13856 /// ```
13857 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
13858 where
13859 T: std::convert::Into<crate::model::CryptoKeyVersion>,
13860 {
13861 self.crypto_key_version = v.map(|x| x.into());
13862 self
13863 }
13864
13865 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13866 ///
13867 /// # Example
13868 /// ```ignore,no_run
13869 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13870 /// use wkt::FieldMask;
13871 /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13872 /// ```
13873 pub fn set_update_mask<T>(mut self, v: T) -> Self
13874 where
13875 T: std::convert::Into<wkt::FieldMask>,
13876 {
13877 self.update_mask = std::option::Option::Some(v.into());
13878 self
13879 }
13880
13881 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13882 ///
13883 /// # Example
13884 /// ```ignore,no_run
13885 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13886 /// use wkt::FieldMask;
13887 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13888 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13889 /// ```
13890 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13891 where
13892 T: std::convert::Into<wkt::FieldMask>,
13893 {
13894 self.update_mask = v.map(|x| x.into());
13895 self
13896 }
13897}
13898
13899impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
13900 fn typename() -> &'static str {
13901 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
13902 }
13903}
13904
13905/// Request message for
13906/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
13907///
13908/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
13909#[derive(Clone, Default, PartialEq)]
13910#[non_exhaustive]
13911pub struct UpdateCryptoKeyPrimaryVersionRequest {
13912 /// Required. The resource name of the
13913 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
13914 ///
13915 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13916 pub name: std::string::String,
13917
13918 /// Required. The id of the child
13919 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
13920 ///
13921 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13922 pub crypto_key_version_id: std::string::String,
13923
13924 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13925}
13926
13927impl UpdateCryptoKeyPrimaryVersionRequest {
13928 /// Creates a new default instance.
13929 pub fn new() -> Self {
13930 std::default::Default::default()
13931 }
13932
13933 /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
13934 ///
13935 /// # Example
13936 /// ```ignore,no_run
13937 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13938 /// # let project_id = "project_id";
13939 /// # let location_id = "location_id";
13940 /// # let key_ring_id = "key_ring_id";
13941 /// # let crypto_key_id = "crypto_key_id";
13942 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
13943 /// ```
13944 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13945 self.name = v.into();
13946 self
13947 }
13948
13949 /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
13950 ///
13951 /// # Example
13952 /// ```ignore,no_run
13953 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13954 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
13955 /// ```
13956 pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
13957 mut self,
13958 v: T,
13959 ) -> Self {
13960 self.crypto_key_version_id = v.into();
13961 self
13962 }
13963}
13964
13965impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
13966 fn typename() -> &'static str {
13967 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
13968 }
13969}
13970
13971/// Request message for
13972/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
13973///
13974/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
13975#[derive(Clone, Default, PartialEq)]
13976#[non_exhaustive]
13977pub struct DestroyCryptoKeyVersionRequest {
13978 /// Required. The resource name of the
13979 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
13980 ///
13981 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13982 pub name: std::string::String,
13983
13984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13985}
13986
13987impl DestroyCryptoKeyVersionRequest {
13988 /// Creates a new default instance.
13989 pub fn new() -> Self {
13990 std::default::Default::default()
13991 }
13992
13993 /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
13994 ///
13995 /// # Example
13996 /// ```ignore,no_run
13997 /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
13998 /// # let project_id = "project_id";
13999 /// # let location_id = "location_id";
14000 /// # let key_ring_id = "key_ring_id";
14001 /// # let crypto_key_id = "crypto_key_id";
14002 /// # let crypto_key_version_id = "crypto_key_version_id";
14003 /// let x = DestroyCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14004 /// ```
14005 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14006 self.name = v.into();
14007 self
14008 }
14009}
14010
14011impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
14012 fn typename() -> &'static str {
14013 "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
14014 }
14015}
14016
14017/// Request message for
14018/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
14019///
14020/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
14021#[derive(Clone, Default, PartialEq)]
14022#[non_exhaustive]
14023pub struct RestoreCryptoKeyVersionRequest {
14024 /// Required. The resource name of the
14025 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
14026 ///
14027 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14028 pub name: std::string::String,
14029
14030 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14031}
14032
14033impl RestoreCryptoKeyVersionRequest {
14034 /// Creates a new default instance.
14035 pub fn new() -> Self {
14036 std::default::Default::default()
14037 }
14038
14039 /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
14040 ///
14041 /// # Example
14042 /// ```ignore,no_run
14043 /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
14044 /// # let project_id = "project_id";
14045 /// # let location_id = "location_id";
14046 /// # let key_ring_id = "key_ring_id";
14047 /// # let crypto_key_id = "crypto_key_id";
14048 /// # let crypto_key_version_id = "crypto_key_version_id";
14049 /// let x = RestoreCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14050 /// ```
14051 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14052 self.name = v.into();
14053 self
14054 }
14055}
14056
14057impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
14058 fn typename() -> &'static str {
14059 "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
14060 }
14061}
14062
14063/// Request message for
14064/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
14065///
14066/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
14067#[derive(Clone, Default, PartialEq)]
14068#[non_exhaustive]
14069pub struct EncryptRequest {
14070 /// Required. The resource name of the
14071 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
14072 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14073 /// encryption.
14074 ///
14075 /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
14076 /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
14077 ///
14078 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
14079 /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
14080 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14081 pub name: std::string::String,
14082
14083 /// Required. The data to encrypt. Must be no larger than 64KiB.
14084 ///
14085 /// The maximum size depends on the key version's
14086 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
14087 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
14088 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
14089 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
14090 /// plaintext must be no larger than 64KiB. For
14091 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
14092 /// the plaintext and additional_authenticated_data fields must be no larger
14093 /// than 8KiB.
14094 ///
14095 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
14096 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
14097 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
14098 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14099 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
14100 pub plaintext: ::bytes::Bytes,
14101
14102 /// Optional. Optional data that, if specified, must also be provided during
14103 /// decryption through
14104 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
14105 ///
14106 /// The maximum size depends on the key version's
14107 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
14108 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
14109 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
14110 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
14111 /// AAD must be no larger than 64KiB. For
14112 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
14113 /// the plaintext and additional_authenticated_data fields must be no larger
14114 /// than 8KiB.
14115 ///
14116 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
14117 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
14118 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
14119 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
14120 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14121 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
14122 pub additional_authenticated_data: ::bytes::Bytes,
14123
14124 /// Optional. An optional CRC32C checksum of the
14125 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
14126 /// If specified,
14127 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14128 /// verify the integrity of the received
14129 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
14130 /// using this checksum.
14131 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14132 /// report an error if the checksum verification fails. If you receive a
14133 /// checksum error, your client should verify that
14134 /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
14135 /// is equal to
14136 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
14137 /// and if so, perform a limited number of retries. A persistent mismatch may
14138 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14139 /// field is defined as int64 for reasons of compatibility across different
14140 /// languages. However, it is a non-negative integer, which will never exceed
14141 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14142 /// this type.
14143 ///
14144 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
14145 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
14146 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14147 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
14148
14149 /// Optional. An optional CRC32C checksum of the
14150 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
14151 /// If specified,
14152 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14153 /// verify the integrity of the received
14154 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
14155 /// using this checksum.
14156 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14157 /// report an error if the checksum verification fails. If you receive a
14158 /// checksum error, your client should verify that
14159 /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
14160 /// is equal to
14161 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
14162 /// and if so, perform a limited number of retries. A persistent mismatch may
14163 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14164 /// field is defined as int64 for reasons of compatibility across different
14165 /// languages. However, it is a non-negative integer, which will never exceed
14166 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14167 /// this type.
14168 ///
14169 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
14170 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
14171 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14172 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
14173
14174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14175}
14176
14177impl EncryptRequest {
14178 /// Creates a new default instance.
14179 pub fn new() -> Self {
14180 std::default::Default::default()
14181 }
14182
14183 /// Sets the value of [name][crate::model::EncryptRequest::name].
14184 ///
14185 /// # Example
14186 /// ```ignore,no_run
14187 /// # use google_cloud_kms_v1::model::EncryptRequest;
14188 /// let x = EncryptRequest::new().set_name("example");
14189 /// ```
14190 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14191 self.name = v.into();
14192 self
14193 }
14194
14195 /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
14196 ///
14197 /// # Example
14198 /// ```ignore,no_run
14199 /// # use google_cloud_kms_v1::model::EncryptRequest;
14200 /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
14201 /// ```
14202 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14203 self.plaintext = v.into();
14204 self
14205 }
14206
14207 /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
14208 ///
14209 /// # Example
14210 /// ```ignore,no_run
14211 /// # use google_cloud_kms_v1::model::EncryptRequest;
14212 /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14213 /// ```
14214 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14215 mut self,
14216 v: T,
14217 ) -> Self {
14218 self.additional_authenticated_data = v.into();
14219 self
14220 }
14221
14222 /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
14223 ///
14224 /// # Example
14225 /// ```ignore,no_run
14226 /// # use google_cloud_kms_v1::model::EncryptRequest;
14227 /// use wkt::Int64Value;
14228 /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
14229 /// ```
14230 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
14231 where
14232 T: std::convert::Into<wkt::Int64Value>,
14233 {
14234 self.plaintext_crc32c = std::option::Option::Some(v.into());
14235 self
14236 }
14237
14238 /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
14239 ///
14240 /// # Example
14241 /// ```ignore,no_run
14242 /// # use google_cloud_kms_v1::model::EncryptRequest;
14243 /// use wkt::Int64Value;
14244 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
14245 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
14246 /// ```
14247 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14248 where
14249 T: std::convert::Into<wkt::Int64Value>,
14250 {
14251 self.plaintext_crc32c = v.map(|x| x.into());
14252 self
14253 }
14254
14255 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
14256 ///
14257 /// # Example
14258 /// ```ignore,no_run
14259 /// # use google_cloud_kms_v1::model::EncryptRequest;
14260 /// use wkt::Int64Value;
14261 /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14262 /// ```
14263 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14264 where
14265 T: std::convert::Into<wkt::Int64Value>,
14266 {
14267 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14268 self
14269 }
14270
14271 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
14272 ///
14273 /// # Example
14274 /// ```ignore,no_run
14275 /// # use google_cloud_kms_v1::model::EncryptRequest;
14276 /// use wkt::Int64Value;
14277 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14278 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14279 /// ```
14280 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14281 mut self,
14282 v: std::option::Option<T>,
14283 ) -> Self
14284 where
14285 T: std::convert::Into<wkt::Int64Value>,
14286 {
14287 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14288 self
14289 }
14290}
14291
14292impl wkt::message::Message for EncryptRequest {
14293 fn typename() -> &'static str {
14294 "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
14295 }
14296}
14297
14298/// Request message for
14299/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
14300///
14301/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
14302#[derive(Clone, Default, PartialEq)]
14303#[non_exhaustive]
14304pub struct DecryptRequest {
14305 /// Required. The resource name of the
14306 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
14307 /// server will choose the appropriate version.
14308 ///
14309 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
14310 pub name: std::string::String,
14311
14312 /// Required. The encrypted data originally returned in
14313 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
14314 ///
14315 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
14316 pub ciphertext: ::bytes::Bytes,
14317
14318 /// Optional. Optional data that must match the data originally supplied in
14319 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
14320 ///
14321 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
14322 pub additional_authenticated_data: ::bytes::Bytes,
14323
14324 /// Optional. An optional CRC32C checksum of the
14325 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
14326 /// If specified,
14327 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14328 /// verify the integrity of the received
14329 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
14330 /// using this checksum.
14331 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14332 /// report an error if the checksum verification fails. If you receive a
14333 /// checksum error, your client should verify that
14334 /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
14335 /// is equal to
14336 /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
14337 /// and if so, perform a limited number of retries. A persistent mismatch may
14338 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14339 /// field is defined as int64 for reasons of compatibility across different
14340 /// languages. However, it is a non-negative integer, which will never exceed
14341 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14342 /// this type.
14343 ///
14344 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
14345 /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
14346 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14347 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14348
14349 /// Optional. An optional CRC32C checksum of the
14350 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
14351 /// If specified,
14352 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14353 /// verify the integrity of the received
14354 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
14355 /// using this checksum.
14356 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14357 /// report an error if the checksum verification fails. If you receive a
14358 /// checksum error, your client should verify that
14359 /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
14360 /// is equal to
14361 /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
14362 /// and if so, perform a limited number of retries. A persistent mismatch may
14363 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14364 /// field is defined as int64 for reasons of compatibility across different
14365 /// languages. However, it is a non-negative integer, which will never exceed
14366 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14367 /// this type.
14368 ///
14369 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
14370 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
14371 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14372 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
14373
14374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14375}
14376
14377impl DecryptRequest {
14378 /// Creates a new default instance.
14379 pub fn new() -> Self {
14380 std::default::Default::default()
14381 }
14382
14383 /// Sets the value of [name][crate::model::DecryptRequest::name].
14384 ///
14385 /// # Example
14386 /// ```ignore,no_run
14387 /// # use google_cloud_kms_v1::model::DecryptRequest;
14388 /// # let project_id = "project_id";
14389 /// # let location_id = "location_id";
14390 /// # let key_ring_id = "key_ring_id";
14391 /// # let crypto_key_id = "crypto_key_id";
14392 /// let x = DecryptRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
14393 /// ```
14394 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14395 self.name = v.into();
14396 self
14397 }
14398
14399 /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
14400 ///
14401 /// # Example
14402 /// ```ignore,no_run
14403 /// # use google_cloud_kms_v1::model::DecryptRequest;
14404 /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14405 /// ```
14406 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14407 self.ciphertext = v.into();
14408 self
14409 }
14410
14411 /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
14412 ///
14413 /// # Example
14414 /// ```ignore,no_run
14415 /// # use google_cloud_kms_v1::model::DecryptRequest;
14416 /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14417 /// ```
14418 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14419 mut self,
14420 v: T,
14421 ) -> Self {
14422 self.additional_authenticated_data = v.into();
14423 self
14424 }
14425
14426 /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
14427 ///
14428 /// # Example
14429 /// ```ignore,no_run
14430 /// # use google_cloud_kms_v1::model::DecryptRequest;
14431 /// use wkt::Int64Value;
14432 /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14433 /// ```
14434 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14435 where
14436 T: std::convert::Into<wkt::Int64Value>,
14437 {
14438 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14439 self
14440 }
14441
14442 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
14443 ///
14444 /// # Example
14445 /// ```ignore,no_run
14446 /// # use google_cloud_kms_v1::model::DecryptRequest;
14447 /// use wkt::Int64Value;
14448 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14449 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14450 /// ```
14451 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14452 where
14453 T: std::convert::Into<wkt::Int64Value>,
14454 {
14455 self.ciphertext_crc32c = v.map(|x| x.into());
14456 self
14457 }
14458
14459 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
14460 ///
14461 /// # Example
14462 /// ```ignore,no_run
14463 /// # use google_cloud_kms_v1::model::DecryptRequest;
14464 /// use wkt::Int64Value;
14465 /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14466 /// ```
14467 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14468 where
14469 T: std::convert::Into<wkt::Int64Value>,
14470 {
14471 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14472 self
14473 }
14474
14475 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
14476 ///
14477 /// # Example
14478 /// ```ignore,no_run
14479 /// # use google_cloud_kms_v1::model::DecryptRequest;
14480 /// use wkt::Int64Value;
14481 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14482 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14483 /// ```
14484 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14485 mut self,
14486 v: std::option::Option<T>,
14487 ) -> Self
14488 where
14489 T: std::convert::Into<wkt::Int64Value>,
14490 {
14491 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14492 self
14493 }
14494}
14495
14496impl wkt::message::Message for DecryptRequest {
14497 fn typename() -> &'static str {
14498 "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
14499 }
14500}
14501
14502/// Request message for
14503/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
14504///
14505/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
14506#[derive(Clone, Default, PartialEq)]
14507#[non_exhaustive]
14508pub struct RawEncryptRequest {
14509 /// Required. The resource name of the
14510 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14511 /// encryption.
14512 ///
14513 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14514 pub name: std::string::String,
14515
14516 /// Required. The data to encrypt. Must be no larger than 64KiB.
14517 ///
14518 /// The maximum size depends on the key version's
14519 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
14520 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
14521 /// plaintext must be no larger than 64KiB. For
14522 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
14523 /// the plaintext and additional_authenticated_data fields must be no larger
14524 /// than 8KiB.
14525 ///
14526 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
14527 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14528 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
14529 pub plaintext: ::bytes::Bytes,
14530
14531 /// Optional. Optional data that, if specified, must also be provided during
14532 /// decryption through
14533 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
14534 ///
14535 /// This field may only be used in conjunction with an
14536 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
14537 /// additional authenticated data (for example, AES-GCM).
14538 ///
14539 /// The maximum size depends on the key version's
14540 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
14541 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
14542 /// plaintext must be no larger than 64KiB. For
14543 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
14544 /// the plaintext and additional_authenticated_data fields must be no larger
14545 /// than 8KiB.
14546 ///
14547 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
14548 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
14549 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14550 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
14551 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
14552 pub additional_authenticated_data: ::bytes::Bytes,
14553
14554 /// Optional. An optional CRC32C checksum of the
14555 /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
14556 /// If specified,
14557 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14558 /// verify the integrity of the received plaintext using this checksum.
14559 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14560 /// report an error if the checksum verification fails. If you receive a
14561 /// checksum error, your client should verify that CRC32C(plaintext) is equal
14562 /// to plaintext_crc32c, and if so, perform a limited number of retries. A
14563 /// persistent mismatch may indicate an issue in your computation of the CRC32C
14564 /// checksum. Note: This field is defined as int64 for reasons of compatibility
14565 /// across different languages. However, it is a non-negative integer, which
14566 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14567 /// languages that support this type.
14568 ///
14569 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14570 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
14571 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
14572
14573 /// Optional. An optional CRC32C checksum of the
14574 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
14575 /// If specified,
14576 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14577 /// verify the integrity of the received additional_authenticated_data using
14578 /// this checksum.
14579 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14580 /// report an error if the checksum verification fails. If you receive a
14581 /// checksum error, your client should verify that
14582 /// CRC32C(additional_authenticated_data) is equal to
14583 /// additional_authenticated_data_crc32c, and if so, perform
14584 /// a limited number of retries. A persistent mismatch may indicate an issue in
14585 /// your computation of the CRC32C checksum.
14586 /// Note: This field is defined as int64 for reasons of compatibility across
14587 /// different languages. However, it is a non-negative integer, which will
14588 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14589 /// that support this type.
14590 ///
14591 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14592 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
14593 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
14594
14595 /// Optional. A customer-supplied initialization vector that will be used for
14596 /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
14597 /// generated. It will be returned in
14598 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
14599 ///
14600 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
14601 pub initialization_vector: ::bytes::Bytes,
14602
14603 /// Optional. An optional CRC32C checksum of the
14604 /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
14605 /// If specified,
14606 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14607 /// verify the integrity of the received initialization_vector using this
14608 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14609 /// will report an error if the checksum verification fails. If you receive a
14610 /// checksum error, your client should verify that
14611 /// CRC32C(initialization_vector) is equal to
14612 /// initialization_vector_crc32c, and if so, perform
14613 /// a limited number of retries. A persistent mismatch may indicate an issue in
14614 /// your computation of the CRC32C checksum.
14615 /// Note: This field is defined as int64 for reasons of compatibility across
14616 /// different languages. However, it is a non-negative integer, which will
14617 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14618 /// that support this type.
14619 ///
14620 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14621 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
14622 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
14623
14624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14625}
14626
14627impl RawEncryptRequest {
14628 /// Creates a new default instance.
14629 pub fn new() -> Self {
14630 std::default::Default::default()
14631 }
14632
14633 /// Sets the value of [name][crate::model::RawEncryptRequest::name].
14634 ///
14635 /// # Example
14636 /// ```ignore,no_run
14637 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14638 /// let x = RawEncryptRequest::new().set_name("example");
14639 /// ```
14640 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14641 self.name = v.into();
14642 self
14643 }
14644
14645 /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
14646 ///
14647 /// # Example
14648 /// ```ignore,no_run
14649 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14650 /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
14651 /// ```
14652 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14653 self.plaintext = v.into();
14654 self
14655 }
14656
14657 /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
14658 ///
14659 /// # Example
14660 /// ```ignore,no_run
14661 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14662 /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14663 /// ```
14664 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14665 mut self,
14666 v: T,
14667 ) -> Self {
14668 self.additional_authenticated_data = v.into();
14669 self
14670 }
14671
14672 /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
14673 ///
14674 /// # Example
14675 /// ```ignore,no_run
14676 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14677 /// use wkt::Int64Value;
14678 /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
14679 /// ```
14680 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
14681 where
14682 T: std::convert::Into<wkt::Int64Value>,
14683 {
14684 self.plaintext_crc32c = std::option::Option::Some(v.into());
14685 self
14686 }
14687
14688 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
14689 ///
14690 /// # Example
14691 /// ```ignore,no_run
14692 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14693 /// use wkt::Int64Value;
14694 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
14695 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
14696 /// ```
14697 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14698 where
14699 T: std::convert::Into<wkt::Int64Value>,
14700 {
14701 self.plaintext_crc32c = v.map(|x| x.into());
14702 self
14703 }
14704
14705 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
14706 ///
14707 /// # Example
14708 /// ```ignore,no_run
14709 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14710 /// use wkt::Int64Value;
14711 /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14712 /// ```
14713 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14714 where
14715 T: std::convert::Into<wkt::Int64Value>,
14716 {
14717 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14718 self
14719 }
14720
14721 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
14722 ///
14723 /// # Example
14724 /// ```ignore,no_run
14725 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14726 /// use wkt::Int64Value;
14727 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14728 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14729 /// ```
14730 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14731 mut self,
14732 v: std::option::Option<T>,
14733 ) -> Self
14734 where
14735 T: std::convert::Into<wkt::Int64Value>,
14736 {
14737 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14738 self
14739 }
14740
14741 /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
14742 ///
14743 /// # Example
14744 /// ```ignore,no_run
14745 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14746 /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14747 /// ```
14748 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14749 mut self,
14750 v: T,
14751 ) -> Self {
14752 self.initialization_vector = v.into();
14753 self
14754 }
14755
14756 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
14757 ///
14758 /// # Example
14759 /// ```ignore,no_run
14760 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14761 /// use wkt::Int64Value;
14762 /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14763 /// ```
14764 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14765 where
14766 T: std::convert::Into<wkt::Int64Value>,
14767 {
14768 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14769 self
14770 }
14771
14772 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
14773 ///
14774 /// # Example
14775 /// ```ignore,no_run
14776 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14777 /// use wkt::Int64Value;
14778 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14779 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14780 /// ```
14781 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14782 where
14783 T: std::convert::Into<wkt::Int64Value>,
14784 {
14785 self.initialization_vector_crc32c = v.map(|x| x.into());
14786 self
14787 }
14788}
14789
14790impl wkt::message::Message for RawEncryptRequest {
14791 fn typename() -> &'static str {
14792 "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
14793 }
14794}
14795
14796/// Request message for
14797/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
14798///
14799/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
14800#[derive(Clone, Default, PartialEq)]
14801#[non_exhaustive]
14802pub struct RawDecryptRequest {
14803 /// Required. The resource name of the
14804 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14805 /// decryption.
14806 ///
14807 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14808 pub name: std::string::String,
14809
14810 /// Required. The encrypted data originally returned in
14811 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
14812 ///
14813 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
14814 pub ciphertext: ::bytes::Bytes,
14815
14816 /// Optional. Optional data that must match the data originally supplied in
14817 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
14818 ///
14819 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
14820 pub additional_authenticated_data: ::bytes::Bytes,
14821
14822 /// Required. The initialization vector (IV) used during encryption, which must
14823 /// match the data originally provided in
14824 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
14825 ///
14826 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
14827 pub initialization_vector: ::bytes::Bytes,
14828
14829 /// The length of the authentication tag that is appended to the end of
14830 /// the ciphertext. If unspecified (0), the default value for the key's
14831 /// algorithm will be used (for AES-GCM, the default value is 16).
14832 pub tag_length: i32,
14833
14834 /// Optional. An optional CRC32C checksum of the
14835 /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
14836 /// If specified,
14837 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14838 /// verify the integrity of the received ciphertext using this checksum.
14839 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14840 /// report an error if the checksum verification fails. If you receive a
14841 /// checksum error, your client should verify that CRC32C(ciphertext) is equal
14842 /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
14843 /// persistent mismatch may indicate an issue in your computation of the CRC32C
14844 /// checksum. Note: This field is defined as int64 for reasons of compatibility
14845 /// across different languages. However, it is a non-negative integer, which
14846 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14847 /// languages that support this type.
14848 ///
14849 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14850 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
14851 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14852
14853 /// Optional. An optional CRC32C checksum of the
14854 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
14855 /// If specified,
14856 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14857 /// verify the integrity of the received additional_authenticated_data using
14858 /// this checksum.
14859 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14860 /// report an error if the checksum verification fails. If you receive a
14861 /// checksum error, your client should verify that
14862 /// CRC32C(additional_authenticated_data) is equal to
14863 /// additional_authenticated_data_crc32c, and if so, perform
14864 /// a limited number of retries. A persistent mismatch may indicate an issue in
14865 /// your computation of the CRC32C checksum.
14866 /// Note: This field is defined as int64 for reasons of compatibility across
14867 /// different languages. However, it is a non-negative integer, which will
14868 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14869 /// that support this type.
14870 ///
14871 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14872 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
14873 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
14874
14875 /// Optional. An optional CRC32C checksum of the
14876 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
14877 /// If specified,
14878 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14879 /// verify the integrity of the received initialization_vector using this
14880 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14881 /// will report an error if the checksum verification fails. If you receive a
14882 /// checksum error, your client should verify that
14883 /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
14884 /// if so, perform a limited number of retries. A persistent mismatch may
14885 /// indicate an issue in your computation of the CRC32C checksum.
14886 /// Note: This field is defined as int64 for reasons of compatibility across
14887 /// different languages. However, it is a non-negative integer, which will
14888 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14889 /// that support this type.
14890 ///
14891 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14892 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
14893 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
14894
14895 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14896}
14897
14898impl RawDecryptRequest {
14899 /// Creates a new default instance.
14900 pub fn new() -> Self {
14901 std::default::Default::default()
14902 }
14903
14904 /// Sets the value of [name][crate::model::RawDecryptRequest::name].
14905 ///
14906 /// # Example
14907 /// ```ignore,no_run
14908 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14909 /// let x = RawDecryptRequest::new().set_name("example");
14910 /// ```
14911 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14912 self.name = v.into();
14913 self
14914 }
14915
14916 /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
14917 ///
14918 /// # Example
14919 /// ```ignore,no_run
14920 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14921 /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14922 /// ```
14923 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14924 self.ciphertext = v.into();
14925 self
14926 }
14927
14928 /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
14929 ///
14930 /// # Example
14931 /// ```ignore,no_run
14932 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14933 /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14934 /// ```
14935 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14936 mut self,
14937 v: T,
14938 ) -> Self {
14939 self.additional_authenticated_data = v.into();
14940 self
14941 }
14942
14943 /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
14944 ///
14945 /// # Example
14946 /// ```ignore,no_run
14947 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14948 /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14949 /// ```
14950 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14951 mut self,
14952 v: T,
14953 ) -> Self {
14954 self.initialization_vector = v.into();
14955 self
14956 }
14957
14958 /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
14959 ///
14960 /// # Example
14961 /// ```ignore,no_run
14962 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14963 /// let x = RawDecryptRequest::new().set_tag_length(42);
14964 /// ```
14965 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14966 self.tag_length = v.into();
14967 self
14968 }
14969
14970 /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14971 ///
14972 /// # Example
14973 /// ```ignore,no_run
14974 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14975 /// use wkt::Int64Value;
14976 /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14977 /// ```
14978 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14979 where
14980 T: std::convert::Into<wkt::Int64Value>,
14981 {
14982 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14983 self
14984 }
14985
14986 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14987 ///
14988 /// # Example
14989 /// ```ignore,no_run
14990 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14991 /// use wkt::Int64Value;
14992 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14993 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14994 /// ```
14995 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14996 where
14997 T: std::convert::Into<wkt::Int64Value>,
14998 {
14999 self.ciphertext_crc32c = v.map(|x| x.into());
15000 self
15001 }
15002
15003 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
15004 ///
15005 /// # Example
15006 /// ```ignore,no_run
15007 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
15008 /// use wkt::Int64Value;
15009 /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
15010 /// ```
15011 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
15012 where
15013 T: std::convert::Into<wkt::Int64Value>,
15014 {
15015 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
15016 self
15017 }
15018
15019 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
15020 ///
15021 /// # Example
15022 /// ```ignore,no_run
15023 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
15024 /// use wkt::Int64Value;
15025 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
15026 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
15027 /// ```
15028 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
15029 mut self,
15030 v: std::option::Option<T>,
15031 ) -> Self
15032 where
15033 T: std::convert::Into<wkt::Int64Value>,
15034 {
15035 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
15036 self
15037 }
15038
15039 /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
15040 ///
15041 /// # Example
15042 /// ```ignore,no_run
15043 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
15044 /// use wkt::Int64Value;
15045 /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
15046 /// ```
15047 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
15048 where
15049 T: std::convert::Into<wkt::Int64Value>,
15050 {
15051 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
15052 self
15053 }
15054
15055 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
15056 ///
15057 /// # Example
15058 /// ```ignore,no_run
15059 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
15060 /// use wkt::Int64Value;
15061 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
15062 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
15063 /// ```
15064 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15065 where
15066 T: std::convert::Into<wkt::Int64Value>,
15067 {
15068 self.initialization_vector_crc32c = v.map(|x| x.into());
15069 self
15070 }
15071}
15072
15073impl wkt::message::Message for RawDecryptRequest {
15074 fn typename() -> &'static str {
15075 "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
15076 }
15077}
15078
15079/// Request message for
15080/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
15081///
15082/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
15083#[derive(Clone, Default, PartialEq)]
15084#[non_exhaustive]
15085pub struct AsymmetricSignRequest {
15086 /// Required. The resource name of the
15087 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
15088 /// signing.
15089 ///
15090 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15091 pub name: std::string::String,
15092
15093 /// Optional. The digest of the data to sign. The digest must be produced with
15094 /// the same digest algorithm as specified by the key version's
15095 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
15096 ///
15097 /// This field may not be supplied if
15098 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
15099 /// is supplied.
15100 ///
15101 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
15102 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
15103 pub digest: std::option::Option<crate::model::Digest>,
15104
15105 /// Optional. An optional CRC32C checksum of the
15106 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
15107 /// If specified,
15108 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15109 /// verify the integrity of the received
15110 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
15111 /// using this checksum.
15112 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15113 /// report an error if the checksum verification fails. If you receive a
15114 /// checksum error, your client should verify that
15115 /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
15116 /// is equal to
15117 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
15118 /// and if so, perform a limited number of retries. A persistent mismatch may
15119 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15120 /// field is defined as int64 for reasons of compatibility across different
15121 /// languages. However, it is a non-negative integer, which will never exceed
15122 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15123 /// this type.
15124 ///
15125 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
15126 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
15127 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15128 pub digest_crc32c: std::option::Option<wkt::Int64Value>,
15129
15130 /// Optional. The data to sign.
15131 /// It can't be supplied if
15132 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
15133 /// is supplied.
15134 ///
15135 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
15136 pub data: ::bytes::Bytes,
15137
15138 /// Optional. An optional CRC32C checksum of the
15139 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
15140 /// If specified,
15141 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15142 /// verify the integrity of the received
15143 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
15144 /// using this checksum.
15145 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15146 /// report an error if the checksum verification fails. If you receive a
15147 /// checksum error, your client should verify that
15148 /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
15149 /// is equal to
15150 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
15151 /// and if so, perform a limited number of retries. A persistent mismatch may
15152 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15153 /// field is defined as int64 for reasons of compatibility across different
15154 /// languages. However, it is a non-negative integer, which will never exceed
15155 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15156 /// this type.
15157 ///
15158 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
15159 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
15160 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15161 pub data_crc32c: std::option::Option<wkt::Int64Value>,
15162
15163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15164}
15165
15166impl AsymmetricSignRequest {
15167 /// Creates a new default instance.
15168 pub fn new() -> Self {
15169 std::default::Default::default()
15170 }
15171
15172 /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
15173 ///
15174 /// # Example
15175 /// ```ignore,no_run
15176 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15177 /// # let project_id = "project_id";
15178 /// # let location_id = "location_id";
15179 /// # let key_ring_id = "key_ring_id";
15180 /// # let crypto_key_id = "crypto_key_id";
15181 /// # let crypto_key_version_id = "crypto_key_version_id";
15182 /// let x = AsymmetricSignRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15183 /// ```
15184 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15185 self.name = v.into();
15186 self
15187 }
15188
15189 /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
15190 ///
15191 /// # Example
15192 /// ```ignore,no_run
15193 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15194 /// use google_cloud_kms_v1::model::Digest;
15195 /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
15196 /// ```
15197 pub fn set_digest<T>(mut self, v: T) -> Self
15198 where
15199 T: std::convert::Into<crate::model::Digest>,
15200 {
15201 self.digest = std::option::Option::Some(v.into());
15202 self
15203 }
15204
15205 /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
15206 ///
15207 /// # Example
15208 /// ```ignore,no_run
15209 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15210 /// use google_cloud_kms_v1::model::Digest;
15211 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
15212 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
15213 /// ```
15214 pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
15215 where
15216 T: std::convert::Into<crate::model::Digest>,
15217 {
15218 self.digest = v.map(|x| x.into());
15219 self
15220 }
15221
15222 /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
15223 ///
15224 /// # Example
15225 /// ```ignore,no_run
15226 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15227 /// use wkt::Int64Value;
15228 /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
15229 /// ```
15230 pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
15231 where
15232 T: std::convert::Into<wkt::Int64Value>,
15233 {
15234 self.digest_crc32c = std::option::Option::Some(v.into());
15235 self
15236 }
15237
15238 /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
15239 ///
15240 /// # Example
15241 /// ```ignore,no_run
15242 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15243 /// use wkt::Int64Value;
15244 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
15245 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
15246 /// ```
15247 pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15248 where
15249 T: std::convert::Into<wkt::Int64Value>,
15250 {
15251 self.digest_crc32c = v.map(|x| x.into());
15252 self
15253 }
15254
15255 /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
15256 ///
15257 /// # Example
15258 /// ```ignore,no_run
15259 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15260 /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
15261 /// ```
15262 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15263 self.data = v.into();
15264 self
15265 }
15266
15267 /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
15268 ///
15269 /// # Example
15270 /// ```ignore,no_run
15271 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15272 /// use wkt::Int64Value;
15273 /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
15274 /// ```
15275 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
15276 where
15277 T: std::convert::Into<wkt::Int64Value>,
15278 {
15279 self.data_crc32c = std::option::Option::Some(v.into());
15280 self
15281 }
15282
15283 /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
15284 ///
15285 /// # Example
15286 /// ```ignore,no_run
15287 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
15288 /// use wkt::Int64Value;
15289 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
15290 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
15291 /// ```
15292 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15293 where
15294 T: std::convert::Into<wkt::Int64Value>,
15295 {
15296 self.data_crc32c = v.map(|x| x.into());
15297 self
15298 }
15299}
15300
15301impl wkt::message::Message for AsymmetricSignRequest {
15302 fn typename() -> &'static str {
15303 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
15304 }
15305}
15306
15307/// Request message for
15308/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
15309///
15310/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
15311#[derive(Clone, Default, PartialEq)]
15312#[non_exhaustive]
15313pub struct AsymmetricDecryptRequest {
15314 /// Required. The resource name of the
15315 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
15316 /// decryption.
15317 ///
15318 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15319 pub name: std::string::String,
15320
15321 /// Required. The data encrypted with the named
15322 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
15323 /// OAEP.
15324 ///
15325 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15326 pub ciphertext: ::bytes::Bytes,
15327
15328 /// Optional. An optional CRC32C checksum of the
15329 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
15330 /// If specified,
15331 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15332 /// verify the integrity of the received
15333 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
15334 /// using this checksum.
15335 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15336 /// report an error if the checksum verification fails. If you receive a
15337 /// checksum error, your client should verify that
15338 /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
15339 /// is equal to
15340 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
15341 /// and if so, perform a limited number of retries. A persistent mismatch may
15342 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15343 /// field is defined as int64 for reasons of compatibility across different
15344 /// languages. However, it is a non-negative integer, which will never exceed
15345 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15346 /// this type.
15347 ///
15348 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
15349 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
15350 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15351 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15352
15353 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15354}
15355
15356impl AsymmetricDecryptRequest {
15357 /// Creates a new default instance.
15358 pub fn new() -> Self {
15359 std::default::Default::default()
15360 }
15361
15362 /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
15363 ///
15364 /// # Example
15365 /// ```ignore,no_run
15366 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
15367 /// # let project_id = "project_id";
15368 /// # let location_id = "location_id";
15369 /// # let key_ring_id = "key_ring_id";
15370 /// # let crypto_key_id = "crypto_key_id";
15371 /// # let crypto_key_version_id = "crypto_key_version_id";
15372 /// let x = AsymmetricDecryptRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15373 /// ```
15374 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15375 self.name = v.into();
15376 self
15377 }
15378
15379 /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
15380 ///
15381 /// # Example
15382 /// ```ignore,no_run
15383 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
15384 /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15385 /// ```
15386 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15387 self.ciphertext = v.into();
15388 self
15389 }
15390
15391 /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
15392 ///
15393 /// # Example
15394 /// ```ignore,no_run
15395 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
15396 /// use wkt::Int64Value;
15397 /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15398 /// ```
15399 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15400 where
15401 T: std::convert::Into<wkt::Int64Value>,
15402 {
15403 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15404 self
15405 }
15406
15407 /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
15408 ///
15409 /// # Example
15410 /// ```ignore,no_run
15411 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
15412 /// use wkt::Int64Value;
15413 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15414 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15415 /// ```
15416 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15417 where
15418 T: std::convert::Into<wkt::Int64Value>,
15419 {
15420 self.ciphertext_crc32c = v.map(|x| x.into());
15421 self
15422 }
15423}
15424
15425impl wkt::message::Message for AsymmetricDecryptRequest {
15426 fn typename() -> &'static str {
15427 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
15428 }
15429}
15430
15431/// Request message for
15432/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
15433///
15434/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
15435#[derive(Clone, Default, PartialEq)]
15436#[non_exhaustive]
15437pub struct MacSignRequest {
15438 /// Required. The resource name of the
15439 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
15440 /// signing.
15441 ///
15442 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15443 pub name: std::string::String,
15444
15445 /// Required. The data to sign. The MAC tag is computed over this data field
15446 /// based on the specific algorithm.
15447 pub data: ::bytes::Bytes,
15448
15449 /// Optional. An optional CRC32C checksum of the
15450 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
15451 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15452 /// will verify the integrity of the received
15453 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
15454 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15455 /// will report an error if the checksum verification fails. If you receive a
15456 /// checksum error, your client should verify that
15457 /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
15458 /// equal to
15459 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
15460 /// and if so, perform a limited number of retries. A persistent mismatch may
15461 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15462 /// field is defined as int64 for reasons of compatibility across different
15463 /// languages. However, it is a non-negative integer, which will never exceed
15464 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15465 /// this type.
15466 ///
15467 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15468 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
15469 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
15470 pub data_crc32c: std::option::Option<wkt::Int64Value>,
15471
15472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15473}
15474
15475impl MacSignRequest {
15476 /// Creates a new default instance.
15477 pub fn new() -> Self {
15478 std::default::Default::default()
15479 }
15480
15481 /// Sets the value of [name][crate::model::MacSignRequest::name].
15482 ///
15483 /// # Example
15484 /// ```ignore,no_run
15485 /// # use google_cloud_kms_v1::model::MacSignRequest;
15486 /// # let project_id = "project_id";
15487 /// # let location_id = "location_id";
15488 /// # let key_ring_id = "key_ring_id";
15489 /// # let crypto_key_id = "crypto_key_id";
15490 /// # let crypto_key_version_id = "crypto_key_version_id";
15491 /// let x = MacSignRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15492 /// ```
15493 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15494 self.name = v.into();
15495 self
15496 }
15497
15498 /// Sets the value of [data][crate::model::MacSignRequest::data].
15499 ///
15500 /// # Example
15501 /// ```ignore,no_run
15502 /// # use google_cloud_kms_v1::model::MacSignRequest;
15503 /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
15504 /// ```
15505 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15506 self.data = v.into();
15507 self
15508 }
15509
15510 /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
15511 ///
15512 /// # Example
15513 /// ```ignore,no_run
15514 /// # use google_cloud_kms_v1::model::MacSignRequest;
15515 /// use wkt::Int64Value;
15516 /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
15517 /// ```
15518 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
15519 where
15520 T: std::convert::Into<wkt::Int64Value>,
15521 {
15522 self.data_crc32c = std::option::Option::Some(v.into());
15523 self
15524 }
15525
15526 /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
15527 ///
15528 /// # Example
15529 /// ```ignore,no_run
15530 /// # use google_cloud_kms_v1::model::MacSignRequest;
15531 /// use wkt::Int64Value;
15532 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
15533 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
15534 /// ```
15535 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15536 where
15537 T: std::convert::Into<wkt::Int64Value>,
15538 {
15539 self.data_crc32c = v.map(|x| x.into());
15540 self
15541 }
15542}
15543
15544impl wkt::message::Message for MacSignRequest {
15545 fn typename() -> &'static str {
15546 "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
15547 }
15548}
15549
15550/// Request message for
15551/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
15552///
15553/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
15554#[derive(Clone, Default, PartialEq)]
15555#[non_exhaustive]
15556pub struct MacVerifyRequest {
15557 /// Required. The resource name of the
15558 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
15559 /// verification.
15560 ///
15561 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15562 pub name: std::string::String,
15563
15564 /// Required. The data used previously as a
15565 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
15566 /// the MAC tag.
15567 ///
15568 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
15569 pub data: ::bytes::Bytes,
15570
15571 /// Optional. An optional CRC32C checksum of the
15572 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
15573 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15574 /// will verify the integrity of the received
15575 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
15576 /// this checksum.
15577 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15578 /// report an error if the checksum verification fails. If you receive a
15579 /// checksum error, your client should verify that
15580 /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
15581 /// is equal to
15582 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
15583 /// and if so, perform a limited number of retries. A persistent mismatch may
15584 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15585 /// field is defined as int64 for reasons of compatibility across different
15586 /// languages. However, it is a non-negative integer, which will never exceed
15587 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15588 /// this type.
15589 ///
15590 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15591 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
15592 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
15593 pub data_crc32c: std::option::Option<wkt::Int64Value>,
15594
15595 /// Required. The signature to verify.
15596 pub mac: ::bytes::Bytes,
15597
15598 /// Optional. An optional CRC32C checksum of the
15599 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
15600 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15601 /// will verify the integrity of the received
15602 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
15603 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
15604 /// will report an error if the checksum verification fails. If you receive a
15605 /// checksum error, your client should verify that
15606 /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
15607 /// equal to
15608 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
15609 /// and if so, perform a limited number of retries. A persistent mismatch may
15610 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15611 /// field is defined as int64 for reasons of compatibility across different
15612 /// languages. However, it is a non-negative integer, which will never exceed
15613 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15614 /// this type.
15615 ///
15616 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15617 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
15618 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
15619 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
15620
15621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15622}
15623
15624impl MacVerifyRequest {
15625 /// Creates a new default instance.
15626 pub fn new() -> Self {
15627 std::default::Default::default()
15628 }
15629
15630 /// Sets the value of [name][crate::model::MacVerifyRequest::name].
15631 ///
15632 /// # Example
15633 /// ```ignore,no_run
15634 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15635 /// # let project_id = "project_id";
15636 /// # let location_id = "location_id";
15637 /// # let key_ring_id = "key_ring_id";
15638 /// # let crypto_key_id = "crypto_key_id";
15639 /// # let crypto_key_version_id = "crypto_key_version_id";
15640 /// let x = MacVerifyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15641 /// ```
15642 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15643 self.name = v.into();
15644 self
15645 }
15646
15647 /// Sets the value of [data][crate::model::MacVerifyRequest::data].
15648 ///
15649 /// # Example
15650 /// ```ignore,no_run
15651 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15652 /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
15653 /// ```
15654 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15655 self.data = v.into();
15656 self
15657 }
15658
15659 /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
15660 ///
15661 /// # Example
15662 /// ```ignore,no_run
15663 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15664 /// use wkt::Int64Value;
15665 /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
15666 /// ```
15667 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
15668 where
15669 T: std::convert::Into<wkt::Int64Value>,
15670 {
15671 self.data_crc32c = std::option::Option::Some(v.into());
15672 self
15673 }
15674
15675 /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
15676 ///
15677 /// # Example
15678 /// ```ignore,no_run
15679 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15680 /// use wkt::Int64Value;
15681 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
15682 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
15683 /// ```
15684 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15685 where
15686 T: std::convert::Into<wkt::Int64Value>,
15687 {
15688 self.data_crc32c = v.map(|x| x.into());
15689 self
15690 }
15691
15692 /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
15693 ///
15694 /// # Example
15695 /// ```ignore,no_run
15696 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15697 /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
15698 /// ```
15699 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15700 self.mac = v.into();
15701 self
15702 }
15703
15704 /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
15705 ///
15706 /// # Example
15707 /// ```ignore,no_run
15708 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15709 /// use wkt::Int64Value;
15710 /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
15711 /// ```
15712 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
15713 where
15714 T: std::convert::Into<wkt::Int64Value>,
15715 {
15716 self.mac_crc32c = std::option::Option::Some(v.into());
15717 self
15718 }
15719
15720 /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
15721 ///
15722 /// # Example
15723 /// ```ignore,no_run
15724 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15725 /// use wkt::Int64Value;
15726 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
15727 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
15728 /// ```
15729 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15730 where
15731 T: std::convert::Into<wkt::Int64Value>,
15732 {
15733 self.mac_crc32c = v.map(|x| x.into());
15734 self
15735 }
15736}
15737
15738impl wkt::message::Message for MacVerifyRequest {
15739 fn typename() -> &'static str {
15740 "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
15741 }
15742}
15743
15744/// Request message for
15745/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
15746///
15747/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
15748#[derive(Clone, Default, PartialEq)]
15749#[non_exhaustive]
15750pub struct DecapsulateRequest {
15751 /// Required. The resource name of the
15752 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
15753 /// decapsulation.
15754 ///
15755 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15756 pub name: std::string::String,
15757
15758 /// Required. The ciphertext produced from encapsulation with the
15759 /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
15760 /// key(s).
15761 ///
15762 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15763 pub ciphertext: ::bytes::Bytes,
15764
15765 /// Optional. A CRC32C checksum of the
15766 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
15767 /// If specified,
15768 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15769 /// verify the integrity of the received
15770 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
15771 /// using this checksum.
15772 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15773 /// report an error if the checksum verification fails. If you receive a
15774 /// checksum error, your client should verify that
15775 /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
15776 /// is equal to
15777 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
15778 /// and if so, perform a limited number of retries. A persistent mismatch may
15779 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15780 /// field is defined as int64 for reasons of compatibility across different
15781 /// languages. However, it is a non-negative integer, which will never exceed
15782 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15783 /// this type.
15784 ///
15785 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
15786 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
15787 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15788 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15789
15790 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15791}
15792
15793impl DecapsulateRequest {
15794 /// Creates a new default instance.
15795 pub fn new() -> Self {
15796 std::default::Default::default()
15797 }
15798
15799 /// Sets the value of [name][crate::model::DecapsulateRequest::name].
15800 ///
15801 /// # Example
15802 /// ```ignore,no_run
15803 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15804 /// # let project_id = "project_id";
15805 /// # let location_id = "location_id";
15806 /// # let key_ring_id = "key_ring_id";
15807 /// # let crypto_key_id = "crypto_key_id";
15808 /// # let crypto_key_version_id = "crypto_key_version_id";
15809 /// let x = DecapsulateRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15810 /// ```
15811 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15812 self.name = v.into();
15813 self
15814 }
15815
15816 /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
15817 ///
15818 /// # Example
15819 /// ```ignore,no_run
15820 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15821 /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15822 /// ```
15823 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15824 self.ciphertext = v.into();
15825 self
15826 }
15827
15828 /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
15829 ///
15830 /// # Example
15831 /// ```ignore,no_run
15832 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15833 /// use wkt::Int64Value;
15834 /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15835 /// ```
15836 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15837 where
15838 T: std::convert::Into<wkt::Int64Value>,
15839 {
15840 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15841 self
15842 }
15843
15844 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
15845 ///
15846 /// # Example
15847 /// ```ignore,no_run
15848 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15849 /// use wkt::Int64Value;
15850 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15851 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15852 /// ```
15853 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15854 where
15855 T: std::convert::Into<wkt::Int64Value>,
15856 {
15857 self.ciphertext_crc32c = v.map(|x| x.into());
15858 self
15859 }
15860}
15861
15862impl wkt::message::Message for DecapsulateRequest {
15863 fn typename() -> &'static str {
15864 "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
15865 }
15866}
15867
15868/// Request message for
15869/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
15870///
15871/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
15872#[derive(Clone, Default, PartialEq)]
15873#[non_exhaustive]
15874pub struct GenerateRandomBytesRequest {
15875 /// The project-specific location in which to generate random bytes.
15876 /// For example, "projects/my-project/locations/us-central1".
15877 pub location: std::string::String,
15878
15879 /// The length in bytes of the amount of randomness to retrieve. Minimum 8
15880 /// bytes, maximum 1024 bytes.
15881 pub length_bytes: i32,
15882
15883 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
15884 /// generating the random data. Currently, only
15885 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
15886 /// supported.
15887 ///
15888 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15889 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
15890 pub protection_level: crate::model::ProtectionLevel,
15891
15892 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15893}
15894
15895impl GenerateRandomBytesRequest {
15896 /// Creates a new default instance.
15897 pub fn new() -> Self {
15898 std::default::Default::default()
15899 }
15900
15901 /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
15902 ///
15903 /// # Example
15904 /// ```ignore,no_run
15905 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15906 /// let x = GenerateRandomBytesRequest::new().set_location("example");
15907 /// ```
15908 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15909 self.location = v.into();
15910 self
15911 }
15912
15913 /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
15914 ///
15915 /// # Example
15916 /// ```ignore,no_run
15917 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15918 /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
15919 /// ```
15920 pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15921 self.length_bytes = v.into();
15922 self
15923 }
15924
15925 /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
15926 ///
15927 /// # Example
15928 /// ```ignore,no_run
15929 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15930 /// use google_cloud_kms_v1::model::ProtectionLevel;
15931 /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
15932 /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
15933 /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
15934 /// ```
15935 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15936 mut self,
15937 v: T,
15938 ) -> Self {
15939 self.protection_level = v.into();
15940 self
15941 }
15942}
15943
15944impl wkt::message::Message for GenerateRandomBytesRequest {
15945 fn typename() -> &'static str {
15946 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
15947 }
15948}
15949
15950/// Response message for
15951/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
15952///
15953/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
15954#[derive(Clone, Default, PartialEq)]
15955#[non_exhaustive]
15956pub struct EncryptResponse {
15957 /// The resource name of the
15958 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15959 /// encryption. Check this field to verify that the intended resource was used
15960 /// for encryption.
15961 ///
15962 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15963 pub name: std::string::String,
15964
15965 /// The encrypted data.
15966 pub ciphertext: ::bytes::Bytes,
15967
15968 /// Integrity verification field. A CRC32C checksum of the returned
15969 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
15970 /// An integrity check of
15971 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15972 /// can be performed by computing the CRC32C checksum of
15973 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15974 /// and comparing your results to this field. Discard the response in case of
15975 /// non-matching checksum values, and perform a limited number of retries. A
15976 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15977 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15978 /// across different languages. However, it is a non-negative integer, which
15979 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15980 /// languages that support this type.
15981 ///
15982 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
15983 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15984
15985 /// Integrity verification field. A flag indicating whether
15986 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15987 /// was received by
15988 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15989 /// for the integrity verification of the
15990 /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
15991 /// this field indicates either that
15992 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15993 /// was left unset or that it was not delivered to
15994 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15995 /// set
15996 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15997 /// but this field is still false, discard the response and perform a limited
15998 /// number of retries.
15999 ///
16000 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
16001 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
16002 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16003 pub verified_plaintext_crc32c: bool,
16004
16005 /// Integrity verification field. A flag indicating whether
16006 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
16007 /// was received by
16008 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16009 /// for the integrity verification of the
16010 /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
16011 /// false value of this field indicates either that
16012 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
16013 /// was left unset or that it was not delivered to
16014 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16015 /// set
16016 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
16017 /// but this field is still false, discard the response and perform a limited
16018 /// number of retries.
16019 ///
16020 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
16021 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
16022 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16023 pub verified_additional_authenticated_data_crc32c: bool,
16024
16025 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16026 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16027 /// encryption.
16028 ///
16029 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16030 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16031 pub protection_level: crate::model::ProtectionLevel,
16032
16033 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16034}
16035
16036impl EncryptResponse {
16037 /// Creates a new default instance.
16038 pub fn new() -> Self {
16039 std::default::Default::default()
16040 }
16041
16042 /// Sets the value of [name][crate::model::EncryptResponse::name].
16043 ///
16044 /// # Example
16045 /// ```ignore,no_run
16046 /// # use google_cloud_kms_v1::model::EncryptResponse;
16047 /// let x = EncryptResponse::new().set_name("example");
16048 /// ```
16049 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16050 self.name = v.into();
16051 self
16052 }
16053
16054 /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
16055 ///
16056 /// # Example
16057 /// ```ignore,no_run
16058 /// # use google_cloud_kms_v1::model::EncryptResponse;
16059 /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
16060 /// ```
16061 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16062 self.ciphertext = v.into();
16063 self
16064 }
16065
16066 /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
16067 ///
16068 /// # Example
16069 /// ```ignore,no_run
16070 /// # use google_cloud_kms_v1::model::EncryptResponse;
16071 /// use wkt::Int64Value;
16072 /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
16073 /// ```
16074 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
16075 where
16076 T: std::convert::Into<wkt::Int64Value>,
16077 {
16078 self.ciphertext_crc32c = std::option::Option::Some(v.into());
16079 self
16080 }
16081
16082 /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
16083 ///
16084 /// # Example
16085 /// ```ignore,no_run
16086 /// # use google_cloud_kms_v1::model::EncryptResponse;
16087 /// use wkt::Int64Value;
16088 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
16089 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
16090 /// ```
16091 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16092 where
16093 T: std::convert::Into<wkt::Int64Value>,
16094 {
16095 self.ciphertext_crc32c = v.map(|x| x.into());
16096 self
16097 }
16098
16099 /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
16100 ///
16101 /// # Example
16102 /// ```ignore,no_run
16103 /// # use google_cloud_kms_v1::model::EncryptResponse;
16104 /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
16105 /// ```
16106 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16107 self.verified_plaintext_crc32c = v.into();
16108 self
16109 }
16110
16111 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
16112 ///
16113 /// # Example
16114 /// ```ignore,no_run
16115 /// # use google_cloud_kms_v1::model::EncryptResponse;
16116 /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
16117 /// ```
16118 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
16119 mut self,
16120 v: T,
16121 ) -> Self {
16122 self.verified_additional_authenticated_data_crc32c = v.into();
16123 self
16124 }
16125
16126 /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
16127 ///
16128 /// # Example
16129 /// ```ignore,no_run
16130 /// # use google_cloud_kms_v1::model::EncryptResponse;
16131 /// use google_cloud_kms_v1::model::ProtectionLevel;
16132 /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
16133 /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16134 /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
16135 /// ```
16136 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16137 mut self,
16138 v: T,
16139 ) -> Self {
16140 self.protection_level = v.into();
16141 self
16142 }
16143}
16144
16145impl wkt::message::Message for EncryptResponse {
16146 fn typename() -> &'static str {
16147 "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
16148 }
16149}
16150
16151/// Response message for
16152/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
16153///
16154/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
16155#[derive(Clone, Default, PartialEq)]
16156#[non_exhaustive]
16157pub struct DecryptResponse {
16158 /// The decrypted data originally supplied in
16159 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
16160 ///
16161 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
16162 pub plaintext: ::bytes::Bytes,
16163
16164 /// Integrity verification field. A CRC32C checksum of the returned
16165 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
16166 /// An integrity check of
16167 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
16168 /// can be performed by computing the CRC32C checksum of
16169 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
16170 /// and comparing your results to this field. Discard the response in case of
16171 /// non-matching checksum values, and perform a limited number of retries. A
16172 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16173 /// checksum. Note: receiving this response message indicates that
16174 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16175 /// successfully decrypt the
16176 /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
16177 /// field is defined as int64 for reasons of compatibility across different
16178 /// languages. However, it is a non-negative integer, which will never exceed
16179 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
16180 /// this type.
16181 ///
16182 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
16183 /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
16184 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16185 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16186
16187 /// Whether the Decryption was performed using the primary key version.
16188 pub used_primary: bool,
16189
16190 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16191 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16192 /// decryption.
16193 ///
16194 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16195 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16196 pub protection_level: crate::model::ProtectionLevel,
16197
16198 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16199}
16200
16201impl DecryptResponse {
16202 /// Creates a new default instance.
16203 pub fn new() -> Self {
16204 std::default::Default::default()
16205 }
16206
16207 /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
16208 ///
16209 /// # Example
16210 /// ```ignore,no_run
16211 /// # use google_cloud_kms_v1::model::DecryptResponse;
16212 /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16213 /// ```
16214 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16215 self.plaintext = v.into();
16216 self
16217 }
16218
16219 /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
16220 ///
16221 /// # Example
16222 /// ```ignore,no_run
16223 /// # use google_cloud_kms_v1::model::DecryptResponse;
16224 /// use wkt::Int64Value;
16225 /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16226 /// ```
16227 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16228 where
16229 T: std::convert::Into<wkt::Int64Value>,
16230 {
16231 self.plaintext_crc32c = std::option::Option::Some(v.into());
16232 self
16233 }
16234
16235 /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
16236 ///
16237 /// # Example
16238 /// ```ignore,no_run
16239 /// # use google_cloud_kms_v1::model::DecryptResponse;
16240 /// use wkt::Int64Value;
16241 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16242 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16243 /// ```
16244 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16245 where
16246 T: std::convert::Into<wkt::Int64Value>,
16247 {
16248 self.plaintext_crc32c = v.map(|x| x.into());
16249 self
16250 }
16251
16252 /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
16253 ///
16254 /// # Example
16255 /// ```ignore,no_run
16256 /// # use google_cloud_kms_v1::model::DecryptResponse;
16257 /// let x = DecryptResponse::new().set_used_primary(true);
16258 /// ```
16259 pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16260 self.used_primary = v.into();
16261 self
16262 }
16263
16264 /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
16265 ///
16266 /// # Example
16267 /// ```ignore,no_run
16268 /// # use google_cloud_kms_v1::model::DecryptResponse;
16269 /// use google_cloud_kms_v1::model::ProtectionLevel;
16270 /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16271 /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16272 /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
16273 /// ```
16274 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16275 mut self,
16276 v: T,
16277 ) -> Self {
16278 self.protection_level = v.into();
16279 self
16280 }
16281}
16282
16283impl wkt::message::Message for DecryptResponse {
16284 fn typename() -> &'static str {
16285 "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
16286 }
16287}
16288
16289/// Response message for
16290/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
16291///
16292/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
16293#[derive(Clone, Default, PartialEq)]
16294#[non_exhaustive]
16295pub struct RawEncryptResponse {
16296 /// The encrypted data. In the case of AES-GCM, the authentication tag
16297 /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
16298 /// bytes at the end of this field.
16299 ///
16300 /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
16301 pub ciphertext: ::bytes::Bytes,
16302
16303 /// The initialization vector (IV) generated by the service during
16304 /// encryption. This value must be stored and provided in
16305 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
16306 /// at decryption time.
16307 ///
16308 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
16309 pub initialization_vector: ::bytes::Bytes,
16310
16311 /// The length of the authentication tag that is appended to
16312 /// the end of the ciphertext.
16313 pub tag_length: i32,
16314
16315 /// Integrity verification field. A CRC32C checksum of the returned
16316 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
16317 /// An integrity check of ciphertext can be performed by computing the CRC32C
16318 /// checksum of ciphertext and comparing your results to this field. Discard
16319 /// the response in case of non-matching checksum values, and perform a limited
16320 /// number of retries. A persistent mismatch may indicate an issue in your
16321 /// computation of the CRC32C checksum. Note: This field is defined as int64
16322 /// for reasons of compatibility across different languages. However, it is a
16323 /// non-negative integer, which will never exceed 2^32-1, and can be safely
16324 /// downconverted to uint32 in languages that support this type.
16325 ///
16326 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
16327 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
16328
16329 /// Integrity verification field. A CRC32C checksum of the returned
16330 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
16331 /// An integrity check of initialization_vector can be performed by computing
16332 /// the CRC32C checksum of initialization_vector and comparing your results to
16333 /// this field. Discard the response in case of non-matching checksum values,
16334 /// and perform a limited number of retries. A persistent mismatch may indicate
16335 /// an issue in your computation of the CRC32C checksum. Note: This field is
16336 /// defined as int64 for reasons of compatibility across different languages.
16337 /// However, it is a non-negative integer, which will never exceed 2^32-1, and
16338 /// can be safely downconverted to uint32 in languages that support this type.
16339 ///
16340 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
16341 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
16342
16343 /// Integrity verification field. A flag indicating whether
16344 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
16345 /// was received by
16346 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16347 /// for the integrity verification of the plaintext. A false value of this
16348 /// field indicates either that
16349 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
16350 /// was left unset or that it was not delivered to
16351 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16352 /// set
16353 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
16354 /// but this field is still false, discard the response and perform a limited
16355 /// number of retries.
16356 ///
16357 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16358 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
16359 pub verified_plaintext_crc32c: bool,
16360
16361 /// Integrity verification field. A flag indicating whether
16362 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
16363 /// was received by
16364 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16365 /// for the integrity verification of additional_authenticated_data. A false
16366 /// value of this field indicates either that //
16367 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
16368 /// was left unset or that it was not delivered to
16369 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16370 /// set
16371 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
16372 /// but this field is still false, discard the response and perform a limited
16373 /// number of retries.
16374 ///
16375 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16376 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
16377 pub verified_additional_authenticated_data_crc32c: bool,
16378
16379 /// Integrity verification field. A flag indicating whether
16380 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
16381 /// was received by
16382 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16383 /// for the integrity verification of initialization_vector. A false value of
16384 /// this field indicates either that
16385 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
16386 /// was left unset or that it was not delivered to
16387 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16388 /// set
16389 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
16390 /// but this field is still false, discard the response and perform a limited
16391 /// number of retries.
16392 ///
16393 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16394 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
16395 pub verified_initialization_vector_crc32c: bool,
16396
16397 /// The resource name of the
16398 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16399 /// encryption. Check this field to verify that the intended resource was used
16400 /// for encryption.
16401 ///
16402 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16403 pub name: std::string::String,
16404
16405 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16406 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16407 /// encryption.
16408 ///
16409 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16410 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16411 pub protection_level: crate::model::ProtectionLevel,
16412
16413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16414}
16415
16416impl RawEncryptResponse {
16417 /// Creates a new default instance.
16418 pub fn new() -> Self {
16419 std::default::Default::default()
16420 }
16421
16422 /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
16423 ///
16424 /// # Example
16425 /// ```ignore,no_run
16426 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16427 /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
16428 /// ```
16429 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16430 self.ciphertext = v.into();
16431 self
16432 }
16433
16434 /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
16435 ///
16436 /// # Example
16437 /// ```ignore,no_run
16438 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16439 /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
16440 /// ```
16441 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
16442 mut self,
16443 v: T,
16444 ) -> Self {
16445 self.initialization_vector = v.into();
16446 self
16447 }
16448
16449 /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
16450 ///
16451 /// # Example
16452 /// ```ignore,no_run
16453 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16454 /// let x = RawEncryptResponse::new().set_tag_length(42);
16455 /// ```
16456 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16457 self.tag_length = v.into();
16458 self
16459 }
16460
16461 /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
16462 ///
16463 /// # Example
16464 /// ```ignore,no_run
16465 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16466 /// use wkt::Int64Value;
16467 /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
16468 /// ```
16469 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
16470 where
16471 T: std::convert::Into<wkt::Int64Value>,
16472 {
16473 self.ciphertext_crc32c = std::option::Option::Some(v.into());
16474 self
16475 }
16476
16477 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
16478 ///
16479 /// # Example
16480 /// ```ignore,no_run
16481 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16482 /// use wkt::Int64Value;
16483 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
16484 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
16485 /// ```
16486 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16487 where
16488 T: std::convert::Into<wkt::Int64Value>,
16489 {
16490 self.ciphertext_crc32c = v.map(|x| x.into());
16491 self
16492 }
16493
16494 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
16495 ///
16496 /// # Example
16497 /// ```ignore,no_run
16498 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16499 /// use wkt::Int64Value;
16500 /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
16501 /// ```
16502 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
16503 where
16504 T: std::convert::Into<wkt::Int64Value>,
16505 {
16506 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
16507 self
16508 }
16509
16510 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
16511 ///
16512 /// # Example
16513 /// ```ignore,no_run
16514 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16515 /// use wkt::Int64Value;
16516 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
16517 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
16518 /// ```
16519 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16520 where
16521 T: std::convert::Into<wkt::Int64Value>,
16522 {
16523 self.initialization_vector_crc32c = v.map(|x| x.into());
16524 self
16525 }
16526
16527 /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
16528 ///
16529 /// # Example
16530 /// ```ignore,no_run
16531 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16532 /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
16533 /// ```
16534 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16535 self.verified_plaintext_crc32c = v.into();
16536 self
16537 }
16538
16539 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
16540 ///
16541 /// # Example
16542 /// ```ignore,no_run
16543 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16544 /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
16545 /// ```
16546 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
16547 mut self,
16548 v: T,
16549 ) -> Self {
16550 self.verified_additional_authenticated_data_crc32c = v.into();
16551 self
16552 }
16553
16554 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
16555 ///
16556 /// # Example
16557 /// ```ignore,no_run
16558 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16559 /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
16560 /// ```
16561 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
16562 mut self,
16563 v: T,
16564 ) -> Self {
16565 self.verified_initialization_vector_crc32c = v.into();
16566 self
16567 }
16568
16569 /// Sets the value of [name][crate::model::RawEncryptResponse::name].
16570 ///
16571 /// # Example
16572 /// ```ignore,no_run
16573 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16574 /// let x = RawEncryptResponse::new().set_name("example");
16575 /// ```
16576 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16577 self.name = v.into();
16578 self
16579 }
16580
16581 /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
16582 ///
16583 /// # Example
16584 /// ```ignore,no_run
16585 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
16586 /// use google_cloud_kms_v1::model::ProtectionLevel;
16587 /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
16588 /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16589 /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
16590 /// ```
16591 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16592 mut self,
16593 v: T,
16594 ) -> Self {
16595 self.protection_level = v.into();
16596 self
16597 }
16598}
16599
16600impl wkt::message::Message for RawEncryptResponse {
16601 fn typename() -> &'static str {
16602 "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
16603 }
16604}
16605
16606/// Response message for
16607/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
16608///
16609/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
16610#[derive(Clone, Default, PartialEq)]
16611#[non_exhaustive]
16612pub struct RawDecryptResponse {
16613 /// The decrypted data.
16614 pub plaintext: ::bytes::Bytes,
16615
16616 /// Integrity verification field. A CRC32C checksum of the returned
16617 /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
16618 /// An integrity check of plaintext can be performed by computing the CRC32C
16619 /// checksum of plaintext and comparing your results to this field. Discard the
16620 /// response in case of non-matching checksum values, and perform a limited
16621 /// number of retries. A persistent mismatch may indicate an issue in your
16622 /// computation of the CRC32C checksum. Note: receiving this response message
16623 /// indicates that
16624 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16625 /// successfully decrypt the
16626 /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
16627 /// Note: This field is defined as int64 for reasons of compatibility across
16628 /// different languages. However, it is a non-negative integer, which will
16629 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
16630 /// that support this type.
16631 ///
16632 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16633 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
16634 /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
16635 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16636
16637 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16638 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16639 /// decryption.
16640 ///
16641 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16642 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16643 pub protection_level: crate::model::ProtectionLevel,
16644
16645 /// Integrity verification field. A flag indicating whether
16646 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
16647 /// was received by
16648 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16649 /// for the integrity verification of the ciphertext. A false value of this
16650 /// field indicates either that
16651 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
16652 /// was left unset or that it was not delivered to
16653 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16654 /// set
16655 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
16656 /// but this field is still false, discard the response and perform a limited
16657 /// number of retries.
16658 ///
16659 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16660 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
16661 pub verified_ciphertext_crc32c: bool,
16662
16663 /// Integrity verification field. A flag indicating whether
16664 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
16665 /// was received by
16666 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16667 /// for the integrity verification of additional_authenticated_data. A false
16668 /// value of this field indicates either that //
16669 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
16670 /// was left unset or that it was not delivered to
16671 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16672 /// set
16673 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
16674 /// but this field is still false, discard the response and perform a limited
16675 /// number of retries.
16676 ///
16677 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16678 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
16679 pub verified_additional_authenticated_data_crc32c: bool,
16680
16681 /// Integrity verification field. A flag indicating whether
16682 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
16683 /// was received by
16684 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16685 /// for the integrity verification of initialization_vector. A false value of
16686 /// this field indicates either that
16687 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
16688 /// was left unset or that it was not delivered to
16689 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16690 /// set
16691 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
16692 /// but this field is still false, discard the response and perform a limited
16693 /// number of retries.
16694 ///
16695 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16696 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
16697 pub verified_initialization_vector_crc32c: bool,
16698
16699 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16700}
16701
16702impl RawDecryptResponse {
16703 /// Creates a new default instance.
16704 pub fn new() -> Self {
16705 std::default::Default::default()
16706 }
16707
16708 /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
16709 ///
16710 /// # Example
16711 /// ```ignore,no_run
16712 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16713 /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16714 /// ```
16715 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16716 self.plaintext = v.into();
16717 self
16718 }
16719
16720 /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
16721 ///
16722 /// # Example
16723 /// ```ignore,no_run
16724 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16725 /// use wkt::Int64Value;
16726 /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16727 /// ```
16728 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16729 where
16730 T: std::convert::Into<wkt::Int64Value>,
16731 {
16732 self.plaintext_crc32c = std::option::Option::Some(v.into());
16733 self
16734 }
16735
16736 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
16737 ///
16738 /// # Example
16739 /// ```ignore,no_run
16740 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16741 /// use wkt::Int64Value;
16742 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16743 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16744 /// ```
16745 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16746 where
16747 T: std::convert::Into<wkt::Int64Value>,
16748 {
16749 self.plaintext_crc32c = v.map(|x| x.into());
16750 self
16751 }
16752
16753 /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
16754 ///
16755 /// # Example
16756 /// ```ignore,no_run
16757 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16758 /// use google_cloud_kms_v1::model::ProtectionLevel;
16759 /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16760 /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16761 /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16762 /// ```
16763 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16764 mut self,
16765 v: T,
16766 ) -> Self {
16767 self.protection_level = v.into();
16768 self
16769 }
16770
16771 /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
16772 ///
16773 /// # Example
16774 /// ```ignore,no_run
16775 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16776 /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16777 /// ```
16778 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16779 self.verified_ciphertext_crc32c = v.into();
16780 self
16781 }
16782
16783 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
16784 ///
16785 /// # Example
16786 /// ```ignore,no_run
16787 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16788 /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
16789 /// ```
16790 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
16791 mut self,
16792 v: T,
16793 ) -> Self {
16794 self.verified_additional_authenticated_data_crc32c = v.into();
16795 self
16796 }
16797
16798 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
16799 ///
16800 /// # Example
16801 /// ```ignore,no_run
16802 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16803 /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
16804 /// ```
16805 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
16806 mut self,
16807 v: T,
16808 ) -> Self {
16809 self.verified_initialization_vector_crc32c = v.into();
16810 self
16811 }
16812}
16813
16814impl wkt::message::Message for RawDecryptResponse {
16815 fn typename() -> &'static str {
16816 "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
16817 }
16818}
16819
16820/// Response message for
16821/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
16822///
16823/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
16824#[derive(Clone, Default, PartialEq)]
16825#[non_exhaustive]
16826pub struct AsymmetricSignResponse {
16827 /// The created signature.
16828 pub signature: ::bytes::Bytes,
16829
16830 /// Integrity verification field. A CRC32C checksum of the returned
16831 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
16832 /// An integrity check of
16833 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
16834 /// can be performed by computing the CRC32C checksum of
16835 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
16836 /// and comparing your results to this field. Discard the response in case of
16837 /// non-matching checksum values, and perform a limited number of retries. A
16838 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16839 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16840 /// across different languages. However, it is a non-negative integer, which
16841 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16842 /// languages that support this type.
16843 ///
16844 /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
16845 pub signature_crc32c: std::option::Option<wkt::Int64Value>,
16846
16847 /// Integrity verification field. A flag indicating whether
16848 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16849 /// was received by
16850 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16851 /// for the integrity verification of the
16852 /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
16853 /// of this field indicates either that
16854 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16855 /// was left unset or that it was not delivered to
16856 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16857 /// set
16858 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16859 /// but this field is still false, discard the response and perform a limited
16860 /// number of retries.
16861 ///
16862 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
16863 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
16864 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16865 pub verified_digest_crc32c: bool,
16866
16867 /// The resource name of the
16868 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16869 /// Check this field to verify that the intended resource was used for signing.
16870 ///
16871 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16872 pub name: std::string::String,
16873
16874 /// Integrity verification field. A flag indicating whether
16875 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
16876 /// was received by
16877 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16878 /// for the integrity verification of the
16879 /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
16880 /// this field indicates either that
16881 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
16882 /// was left unset or that it was not delivered to
16883 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16884 /// set
16885 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
16886 /// but this field is still false, discard the response and perform a limited
16887 /// number of retries.
16888 ///
16889 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
16890 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
16891 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16892 pub verified_data_crc32c: bool,
16893
16894 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16895 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16896 ///
16897 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16898 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16899 pub protection_level: crate::model::ProtectionLevel,
16900
16901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16902}
16903
16904impl AsymmetricSignResponse {
16905 /// Creates a new default instance.
16906 pub fn new() -> Self {
16907 std::default::Default::default()
16908 }
16909
16910 /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
16911 ///
16912 /// # Example
16913 /// ```ignore,no_run
16914 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16915 /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
16916 /// ```
16917 pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16918 self.signature = v.into();
16919 self
16920 }
16921
16922 /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16923 ///
16924 /// # Example
16925 /// ```ignore,no_run
16926 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16927 /// use wkt::Int64Value;
16928 /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
16929 /// ```
16930 pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
16931 where
16932 T: std::convert::Into<wkt::Int64Value>,
16933 {
16934 self.signature_crc32c = std::option::Option::Some(v.into());
16935 self
16936 }
16937
16938 /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16939 ///
16940 /// # Example
16941 /// ```ignore,no_run
16942 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16943 /// use wkt::Int64Value;
16944 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
16945 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
16946 /// ```
16947 pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16948 where
16949 T: std::convert::Into<wkt::Int64Value>,
16950 {
16951 self.signature_crc32c = v.map(|x| x.into());
16952 self
16953 }
16954
16955 /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
16956 ///
16957 /// # Example
16958 /// ```ignore,no_run
16959 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16960 /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
16961 /// ```
16962 pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16963 self.verified_digest_crc32c = v.into();
16964 self
16965 }
16966
16967 /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
16968 ///
16969 /// # Example
16970 /// ```ignore,no_run
16971 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16972 /// let x = AsymmetricSignResponse::new().set_name("example");
16973 /// ```
16974 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16975 self.name = v.into();
16976 self
16977 }
16978
16979 /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
16980 ///
16981 /// # Example
16982 /// ```ignore,no_run
16983 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16984 /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
16985 /// ```
16986 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16987 self.verified_data_crc32c = v.into();
16988 self
16989 }
16990
16991 /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
16992 ///
16993 /// # Example
16994 /// ```ignore,no_run
16995 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16996 /// use google_cloud_kms_v1::model::ProtectionLevel;
16997 /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
16998 /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16999 /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
17000 /// ```
17001 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
17002 mut self,
17003 v: T,
17004 ) -> Self {
17005 self.protection_level = v.into();
17006 self
17007 }
17008}
17009
17010impl wkt::message::Message for AsymmetricSignResponse {
17011 fn typename() -> &'static str {
17012 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
17013 }
17014}
17015
17016/// Response message for
17017/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
17018///
17019/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
17020#[derive(Clone, Default, PartialEq)]
17021#[non_exhaustive]
17022pub struct AsymmetricDecryptResponse {
17023 /// The decrypted data originally encrypted with the matching public key.
17024 pub plaintext: ::bytes::Bytes,
17025
17026 /// Integrity verification field. A CRC32C checksum of the returned
17027 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
17028 /// An integrity check of
17029 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
17030 /// can be performed by computing the CRC32C checksum of
17031 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
17032 /// and comparing your results to this field. Discard the response in case of
17033 /// non-matching checksum values, and perform a limited number of retries. A
17034 /// persistent mismatch may indicate an issue in your computation of the CRC32C
17035 /// checksum. Note: This field is defined as int64 for reasons of compatibility
17036 /// across different languages. However, it is a non-negative integer, which
17037 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
17038 /// languages that support this type.
17039 ///
17040 /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
17041 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
17042
17043 /// Integrity verification field. A flag indicating whether
17044 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
17045 /// was received by
17046 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
17047 /// for the integrity verification of the
17048 /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
17049 /// false value of this field indicates either that
17050 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
17051 /// was left unset or that it was not delivered to
17052 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
17053 /// set
17054 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
17055 /// but this field is still false, discard the response and perform a limited
17056 /// number of retries.
17057 ///
17058 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
17059 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
17060 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
17061 pub verified_ciphertext_crc32c: bool,
17062
17063 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
17064 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
17065 /// decryption.
17066 ///
17067 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
17068 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17069 pub protection_level: crate::model::ProtectionLevel,
17070
17071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17072}
17073
17074impl AsymmetricDecryptResponse {
17075 /// Creates a new default instance.
17076 pub fn new() -> Self {
17077 std::default::Default::default()
17078 }
17079
17080 /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
17081 ///
17082 /// # Example
17083 /// ```ignore,no_run
17084 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
17085 /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
17086 /// ```
17087 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17088 self.plaintext = v.into();
17089 self
17090 }
17091
17092 /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
17093 ///
17094 /// # Example
17095 /// ```ignore,no_run
17096 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
17097 /// use wkt::Int64Value;
17098 /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
17099 /// ```
17100 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
17101 where
17102 T: std::convert::Into<wkt::Int64Value>,
17103 {
17104 self.plaintext_crc32c = std::option::Option::Some(v.into());
17105 self
17106 }
17107
17108 /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
17109 ///
17110 /// # Example
17111 /// ```ignore,no_run
17112 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
17113 /// use wkt::Int64Value;
17114 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
17115 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
17116 /// ```
17117 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
17118 where
17119 T: std::convert::Into<wkt::Int64Value>,
17120 {
17121 self.plaintext_crc32c = v.map(|x| x.into());
17122 self
17123 }
17124
17125 /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
17126 ///
17127 /// # Example
17128 /// ```ignore,no_run
17129 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
17130 /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
17131 /// ```
17132 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17133 self.verified_ciphertext_crc32c = v.into();
17134 self
17135 }
17136
17137 /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
17138 ///
17139 /// # Example
17140 /// ```ignore,no_run
17141 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
17142 /// use google_cloud_kms_v1::model::ProtectionLevel;
17143 /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
17144 /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
17145 /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
17146 /// ```
17147 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
17148 mut self,
17149 v: T,
17150 ) -> Self {
17151 self.protection_level = v.into();
17152 self
17153 }
17154}
17155
17156impl wkt::message::Message for AsymmetricDecryptResponse {
17157 fn typename() -> &'static str {
17158 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
17159 }
17160}
17161
17162/// Response message for
17163/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
17164///
17165/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
17166#[derive(Clone, Default, PartialEq)]
17167#[non_exhaustive]
17168pub struct MacSignResponse {
17169 /// The resource name of the
17170 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
17171 /// Check this field to verify that the intended resource was used for signing.
17172 ///
17173 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
17174 pub name: std::string::String,
17175
17176 /// The created signature.
17177 pub mac: ::bytes::Bytes,
17178
17179 /// Integrity verification field. A CRC32C checksum of the returned
17180 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
17181 /// integrity check of
17182 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
17183 /// performed by computing the CRC32C checksum of
17184 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
17185 /// comparing your results to this field. Discard the response in case of
17186 /// non-matching checksum values, and perform a limited number of retries. A
17187 /// persistent mismatch may indicate an issue in your computation of the CRC32C
17188 /// checksum. Note: This field is defined as int64 for reasons of compatibility
17189 /// across different languages. However, it is a non-negative integer, which
17190 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
17191 /// languages that support this type.
17192 ///
17193 /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
17194 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
17195
17196 /// Integrity verification field. A flag indicating whether
17197 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
17198 /// was received by
17199 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
17200 /// for the integrity verification of the
17201 /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
17202 /// field indicates either that
17203 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
17204 /// was left unset or that it was not delivered to
17205 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
17206 /// set
17207 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
17208 /// but this field is still false, discard the response and perform a limited
17209 /// number of retries.
17210 ///
17211 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
17212 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
17213 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
17214 pub verified_data_crc32c: bool,
17215
17216 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
17217 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
17218 ///
17219 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
17220 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17221 pub protection_level: crate::model::ProtectionLevel,
17222
17223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17224}
17225
17226impl MacSignResponse {
17227 /// Creates a new default instance.
17228 pub fn new() -> Self {
17229 std::default::Default::default()
17230 }
17231
17232 /// Sets the value of [name][crate::model::MacSignResponse::name].
17233 ///
17234 /// # Example
17235 /// ```ignore,no_run
17236 /// # use google_cloud_kms_v1::model::MacSignResponse;
17237 /// let x = MacSignResponse::new().set_name("example");
17238 /// ```
17239 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17240 self.name = v.into();
17241 self
17242 }
17243
17244 /// Sets the value of [mac][crate::model::MacSignResponse::mac].
17245 ///
17246 /// # Example
17247 /// ```ignore,no_run
17248 /// # use google_cloud_kms_v1::model::MacSignResponse;
17249 /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
17250 /// ```
17251 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17252 self.mac = v.into();
17253 self
17254 }
17255
17256 /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
17257 ///
17258 /// # Example
17259 /// ```ignore,no_run
17260 /// # use google_cloud_kms_v1::model::MacSignResponse;
17261 /// use wkt::Int64Value;
17262 /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
17263 /// ```
17264 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
17265 where
17266 T: std::convert::Into<wkt::Int64Value>,
17267 {
17268 self.mac_crc32c = std::option::Option::Some(v.into());
17269 self
17270 }
17271
17272 /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
17273 ///
17274 /// # Example
17275 /// ```ignore,no_run
17276 /// # use google_cloud_kms_v1::model::MacSignResponse;
17277 /// use wkt::Int64Value;
17278 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
17279 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
17280 /// ```
17281 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
17282 where
17283 T: std::convert::Into<wkt::Int64Value>,
17284 {
17285 self.mac_crc32c = v.map(|x| x.into());
17286 self
17287 }
17288
17289 /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
17290 ///
17291 /// # Example
17292 /// ```ignore,no_run
17293 /// # use google_cloud_kms_v1::model::MacSignResponse;
17294 /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
17295 /// ```
17296 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17297 self.verified_data_crc32c = v.into();
17298 self
17299 }
17300
17301 /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
17302 ///
17303 /// # Example
17304 /// ```ignore,no_run
17305 /// # use google_cloud_kms_v1::model::MacSignResponse;
17306 /// use google_cloud_kms_v1::model::ProtectionLevel;
17307 /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
17308 /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
17309 /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
17310 /// ```
17311 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
17312 mut self,
17313 v: T,
17314 ) -> Self {
17315 self.protection_level = v.into();
17316 self
17317 }
17318}
17319
17320impl wkt::message::Message for MacSignResponse {
17321 fn typename() -> &'static str {
17322 "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
17323 }
17324}
17325
17326/// Response message for
17327/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
17328///
17329/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
17330#[derive(Clone, Default, PartialEq)]
17331#[non_exhaustive]
17332pub struct MacVerifyResponse {
17333 /// The resource name of the
17334 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
17335 /// verification. Check this field to verify that the intended resource was
17336 /// used for verification.
17337 ///
17338 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
17339 pub name: std::string::String,
17340
17341 /// This field indicates whether or not the verification operation for
17342 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
17343 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
17344 /// successful.
17345 ///
17346 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
17347 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
17348 pub success: bool,
17349
17350 /// Integrity verification field. A flag indicating whether
17351 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
17352 /// was received by
17353 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
17354 /// for the integrity verification of the
17355 /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
17356 /// field indicates either that
17357 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
17358 /// was left unset or that it was not delivered to
17359 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
17360 /// set
17361 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
17362 /// but this field is still false, discard the response and perform a limited
17363 /// number of retries.
17364 ///
17365 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
17366 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
17367 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
17368 pub verified_data_crc32c: bool,
17369
17370 /// Integrity verification field. A flag indicating whether
17371 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
17372 /// was received by
17373 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
17374 /// for the integrity verification of the
17375 /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
17376 /// field indicates either that
17377 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
17378 /// was left unset or that it was not delivered to
17379 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
17380 /// set
17381 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
17382 /// but this field is still false, discard the response and perform a limited
17383 /// number of retries.
17384 ///
17385 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
17386 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
17387 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
17388 pub verified_mac_crc32c: bool,
17389
17390 /// Integrity verification field. This value is used for the integrity
17391 /// verification of [MacVerifyResponse.success]. If the value of this field
17392 /// contradicts the value of [MacVerifyResponse.success], discard the response
17393 /// and perform a limited number of retries.
17394 pub verified_success_integrity: bool,
17395
17396 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
17397 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
17398 /// verification.
17399 ///
17400 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
17401 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17402 pub protection_level: crate::model::ProtectionLevel,
17403
17404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17405}
17406
17407impl MacVerifyResponse {
17408 /// Creates a new default instance.
17409 pub fn new() -> Self {
17410 std::default::Default::default()
17411 }
17412
17413 /// Sets the value of [name][crate::model::MacVerifyResponse::name].
17414 ///
17415 /// # Example
17416 /// ```ignore,no_run
17417 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
17418 /// let x = MacVerifyResponse::new().set_name("example");
17419 /// ```
17420 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17421 self.name = v.into();
17422 self
17423 }
17424
17425 /// Sets the value of [success][crate::model::MacVerifyResponse::success].
17426 ///
17427 /// # Example
17428 /// ```ignore,no_run
17429 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
17430 /// let x = MacVerifyResponse::new().set_success(true);
17431 /// ```
17432 pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17433 self.success = v.into();
17434 self
17435 }
17436
17437 /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
17438 ///
17439 /// # Example
17440 /// ```ignore,no_run
17441 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
17442 /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
17443 /// ```
17444 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17445 self.verified_data_crc32c = v.into();
17446 self
17447 }
17448
17449 /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
17450 ///
17451 /// # Example
17452 /// ```ignore,no_run
17453 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
17454 /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
17455 /// ```
17456 pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17457 self.verified_mac_crc32c = v.into();
17458 self
17459 }
17460
17461 /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
17462 ///
17463 /// # Example
17464 /// ```ignore,no_run
17465 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
17466 /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
17467 /// ```
17468 pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17469 self.verified_success_integrity = v.into();
17470 self
17471 }
17472
17473 /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
17474 ///
17475 /// # Example
17476 /// ```ignore,no_run
17477 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
17478 /// use google_cloud_kms_v1::model::ProtectionLevel;
17479 /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
17480 /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
17481 /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
17482 /// ```
17483 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
17484 mut self,
17485 v: T,
17486 ) -> Self {
17487 self.protection_level = v.into();
17488 self
17489 }
17490}
17491
17492impl wkt::message::Message for MacVerifyResponse {
17493 fn typename() -> &'static str {
17494 "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
17495 }
17496}
17497
17498/// Response message for
17499/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
17500///
17501/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
17502#[derive(Clone, Default, PartialEq)]
17503#[non_exhaustive]
17504pub struct DecapsulateResponse {
17505 /// The resource name of the
17506 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
17507 /// decapsulation. Check this field to verify that the intended resource was
17508 /// used for decapsulation.
17509 ///
17510 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
17511 pub name: std::string::String,
17512
17513 /// The decapsulated shared_secret originally encapsulated with the matching
17514 /// public key.
17515 pub shared_secret: ::bytes::Bytes,
17516
17517 /// Integrity verification field. A CRC32C checksum of the returned
17518 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
17519 /// An integrity check of
17520 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
17521 /// can be performed by computing the CRC32C checksum of
17522 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
17523 /// and comparing your results to this field. Discard the response in case of
17524 /// non-matching checksum values, and perform a limited number of retries. A
17525 /// persistent mismatch may indicate an issue in your computation of the CRC32C
17526 /// checksum. Note: receiving this response message indicates that
17527 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
17528 /// successfully decrypt the
17529 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
17530 /// field is defined as int64 for reasons of compatibility across different
17531 /// languages. However, it is a non-negative integer, which will never exceed
17532 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
17533 /// this type.
17534 ///
17535 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
17536 /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
17537 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
17538 pub shared_secret_crc32c: std::option::Option<i64>,
17539
17540 /// Integrity verification field. A flag indicating whether
17541 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
17542 /// was received by
17543 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
17544 /// for the integrity verification of the
17545 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
17546 /// value of this field indicates either that
17547 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
17548 /// was left unset or that it was not delivered to
17549 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
17550 /// set
17551 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
17552 /// but this field is still false, discard the response and perform a limited
17553 /// number of retries.
17554 ///
17555 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
17556 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
17557 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
17558 pub verified_ciphertext_crc32c: bool,
17559
17560 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
17561 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
17562 /// decapsulation.
17563 ///
17564 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
17565 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17566 pub protection_level: crate::model::ProtectionLevel,
17567
17568 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17569}
17570
17571impl DecapsulateResponse {
17572 /// Creates a new default instance.
17573 pub fn new() -> Self {
17574 std::default::Default::default()
17575 }
17576
17577 /// Sets the value of [name][crate::model::DecapsulateResponse::name].
17578 ///
17579 /// # Example
17580 /// ```ignore,no_run
17581 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17582 /// let x = DecapsulateResponse::new().set_name("example");
17583 /// ```
17584 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17585 self.name = v.into();
17586 self
17587 }
17588
17589 /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
17590 ///
17591 /// # Example
17592 /// ```ignore,no_run
17593 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17594 /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
17595 /// ```
17596 pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17597 self.shared_secret = v.into();
17598 self
17599 }
17600
17601 /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
17602 ///
17603 /// # Example
17604 /// ```ignore,no_run
17605 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17606 /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
17607 /// ```
17608 pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
17609 where
17610 T: std::convert::Into<i64>,
17611 {
17612 self.shared_secret_crc32c = std::option::Option::Some(v.into());
17613 self
17614 }
17615
17616 /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
17617 ///
17618 /// # Example
17619 /// ```ignore,no_run
17620 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17621 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
17622 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
17623 /// ```
17624 pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
17625 where
17626 T: std::convert::Into<i64>,
17627 {
17628 self.shared_secret_crc32c = v.map(|x| x.into());
17629 self
17630 }
17631
17632 /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
17633 ///
17634 /// # Example
17635 /// ```ignore,no_run
17636 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17637 /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
17638 /// ```
17639 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17640 self.verified_ciphertext_crc32c = v.into();
17641 self
17642 }
17643
17644 /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
17645 ///
17646 /// # Example
17647 /// ```ignore,no_run
17648 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
17649 /// use google_cloud_kms_v1::model::ProtectionLevel;
17650 /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
17651 /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
17652 /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
17653 /// ```
17654 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
17655 mut self,
17656 v: T,
17657 ) -> Self {
17658 self.protection_level = v.into();
17659 self
17660 }
17661}
17662
17663impl wkt::message::Message for DecapsulateResponse {
17664 fn typename() -> &'static str {
17665 "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
17666 }
17667}
17668
17669/// Response message for
17670/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
17671///
17672/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
17673#[derive(Clone, Default, PartialEq)]
17674#[non_exhaustive]
17675pub struct GenerateRandomBytesResponse {
17676 /// The generated data.
17677 pub data: ::bytes::Bytes,
17678
17679 /// Integrity verification field. A CRC32C checksum of the returned
17680 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
17681 /// An integrity check of
17682 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
17683 /// can be performed by computing the CRC32C checksum of
17684 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
17685 /// and comparing your results to this field. Discard the response in case of
17686 /// non-matching checksum values, and perform a limited number of retries. A
17687 /// persistent mismatch may indicate an issue in your computation of the CRC32C
17688 /// checksum. Note: This field is defined as int64 for reasons of compatibility
17689 /// across different languages. However, it is a non-negative integer, which
17690 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
17691 /// languages that support this type.
17692 ///
17693 /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
17694 pub data_crc32c: std::option::Option<wkt::Int64Value>,
17695
17696 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17697}
17698
17699impl GenerateRandomBytesResponse {
17700 /// Creates a new default instance.
17701 pub fn new() -> Self {
17702 std::default::Default::default()
17703 }
17704
17705 /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
17706 ///
17707 /// # Example
17708 /// ```ignore,no_run
17709 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17710 /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
17711 /// ```
17712 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17713 self.data = v.into();
17714 self
17715 }
17716
17717 /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
17718 ///
17719 /// # Example
17720 /// ```ignore,no_run
17721 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17722 /// use wkt::Int64Value;
17723 /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
17724 /// ```
17725 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
17726 where
17727 T: std::convert::Into<wkt::Int64Value>,
17728 {
17729 self.data_crc32c = std::option::Option::Some(v.into());
17730 self
17731 }
17732
17733 /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
17734 ///
17735 /// # Example
17736 /// ```ignore,no_run
17737 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17738 /// use wkt::Int64Value;
17739 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
17740 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
17741 /// ```
17742 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
17743 where
17744 T: std::convert::Into<wkt::Int64Value>,
17745 {
17746 self.data_crc32c = v.map(|x| x.into());
17747 self
17748 }
17749}
17750
17751impl wkt::message::Message for GenerateRandomBytesResponse {
17752 fn typename() -> &'static str {
17753 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
17754 }
17755}
17756
17757/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
17758///
17759/// [google.cloud.kms.v1.Digest]: crate::model::Digest
17760#[derive(Clone, Default, PartialEq)]
17761#[non_exhaustive]
17762pub struct Digest {
17763 /// Required. The message digest.
17764 pub digest: std::option::Option<crate::model::digest::Digest>,
17765
17766 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17767}
17768
17769impl Digest {
17770 /// Creates a new default instance.
17771 pub fn new() -> Self {
17772 std::default::Default::default()
17773 }
17774
17775 /// Sets the value of [digest][crate::model::Digest::digest].
17776 ///
17777 /// Note that all the setters affecting `digest` are mutually
17778 /// exclusive.
17779 ///
17780 /// # Example
17781 /// ```ignore,no_run
17782 /// # use google_cloud_kms_v1::model::Digest;
17783 /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
17784 /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
17785 /// ```
17786 pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
17787 mut self,
17788 v: T,
17789 ) -> Self {
17790 self.digest = v.into();
17791 self
17792 }
17793
17794 /// The value of [digest][crate::model::Digest::digest]
17795 /// if it holds a `Sha256`, `None` if the field is not set or
17796 /// holds a different branch.
17797 pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
17798 #[allow(unreachable_patterns)]
17799 self.digest.as_ref().and_then(|v| match v {
17800 crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
17801 _ => std::option::Option::None,
17802 })
17803 }
17804
17805 /// Sets the value of [digest][crate::model::Digest::digest]
17806 /// to hold a `Sha256`.
17807 ///
17808 /// Note that all the setters affecting `digest` are
17809 /// mutually exclusive.
17810 ///
17811 /// # Example
17812 /// ```ignore,no_run
17813 /// # use google_cloud_kms_v1::model::Digest;
17814 /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
17815 /// assert!(x.sha256().is_some());
17816 /// assert!(x.sha384().is_none());
17817 /// assert!(x.sha512().is_none());
17818 /// assert!(x.external_mu().is_none());
17819 /// ```
17820 pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17821 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
17822 self
17823 }
17824
17825 /// The value of [digest][crate::model::Digest::digest]
17826 /// if it holds a `Sha384`, `None` if the field is not set or
17827 /// holds a different branch.
17828 pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
17829 #[allow(unreachable_patterns)]
17830 self.digest.as_ref().and_then(|v| match v {
17831 crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
17832 _ => std::option::Option::None,
17833 })
17834 }
17835
17836 /// Sets the value of [digest][crate::model::Digest::digest]
17837 /// to hold a `Sha384`.
17838 ///
17839 /// Note that all the setters affecting `digest` are
17840 /// mutually exclusive.
17841 ///
17842 /// # Example
17843 /// ```ignore,no_run
17844 /// # use google_cloud_kms_v1::model::Digest;
17845 /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
17846 /// assert!(x.sha384().is_some());
17847 /// assert!(x.sha256().is_none());
17848 /// assert!(x.sha512().is_none());
17849 /// assert!(x.external_mu().is_none());
17850 /// ```
17851 pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17852 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
17853 self
17854 }
17855
17856 /// The value of [digest][crate::model::Digest::digest]
17857 /// if it holds a `Sha512`, `None` if the field is not set or
17858 /// holds a different branch.
17859 pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
17860 #[allow(unreachable_patterns)]
17861 self.digest.as_ref().and_then(|v| match v {
17862 crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
17863 _ => std::option::Option::None,
17864 })
17865 }
17866
17867 /// Sets the value of [digest][crate::model::Digest::digest]
17868 /// to hold a `Sha512`.
17869 ///
17870 /// Note that all the setters affecting `digest` are
17871 /// mutually exclusive.
17872 ///
17873 /// # Example
17874 /// ```ignore,no_run
17875 /// # use google_cloud_kms_v1::model::Digest;
17876 /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
17877 /// assert!(x.sha512().is_some());
17878 /// assert!(x.sha256().is_none());
17879 /// assert!(x.sha384().is_none());
17880 /// assert!(x.external_mu().is_none());
17881 /// ```
17882 pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17883 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
17884 self
17885 }
17886
17887 /// The value of [digest][crate::model::Digest::digest]
17888 /// if it holds a `ExternalMu`, `None` if the field is not set or
17889 /// holds a different branch.
17890 pub fn external_mu(&self) -> std::option::Option<&::bytes::Bytes> {
17891 #[allow(unreachable_patterns)]
17892 self.digest.as_ref().and_then(|v| match v {
17893 crate::model::digest::Digest::ExternalMu(v) => std::option::Option::Some(v),
17894 _ => std::option::Option::None,
17895 })
17896 }
17897
17898 /// Sets the value of [digest][crate::model::Digest::digest]
17899 /// to hold a `ExternalMu`.
17900 ///
17901 /// Note that all the setters affecting `digest` are
17902 /// mutually exclusive.
17903 ///
17904 /// # Example
17905 /// ```ignore,no_run
17906 /// # use google_cloud_kms_v1::model::Digest;
17907 /// let x = Digest::new().set_external_mu(bytes::Bytes::from_static(b"example"));
17908 /// assert!(x.external_mu().is_some());
17909 /// assert!(x.sha256().is_none());
17910 /// assert!(x.sha384().is_none());
17911 /// assert!(x.sha512().is_none());
17912 /// ```
17913 pub fn set_external_mu<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17914 self.digest = std::option::Option::Some(crate::model::digest::Digest::ExternalMu(v.into()));
17915 self
17916 }
17917}
17918
17919impl wkt::message::Message for Digest {
17920 fn typename() -> &'static str {
17921 "type.googleapis.com/google.cloud.kms.v1.Digest"
17922 }
17923}
17924
17925/// Defines additional types related to [Digest].
17926pub mod digest {
17927 #[allow(unused_imports)]
17928 use super::*;
17929
17930 /// Required. The message digest.
17931 #[derive(Clone, Debug, PartialEq)]
17932 #[non_exhaustive]
17933 pub enum Digest {
17934 /// A message digest produced with the SHA-256 algorithm.
17935 Sha256(::bytes::Bytes),
17936 /// A message digest produced with the SHA-384 algorithm.
17937 Sha384(::bytes::Bytes),
17938 /// A message digest produced with the SHA-512 algorithm.
17939 Sha512(::bytes::Bytes),
17940 /// A message digest produced with SHAKE-256, to be used with ML-DSA
17941 /// external-μ algorithms only. See "message representative" note in
17942 /// section 6.2, algorithm 7 of the FIPS-204 standard:
17943 /// <https://doi.org/10.6028/nist.fips.204>
17944 ExternalMu(::bytes::Bytes),
17945 }
17946}
17947
17948/// Cloud KMS metadata for the given
17949/// [google.cloud.location.Location][google.cloud.location.Location].
17950///
17951/// [google.cloud.location.Location]: google_cloud_location::model::Location
17952#[derive(Clone, Default, PartialEq)]
17953#[non_exhaustive]
17954pub struct LocationMetadata {
17955 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17956 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17957 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
17958 /// location.
17959 ///
17960 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17961 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17962 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
17963 pub hsm_available: bool,
17964
17965 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17966 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17967 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
17968 /// this location.
17969 ///
17970 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17971 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17972 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
17973 pub ekm_available: bool,
17974
17975 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17976 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17977 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
17978 /// can be created in this location.
17979 ///
17980 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17981 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17982 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
17983 pub hsm_single_tenant_available: bool,
17984
17985 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17986}
17987
17988impl LocationMetadata {
17989 /// Creates a new default instance.
17990 pub fn new() -> Self {
17991 std::default::Default::default()
17992 }
17993
17994 /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
17995 ///
17996 /// # Example
17997 /// ```ignore,no_run
17998 /// # use google_cloud_kms_v1::model::LocationMetadata;
17999 /// let x = LocationMetadata::new().set_hsm_available(true);
18000 /// ```
18001 pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18002 self.hsm_available = v.into();
18003 self
18004 }
18005
18006 /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
18007 ///
18008 /// # Example
18009 /// ```ignore,no_run
18010 /// # use google_cloud_kms_v1::model::LocationMetadata;
18011 /// let x = LocationMetadata::new().set_ekm_available(true);
18012 /// ```
18013 pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18014 self.ekm_available = v.into();
18015 self
18016 }
18017
18018 /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
18019 ///
18020 /// # Example
18021 /// ```ignore,no_run
18022 /// # use google_cloud_kms_v1::model::LocationMetadata;
18023 /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
18024 /// ```
18025 pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18026 self.hsm_single_tenant_available = v.into();
18027 self
18028 }
18029}
18030
18031impl wkt::message::Message for LocationMetadata {
18032 fn typename() -> &'static str {
18033 "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
18034 }
18035}
18036
18037/// Represents the metadata of the
18038/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]
18039/// long-running operation.
18040///
18041/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
18042#[derive(Clone, Default, PartialEq)]
18043#[non_exhaustive]
18044pub struct DeleteCryptoKeyMetadata {
18045 /// Output only. The resource name of the
18046 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] created as a result
18047 /// of this operation, in the format
18048 /// `projects/*/locations/*/retiredResources/*`.
18049 ///
18050 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
18051 pub retired_resource: std::string::String,
18052
18053 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18054}
18055
18056impl DeleteCryptoKeyMetadata {
18057 /// Creates a new default instance.
18058 pub fn new() -> Self {
18059 std::default::Default::default()
18060 }
18061
18062 /// Sets the value of [retired_resource][crate::model::DeleteCryptoKeyMetadata::retired_resource].
18063 ///
18064 /// # Example
18065 /// ```ignore,no_run
18066 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyMetadata;
18067 /// # let project_id = "project_id";
18068 /// # let location_id = "location_id";
18069 /// # let retired_resource_id = "retired_resource_id";
18070 /// let x = DeleteCryptoKeyMetadata::new().set_retired_resource(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
18071 /// ```
18072 pub fn set_retired_resource<T: std::convert::Into<std::string::String>>(
18073 mut self,
18074 v: T,
18075 ) -> Self {
18076 self.retired_resource = v.into();
18077 self
18078 }
18079}
18080
18081impl wkt::message::Message for DeleteCryptoKeyMetadata {
18082 fn typename() -> &'static str {
18083 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyMetadata"
18084 }
18085}
18086
18087/// Represents the metadata of the
18088/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]
18089/// long-running operation.
18090///
18091/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
18092#[derive(Clone, Default, PartialEq)]
18093#[non_exhaustive]
18094pub struct DeleteCryptoKeyVersionMetadata {
18095 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18096}
18097
18098impl DeleteCryptoKeyVersionMetadata {
18099 /// Creates a new default instance.
18100 pub fn new() -> Self {
18101 std::default::Default::default()
18102 }
18103}
18104
18105impl wkt::message::Message for DeleteCryptoKeyVersionMetadata {
18106 fn typename() -> &'static str {
18107 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionMetadata"
18108 }
18109}
18110
18111/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
18112/// cryptographic operations are performed. For more information, see [Protection
18113/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
18114///
18115/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
18116///
18117/// # Working with unknown values
18118///
18119/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18120/// additional enum variants at any time. Adding new variants is not considered
18121/// a breaking change. Applications should write their code in anticipation of:
18122///
18123/// - New values appearing in future releases of the client library, **and**
18124/// - New values received dynamically, without application changes.
18125///
18126/// Please consult the [Working with enums] section in the user guide for some
18127/// guidelines.
18128///
18129/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18130#[derive(Clone, Debug, PartialEq)]
18131#[non_exhaustive]
18132pub enum ProtectionLevel {
18133 /// Not specified.
18134 Unspecified,
18135 /// Crypto operations are performed in software.
18136 Software,
18137 /// Crypto operations are performed in a Hardware Security Module.
18138 Hsm,
18139 /// Crypto operations are performed by an external key manager.
18140 External,
18141 /// Crypto operations are performed in an EKM-over-VPC backend.
18142 ExternalVpc,
18143 /// Crypto operations are performed in a single-tenant HSM.
18144 HsmSingleTenant,
18145 /// If set, the enum was initialized with an unknown value.
18146 ///
18147 /// Applications can examine the value using [ProtectionLevel::value] or
18148 /// [ProtectionLevel::name].
18149 UnknownValue(protection_level::UnknownValue),
18150}
18151
18152#[doc(hidden)]
18153pub mod protection_level {
18154 #[allow(unused_imports)]
18155 use super::*;
18156 #[derive(Clone, Debug, PartialEq)]
18157 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18158}
18159
18160impl ProtectionLevel {
18161 /// Gets the enum value.
18162 ///
18163 /// Returns `None` if the enum contains an unknown value deserialized from
18164 /// the string representation of enums.
18165 pub fn value(&self) -> std::option::Option<i32> {
18166 match self {
18167 Self::Unspecified => std::option::Option::Some(0),
18168 Self::Software => std::option::Option::Some(1),
18169 Self::Hsm => std::option::Option::Some(2),
18170 Self::External => std::option::Option::Some(3),
18171 Self::ExternalVpc => std::option::Option::Some(4),
18172 Self::HsmSingleTenant => std::option::Option::Some(5),
18173 Self::UnknownValue(u) => u.0.value(),
18174 }
18175 }
18176
18177 /// Gets the enum value as a string.
18178 ///
18179 /// Returns `None` if the enum contains an unknown value deserialized from
18180 /// the integer representation of enums.
18181 pub fn name(&self) -> std::option::Option<&str> {
18182 match self {
18183 Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
18184 Self::Software => std::option::Option::Some("SOFTWARE"),
18185 Self::Hsm => std::option::Option::Some("HSM"),
18186 Self::External => std::option::Option::Some("EXTERNAL"),
18187 Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
18188 Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
18189 Self::UnknownValue(u) => u.0.name(),
18190 }
18191 }
18192}
18193
18194impl std::default::Default for ProtectionLevel {
18195 fn default() -> Self {
18196 use std::convert::From;
18197 Self::from(0)
18198 }
18199}
18200
18201impl std::fmt::Display for ProtectionLevel {
18202 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18203 wkt::internal::display_enum(f, self.name(), self.value())
18204 }
18205}
18206
18207impl std::convert::From<i32> for ProtectionLevel {
18208 fn from(value: i32) -> Self {
18209 match value {
18210 0 => Self::Unspecified,
18211 1 => Self::Software,
18212 2 => Self::Hsm,
18213 3 => Self::External,
18214 4 => Self::ExternalVpc,
18215 5 => Self::HsmSingleTenant,
18216 _ => Self::UnknownValue(protection_level::UnknownValue(
18217 wkt::internal::UnknownEnumValue::Integer(value),
18218 )),
18219 }
18220 }
18221}
18222
18223impl std::convert::From<&str> for ProtectionLevel {
18224 fn from(value: &str) -> Self {
18225 use std::string::ToString;
18226 match value {
18227 "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
18228 "SOFTWARE" => Self::Software,
18229 "HSM" => Self::Hsm,
18230 "EXTERNAL" => Self::External,
18231 "EXTERNAL_VPC" => Self::ExternalVpc,
18232 "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
18233 _ => Self::UnknownValue(protection_level::UnknownValue(
18234 wkt::internal::UnknownEnumValue::String(value.to_string()),
18235 )),
18236 }
18237 }
18238}
18239
18240impl serde::ser::Serialize for ProtectionLevel {
18241 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18242 where
18243 S: serde::Serializer,
18244 {
18245 match self {
18246 Self::Unspecified => serializer.serialize_i32(0),
18247 Self::Software => serializer.serialize_i32(1),
18248 Self::Hsm => serializer.serialize_i32(2),
18249 Self::External => serializer.serialize_i32(3),
18250 Self::ExternalVpc => serializer.serialize_i32(4),
18251 Self::HsmSingleTenant => serializer.serialize_i32(5),
18252 Self::UnknownValue(u) => u.0.serialize(serializer),
18253 }
18254 }
18255}
18256
18257impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
18258 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18259 where
18260 D: serde::Deserializer<'de>,
18261 {
18262 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
18263 ".google.cloud.kms.v1.ProtectionLevel",
18264 ))
18265 }
18266}
18267
18268/// Describes the reason for a data access. Please refer to
18269/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
18270/// for the detailed semantic meaning of justification reason codes.
18271///
18272/// # Working with unknown values
18273///
18274/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18275/// additional enum variants at any time. Adding new variants is not considered
18276/// a breaking change. Applications should write their code in anticipation of:
18277///
18278/// - New values appearing in future releases of the client library, **and**
18279/// - New values received dynamically, without application changes.
18280///
18281/// Please consult the [Working with enums] section in the user guide for some
18282/// guidelines.
18283///
18284/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18285#[derive(Clone, Debug, PartialEq)]
18286#[non_exhaustive]
18287pub enum AccessReason {
18288 /// Unspecified access reason.
18289 ReasonUnspecified,
18290 /// Customer-initiated support.
18291 CustomerInitiatedSupport,
18292 /// Google-initiated access for system management and troubleshooting.
18293 GoogleInitiatedService,
18294 /// Google-initiated access in response to a legal request or legal process.
18295 ThirdPartyDataRequest,
18296 /// Google-initiated access for security, fraud, abuse, or compliance purposes.
18297 GoogleInitiatedReview,
18298 /// Customer uses their account to perform any access to their own data which
18299 /// their IAM policy authorizes.
18300 CustomerInitiatedAccess,
18301 /// Google systems access customer data to help optimize the structure of the
18302 /// data or quality for future uses by the customer.
18303 GoogleInitiatedSystemOperation,
18304 /// No reason is expected for this key request.
18305 ReasonNotExpected,
18306 /// Deprecated: This code is no longer generated by
18307 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
18308 /// available in both Key Access Justifications and Access Transparency logs
18309 /// provide customer-visible signals of emergency access in more precise
18310 /// contexts.
18311 ///
18312 /// Customer uses their account to perform any access to their own data which
18313 /// their IAM policy authorizes, and one of the following is true:
18314 ///
18315 /// * A Google administrator has reset the root-access account associated with
18316 /// the user's organization within the past 7 days.
18317 /// * A Google-initiated emergency access operation has interacted with a
18318 /// resource in the same project or folder as the currently accessed resource
18319 /// within the past 7 days.
18320 #[deprecated]
18321 ModifiedCustomerInitiatedAccess,
18322 /// Deprecated: This code is no longer generated by
18323 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
18324 /// available in both Key Access Justifications and Access Transparency logs
18325 /// provide customer-visible signals of emergency access in more precise
18326 /// contexts.
18327 ///
18328 /// Google systems access customer data to help optimize the structure of the
18329 /// data or quality for future uses by the customer, and one of the following
18330 /// is true:
18331 ///
18332 /// * A Google administrator has reset the root-access account associated with
18333 /// the user's organization within the past 7 days.
18334 /// * A Google-initiated emergency access operation has interacted with a
18335 /// resource in the same project or folder as the currently accessed resource
18336 /// within the past 7 days.
18337 #[deprecated]
18338 ModifiedGoogleInitiatedSystemOperation,
18339 /// Google-initiated access to maintain system reliability.
18340 GoogleResponseToProductionAlert,
18341 /// One of the following operations is being executed while simultaneously
18342 /// encountering an internal technical issue which prevented a more precise
18343 /// justification code from being generated:
18344 ///
18345 /// * Your account has been used to perform any access to your own data which
18346 /// your IAM policy authorizes.
18347 /// * An automated Google system operates on encrypted customer data which your
18348 /// IAM policy authorizes.
18349 /// * Customer-initiated Google support access.
18350 /// * Google-initiated support access to protect system reliability.
18351 CustomerAuthorizedWorkflowServicing,
18352 /// If set, the enum was initialized with an unknown value.
18353 ///
18354 /// Applications can examine the value using [AccessReason::value] or
18355 /// [AccessReason::name].
18356 UnknownValue(access_reason::UnknownValue),
18357}
18358
18359#[doc(hidden)]
18360pub mod access_reason {
18361 #[allow(unused_imports)]
18362 use super::*;
18363 #[derive(Clone, Debug, PartialEq)]
18364 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18365}
18366
18367impl AccessReason {
18368 /// Gets the enum value.
18369 ///
18370 /// Returns `None` if the enum contains an unknown value deserialized from
18371 /// the string representation of enums.
18372 pub fn value(&self) -> std::option::Option<i32> {
18373 match self {
18374 Self::ReasonUnspecified => std::option::Option::Some(0),
18375 Self::CustomerInitiatedSupport => std::option::Option::Some(1),
18376 Self::GoogleInitiatedService => std::option::Option::Some(2),
18377 Self::ThirdPartyDataRequest => std::option::Option::Some(3),
18378 Self::GoogleInitiatedReview => std::option::Option::Some(4),
18379 Self::CustomerInitiatedAccess => std::option::Option::Some(5),
18380 Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
18381 Self::ReasonNotExpected => std::option::Option::Some(7),
18382 Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
18383 Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
18384 Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
18385 Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
18386 Self::UnknownValue(u) => u.0.value(),
18387 }
18388 }
18389
18390 /// Gets the enum value as a string.
18391 ///
18392 /// Returns `None` if the enum contains an unknown value deserialized from
18393 /// the integer representation of enums.
18394 pub fn name(&self) -> std::option::Option<&str> {
18395 match self {
18396 Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
18397 Self::CustomerInitiatedSupport => {
18398 std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
18399 }
18400 Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
18401 Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
18402 Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
18403 Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
18404 Self::GoogleInitiatedSystemOperation => {
18405 std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
18406 }
18407 Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
18408 Self::ModifiedCustomerInitiatedAccess => {
18409 std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
18410 }
18411 Self::ModifiedGoogleInitiatedSystemOperation => {
18412 std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
18413 }
18414 Self::GoogleResponseToProductionAlert => {
18415 std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
18416 }
18417 Self::CustomerAuthorizedWorkflowServicing => {
18418 std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
18419 }
18420 Self::UnknownValue(u) => u.0.name(),
18421 }
18422 }
18423}
18424
18425impl std::default::Default for AccessReason {
18426 fn default() -> Self {
18427 use std::convert::From;
18428 Self::from(0)
18429 }
18430}
18431
18432impl std::fmt::Display for AccessReason {
18433 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18434 wkt::internal::display_enum(f, self.name(), self.value())
18435 }
18436}
18437
18438impl std::convert::From<i32> for AccessReason {
18439 fn from(value: i32) -> Self {
18440 match value {
18441 0 => Self::ReasonUnspecified,
18442 1 => Self::CustomerInitiatedSupport,
18443 2 => Self::GoogleInitiatedService,
18444 3 => Self::ThirdPartyDataRequest,
18445 4 => Self::GoogleInitiatedReview,
18446 5 => Self::CustomerInitiatedAccess,
18447 6 => Self::GoogleInitiatedSystemOperation,
18448 7 => Self::ReasonNotExpected,
18449 8 => Self::ModifiedCustomerInitiatedAccess,
18450 9 => Self::ModifiedGoogleInitiatedSystemOperation,
18451 10 => Self::GoogleResponseToProductionAlert,
18452 11 => Self::CustomerAuthorizedWorkflowServicing,
18453 _ => Self::UnknownValue(access_reason::UnknownValue(
18454 wkt::internal::UnknownEnumValue::Integer(value),
18455 )),
18456 }
18457 }
18458}
18459
18460impl std::convert::From<&str> for AccessReason {
18461 fn from(value: &str) -> Self {
18462 use std::string::ToString;
18463 match value {
18464 "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
18465 "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
18466 "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
18467 "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
18468 "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
18469 "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
18470 "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
18471 "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
18472 "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
18473 "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
18474 Self::ModifiedGoogleInitiatedSystemOperation
18475 }
18476 "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
18477 "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
18478 _ => Self::UnknownValue(access_reason::UnknownValue(
18479 wkt::internal::UnknownEnumValue::String(value.to_string()),
18480 )),
18481 }
18482 }
18483}
18484
18485impl serde::ser::Serialize for AccessReason {
18486 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18487 where
18488 S: serde::Serializer,
18489 {
18490 match self {
18491 Self::ReasonUnspecified => serializer.serialize_i32(0),
18492 Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
18493 Self::GoogleInitiatedService => serializer.serialize_i32(2),
18494 Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
18495 Self::GoogleInitiatedReview => serializer.serialize_i32(4),
18496 Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
18497 Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
18498 Self::ReasonNotExpected => serializer.serialize_i32(7),
18499 Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
18500 Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
18501 Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
18502 Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
18503 Self::UnknownValue(u) => u.0.serialize(serializer),
18504 }
18505 }
18506}
18507
18508impl<'de> serde::de::Deserialize<'de> for AccessReason {
18509 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18510 where
18511 D: serde::Deserializer<'de>,
18512 {
18513 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
18514 ".google.cloud.kms.v1.AccessReason",
18515 ))
18516 }
18517}