google_cloud_kms_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate lazy_static;
29extern crate serde;
30extern crate serde_json;
31extern crate serde_with;
32extern crate std;
33extern crate tracing;
34extern crate wkt;
35
36mod debug;
37mod deserialize;
38mod serialize;
39
40/// Request message for
41/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
42///
43/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct CreateKeyHandleRequest {
47 /// Required. Name of the resource project and location to create the
48 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
49 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
50 ///
51 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
52 pub parent: std::string::String,
53
54 /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
55 /// unique to the resource project and location. If not provided by the caller,
56 /// a new UUID is used.
57 ///
58 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
59 pub key_handle_id: std::string::String,
60
61 /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
62 ///
63 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
64 pub key_handle: std::option::Option<crate::model::KeyHandle>,
65
66 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
67}
68
69impl CreateKeyHandleRequest {
70 pub fn new() -> Self {
71 std::default::Default::default()
72 }
73
74 /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
75 ///
76 /// # Example
77 /// ```ignore,no_run
78 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
79 /// let x = CreateKeyHandleRequest::new().set_parent("example");
80 /// ```
81 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82 self.parent = v.into();
83 self
84 }
85
86 /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
87 ///
88 /// # Example
89 /// ```ignore,no_run
90 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
91 /// let x = CreateKeyHandleRequest::new().set_key_handle_id("example");
92 /// ```
93 pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94 self.key_handle_id = v.into();
95 self
96 }
97
98 /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
99 ///
100 /// # Example
101 /// ```ignore,no_run
102 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
103 /// use google_cloud_kms_v1::model::KeyHandle;
104 /// let x = CreateKeyHandleRequest::new().set_key_handle(KeyHandle::default()/* use setters */);
105 /// ```
106 pub fn set_key_handle<T>(mut self, v: T) -> Self
107 where
108 T: std::convert::Into<crate::model::KeyHandle>,
109 {
110 self.key_handle = std::option::Option::Some(v.into());
111 self
112 }
113
114 /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
119 /// use google_cloud_kms_v1::model::KeyHandle;
120 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(Some(KeyHandle::default()/* use setters */));
121 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(None::<KeyHandle>);
122 /// ```
123 pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
124 where
125 T: std::convert::Into<crate::model::KeyHandle>,
126 {
127 self.key_handle = v.map(|x| x.into());
128 self
129 }
130}
131
132impl wkt::message::Message for CreateKeyHandleRequest {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
135 }
136}
137
138/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
139///
140/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
141#[derive(Clone, Default, PartialEq)]
142#[non_exhaustive]
143pub struct GetKeyHandleRequest {
144 /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
145 /// e.g.
146 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
147 ///
148 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
149 pub name: std::string::String,
150
151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
152}
153
154impl GetKeyHandleRequest {
155 pub fn new() -> Self {
156 std::default::Default::default()
157 }
158
159 /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
160 ///
161 /// # Example
162 /// ```ignore,no_run
163 /// # use google_cloud_kms_v1::model::GetKeyHandleRequest;
164 /// let x = GetKeyHandleRequest::new().set_name("example");
165 /// ```
166 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167 self.name = v.into();
168 self
169 }
170}
171
172impl wkt::message::Message for GetKeyHandleRequest {
173 fn typename() -> &'static str {
174 "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
175 }
176}
177
178/// Resource-oriented representation of a request to Cloud KMS Autokey and the
179/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
180///
181/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
182#[derive(Clone, Default, PartialEq)]
183#[non_exhaustive]
184pub struct KeyHandle {
185 /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
186 /// resource, e.g.
187 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
188 ///
189 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
190 pub name: std::string::String,
191
192 /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
193 /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
194 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
195 /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
196 /// project will reflect the value configured in the
197 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
198 /// project's ancestor folder at the time of the
199 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
200 /// ancestor folder has a configured
201 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
202 /// configurations is used.
203 ///
204 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
205 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
206 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
207 pub kms_key: std::string::String,
208
209 /// Required. Indicates the resource type that the resulting
210 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
211 /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
212 /// types.
213 ///
214 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
215 pub resource_type_selector: std::string::String,
216
217 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
218}
219
220impl KeyHandle {
221 pub fn new() -> Self {
222 std::default::Default::default()
223 }
224
225 /// Sets the value of [name][crate::model::KeyHandle::name].
226 ///
227 /// # Example
228 /// ```ignore,no_run
229 /// # use google_cloud_kms_v1::model::KeyHandle;
230 /// let x = KeyHandle::new().set_name("example");
231 /// ```
232 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
233 self.name = v.into();
234 self
235 }
236
237 /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
238 ///
239 /// # Example
240 /// ```ignore,no_run
241 /// # use google_cloud_kms_v1::model::KeyHandle;
242 /// let x = KeyHandle::new().set_kms_key("example");
243 /// ```
244 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
245 self.kms_key = v.into();
246 self
247 }
248
249 /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
250 ///
251 /// # Example
252 /// ```ignore,no_run
253 /// # use google_cloud_kms_v1::model::KeyHandle;
254 /// let x = KeyHandle::new().set_resource_type_selector("example");
255 /// ```
256 pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
257 mut self,
258 v: T,
259 ) -> Self {
260 self.resource_type_selector = v.into();
261 self
262 }
263}
264
265impl wkt::message::Message for KeyHandle {
266 fn typename() -> &'static str {
267 "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
268 }
269}
270
271/// Metadata message for
272/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
273/// operation response.
274///
275/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
276#[derive(Clone, Default, PartialEq)]
277#[non_exhaustive]
278pub struct CreateKeyHandleMetadata {
279 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
280}
281
282impl CreateKeyHandleMetadata {
283 pub fn new() -> Self {
284 std::default::Default::default()
285 }
286}
287
288impl wkt::message::Message for CreateKeyHandleMetadata {
289 fn typename() -> &'static str {
290 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
291 }
292}
293
294/// Request message for
295/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
296///
297/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
298#[derive(Clone, Default, PartialEq)]
299#[non_exhaustive]
300pub struct ListKeyHandlesRequest {
301 /// Required. Name of the resource project and location from which to list
302 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
303 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
304 ///
305 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
306 pub parent: std::string::String,
307
308 /// Optional. Optional limit on the number of
309 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
310 /// service may return fewer than this value. Further
311 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
312 /// including the
313 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
314 /// in a subsequent request. If unspecified, at most 100
315 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
316 ///
317 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
318 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
319 pub page_size: i32,
320
321 /// Optional. Optional pagination token, returned earlier via
322 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
323 ///
324 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
325 pub page_token: std::string::String,
326
327 /// Optional. Filter to apply when listing
328 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
329 /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
330 ///
331 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
332 pub filter: std::string::String,
333
334 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
335}
336
337impl ListKeyHandlesRequest {
338 pub fn new() -> Self {
339 std::default::Default::default()
340 }
341
342 /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
343 ///
344 /// # Example
345 /// ```ignore,no_run
346 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
347 /// let x = ListKeyHandlesRequest::new().set_parent("example");
348 /// ```
349 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
350 self.parent = v.into();
351 self
352 }
353
354 /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
355 ///
356 /// # Example
357 /// ```ignore,no_run
358 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
359 /// let x = ListKeyHandlesRequest::new().set_page_size(42);
360 /// ```
361 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
362 self.page_size = v.into();
363 self
364 }
365
366 /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
367 ///
368 /// # Example
369 /// ```ignore,no_run
370 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
371 /// let x = ListKeyHandlesRequest::new().set_page_token("example");
372 /// ```
373 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
374 self.page_token = v.into();
375 self
376 }
377
378 /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
379 ///
380 /// # Example
381 /// ```ignore,no_run
382 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
383 /// let x = ListKeyHandlesRequest::new().set_filter("example");
384 /// ```
385 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
386 self.filter = v.into();
387 self
388 }
389}
390
391impl wkt::message::Message for ListKeyHandlesRequest {
392 fn typename() -> &'static str {
393 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
394 }
395}
396
397/// Response message for
398/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
399///
400/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
401#[derive(Clone, Default, PartialEq)]
402#[non_exhaustive]
403pub struct ListKeyHandlesResponse {
404 /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
405 ///
406 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
407 pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
408
409 /// A token to retrieve next page of results. Pass this value in
410 /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
411 /// to retrieve the next page of results.
412 ///
413 /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
414 pub next_page_token: std::string::String,
415
416 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
417}
418
419impl ListKeyHandlesResponse {
420 pub fn new() -> Self {
421 std::default::Default::default()
422 }
423
424 /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
425 ///
426 /// # Example
427 /// ```ignore,no_run
428 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
429 /// use google_cloud_kms_v1::model::KeyHandle;
430 /// let x = ListKeyHandlesResponse::new()
431 /// .set_key_handles([
432 /// KeyHandle::default()/* use setters */,
433 /// KeyHandle::default()/* use (different) setters */,
434 /// ]);
435 /// ```
436 pub fn set_key_handles<T, V>(mut self, v: T) -> Self
437 where
438 T: std::iter::IntoIterator<Item = V>,
439 V: std::convert::Into<crate::model::KeyHandle>,
440 {
441 use std::iter::Iterator;
442 self.key_handles = v.into_iter().map(|i| i.into()).collect();
443 self
444 }
445
446 /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
447 ///
448 /// # Example
449 /// ```ignore,no_run
450 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
451 /// let x = ListKeyHandlesResponse::new().set_next_page_token("example");
452 /// ```
453 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
454 self.next_page_token = v.into();
455 self
456 }
457}
458
459impl wkt::message::Message for ListKeyHandlesResponse {
460 fn typename() -> &'static str {
461 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
462 }
463}
464
465#[doc(hidden)]
466impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
467 type PageItem = crate::model::KeyHandle;
468
469 fn items(self) -> std::vec::Vec<Self::PageItem> {
470 self.key_handles
471 }
472
473 fn next_page_token(&self) -> std::string::String {
474 use std::clone::Clone;
475 self.next_page_token.clone()
476 }
477}
478
479/// Request message for
480/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
481///
482/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
483#[derive(Clone, Default, PartialEq)]
484#[non_exhaustive]
485pub struct UpdateAutokeyConfigRequest {
486 /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
487 /// update.
488 ///
489 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
490 pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
491
492 /// Required. Masks which fields of the
493 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
494 /// `keyProject`.
495 ///
496 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
497 pub update_mask: std::option::Option<wkt::FieldMask>,
498
499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
500}
501
502impl UpdateAutokeyConfigRequest {
503 pub fn new() -> Self {
504 std::default::Default::default()
505 }
506
507 /// Sets the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
508 ///
509 /// # Example
510 /// ```ignore,no_run
511 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
512 /// use google_cloud_kms_v1::model::AutokeyConfig;
513 /// let x = UpdateAutokeyConfigRequest::new().set_autokey_config(AutokeyConfig::default()/* use setters */);
514 /// ```
515 pub fn set_autokey_config<T>(mut self, v: T) -> Self
516 where
517 T: std::convert::Into<crate::model::AutokeyConfig>,
518 {
519 self.autokey_config = std::option::Option::Some(v.into());
520 self
521 }
522
523 /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
524 ///
525 /// # Example
526 /// ```ignore,no_run
527 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
528 /// use google_cloud_kms_v1::model::AutokeyConfig;
529 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(Some(AutokeyConfig::default()/* use setters */));
530 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(None::<AutokeyConfig>);
531 /// ```
532 pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
533 where
534 T: std::convert::Into<crate::model::AutokeyConfig>,
535 {
536 self.autokey_config = v.map(|x| x.into());
537 self
538 }
539
540 /// Sets the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
541 ///
542 /// # Example
543 /// ```ignore,no_run
544 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
545 /// use wkt::FieldMask;
546 /// let x = UpdateAutokeyConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
547 /// ```
548 pub fn set_update_mask<T>(mut self, v: T) -> Self
549 where
550 T: std::convert::Into<wkt::FieldMask>,
551 {
552 self.update_mask = std::option::Option::Some(v.into());
553 self
554 }
555
556 /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
557 ///
558 /// # Example
559 /// ```ignore,no_run
560 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
561 /// use wkt::FieldMask;
562 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
563 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
564 /// ```
565 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
566 where
567 T: std::convert::Into<wkt::FieldMask>,
568 {
569 self.update_mask = v.map(|x| x.into());
570 self
571 }
572}
573
574impl wkt::message::Message for UpdateAutokeyConfigRequest {
575 fn typename() -> &'static str {
576 "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
577 }
578}
579
580/// Request message for
581/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
582///
583/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
584#[derive(Clone, Default, PartialEq)]
585#[non_exhaustive]
586pub struct GetAutokeyConfigRequest {
587 /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
588 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
589 ///
590 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
591 pub name: std::string::String,
592
593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
594}
595
596impl GetAutokeyConfigRequest {
597 pub fn new() -> Self {
598 std::default::Default::default()
599 }
600
601 /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
602 ///
603 /// # Example
604 /// ```ignore,no_run
605 /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
606 /// let x = GetAutokeyConfigRequest::new().set_name("example");
607 /// ```
608 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
609 self.name = v.into();
610 self
611 }
612}
613
614impl wkt::message::Message for GetAutokeyConfigRequest {
615 fn typename() -> &'static str {
616 "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
617 }
618}
619
620/// Cloud KMS Autokey configuration for a folder.
621#[derive(Clone, Default, PartialEq)]
622#[non_exhaustive]
623pub struct AutokeyConfig {
624 /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
625 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`.
626 ///
627 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
628 pub name: std::string::String,
629
630 /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
631 /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
632 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
633 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
634 /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
635 /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
636 /// this key project. Once configured, for Cloud KMS Autokey to function
637 /// properly, this key project must have the Cloud KMS API activated and the
638 /// Cloud KMS Service Agent for this key project must be granted the
639 /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
640 /// key project field will clear the configuration.
641 ///
642 /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
643 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
644 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
645 pub key_project: std::string::String,
646
647 /// Output only. The state for the AutokeyConfig.
648 pub state: crate::model::autokey_config::State,
649
650 /// Optional. A checksum computed by the server based on the value of other
651 /// fields. This may be sent on update requests to ensure that the client has
652 /// an up-to-date value before proceeding. The request will be rejected with an
653 /// ABORTED error on a mismatched etag.
654 pub etag: std::string::String,
655
656 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
657}
658
659impl AutokeyConfig {
660 pub fn new() -> Self {
661 std::default::Default::default()
662 }
663
664 /// Sets the value of [name][crate::model::AutokeyConfig::name].
665 ///
666 /// # Example
667 /// ```ignore,no_run
668 /// # use google_cloud_kms_v1::model::AutokeyConfig;
669 /// let x = AutokeyConfig::new().set_name("example");
670 /// ```
671 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
672 self.name = v.into();
673 self
674 }
675
676 /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
677 ///
678 /// # Example
679 /// ```ignore,no_run
680 /// # use google_cloud_kms_v1::model::AutokeyConfig;
681 /// let x = AutokeyConfig::new().set_key_project("example");
682 /// ```
683 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
684 self.key_project = v.into();
685 self
686 }
687
688 /// Sets the value of [state][crate::model::AutokeyConfig::state].
689 ///
690 /// # Example
691 /// ```ignore,no_run
692 /// # use google_cloud_kms_v1::model::AutokeyConfig;
693 /// use google_cloud_kms_v1::model::autokey_config::State;
694 /// let x0 = AutokeyConfig::new().set_state(State::Active);
695 /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
696 /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
697 /// ```
698 pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
699 mut self,
700 v: T,
701 ) -> Self {
702 self.state = v.into();
703 self
704 }
705
706 /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
707 ///
708 /// # Example
709 /// ```ignore,no_run
710 /// # use google_cloud_kms_v1::model::AutokeyConfig;
711 /// let x = AutokeyConfig::new().set_etag("example");
712 /// ```
713 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
714 self.etag = v.into();
715 self
716 }
717}
718
719impl wkt::message::Message for AutokeyConfig {
720 fn typename() -> &'static str {
721 "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
722 }
723}
724
725/// Defines additional types related to [AutokeyConfig].
726pub mod autokey_config {
727 #[allow(unused_imports)]
728 use super::*;
729
730 /// The states AutokeyConfig can be in.
731 ///
732 /// # Working with unknown values
733 ///
734 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
735 /// additional enum variants at any time. Adding new variants is not considered
736 /// a breaking change. Applications should write their code in anticipation of:
737 ///
738 /// - New values appearing in future releases of the client library, **and**
739 /// - New values received dynamically, without application changes.
740 ///
741 /// Please consult the [Working with enums] section in the user guide for some
742 /// guidelines.
743 ///
744 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
745 #[derive(Clone, Debug, PartialEq)]
746 #[non_exhaustive]
747 pub enum State {
748 /// The state of the AutokeyConfig is unspecified.
749 Unspecified,
750 /// The AutokeyConfig is currently active.
751 Active,
752 /// A previously configured key project has been deleted and the current
753 /// AutokeyConfig is unusable.
754 KeyProjectDeleted,
755 /// The AutokeyConfig is not yet initialized or has been reset to its default
756 /// uninitialized state.
757 Uninitialized,
758 /// If set, the enum was initialized with an unknown value.
759 ///
760 /// Applications can examine the value using [State::value] or
761 /// [State::name].
762 UnknownValue(state::UnknownValue),
763 }
764
765 #[doc(hidden)]
766 pub mod state {
767 #[allow(unused_imports)]
768 use super::*;
769 #[derive(Clone, Debug, PartialEq)]
770 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
771 }
772
773 impl State {
774 /// Gets the enum value.
775 ///
776 /// Returns `None` if the enum contains an unknown value deserialized from
777 /// the string representation of enums.
778 pub fn value(&self) -> std::option::Option<i32> {
779 match self {
780 Self::Unspecified => std::option::Option::Some(0),
781 Self::Active => std::option::Option::Some(1),
782 Self::KeyProjectDeleted => std::option::Option::Some(2),
783 Self::Uninitialized => std::option::Option::Some(3),
784 Self::UnknownValue(u) => u.0.value(),
785 }
786 }
787
788 /// Gets the enum value as a string.
789 ///
790 /// Returns `None` if the enum contains an unknown value deserialized from
791 /// the integer representation of enums.
792 pub fn name(&self) -> std::option::Option<&str> {
793 match self {
794 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
795 Self::Active => std::option::Option::Some("ACTIVE"),
796 Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
797 Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
798 Self::UnknownValue(u) => u.0.name(),
799 }
800 }
801 }
802
803 impl std::default::Default for State {
804 fn default() -> Self {
805 use std::convert::From;
806 Self::from(0)
807 }
808 }
809
810 impl std::fmt::Display for State {
811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
812 wkt::internal::display_enum(f, self.name(), self.value())
813 }
814 }
815
816 impl std::convert::From<i32> for State {
817 fn from(value: i32) -> Self {
818 match value {
819 0 => Self::Unspecified,
820 1 => Self::Active,
821 2 => Self::KeyProjectDeleted,
822 3 => Self::Uninitialized,
823 _ => Self::UnknownValue(state::UnknownValue(
824 wkt::internal::UnknownEnumValue::Integer(value),
825 )),
826 }
827 }
828 }
829
830 impl std::convert::From<&str> for State {
831 fn from(value: &str) -> Self {
832 use std::string::ToString;
833 match value {
834 "STATE_UNSPECIFIED" => Self::Unspecified,
835 "ACTIVE" => Self::Active,
836 "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
837 "UNINITIALIZED" => Self::Uninitialized,
838 _ => Self::UnknownValue(state::UnknownValue(
839 wkt::internal::UnknownEnumValue::String(value.to_string()),
840 )),
841 }
842 }
843 }
844
845 impl serde::ser::Serialize for State {
846 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
847 where
848 S: serde::Serializer,
849 {
850 match self {
851 Self::Unspecified => serializer.serialize_i32(0),
852 Self::Active => serializer.serialize_i32(1),
853 Self::KeyProjectDeleted => serializer.serialize_i32(2),
854 Self::Uninitialized => serializer.serialize_i32(3),
855 Self::UnknownValue(u) => u.0.serialize(serializer),
856 }
857 }
858 }
859
860 impl<'de> serde::de::Deserialize<'de> for State {
861 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
862 where
863 D: serde::Deserializer<'de>,
864 {
865 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
866 ".google.cloud.kms.v1.AutokeyConfig.State",
867 ))
868 }
869 }
870}
871
872/// Request message for
873/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
874///
875/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
876#[derive(Clone, Default, PartialEq)]
877#[non_exhaustive]
878pub struct ShowEffectiveAutokeyConfigRequest {
879 /// Required. Name of the resource project to the show effective Cloud KMS
880 /// Autokey configuration for. This may be helpful for interrogating the effect
881 /// of nested folder configurations on a given resource project.
882 pub parent: std::string::String,
883
884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
885}
886
887impl ShowEffectiveAutokeyConfigRequest {
888 pub fn new() -> Self {
889 std::default::Default::default()
890 }
891
892 /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
893 ///
894 /// # Example
895 /// ```ignore,no_run
896 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
897 /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
898 /// ```
899 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
900 self.parent = v.into();
901 self
902 }
903}
904
905impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
906 fn typename() -> &'static str {
907 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
908 }
909}
910
911/// Response message for
912/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
913///
914/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
915#[derive(Clone, Default, PartialEq)]
916#[non_exhaustive]
917pub struct ShowEffectiveAutokeyConfigResponse {
918 /// Name of the key project configured in the resource project's folder
919 /// ancestry.
920 pub key_project: std::string::String,
921
922 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
923}
924
925impl ShowEffectiveAutokeyConfigResponse {
926 pub fn new() -> Self {
927 std::default::Default::default()
928 }
929
930 /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
931 ///
932 /// # Example
933 /// ```ignore,no_run
934 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
935 /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
936 /// ```
937 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
938 self.key_project = v.into();
939 self
940 }
941}
942
943impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
944 fn typename() -> &'static str {
945 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
946 }
947}
948
949/// Request message for
950/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
951///
952/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
953#[derive(Clone, Default, PartialEq)]
954#[non_exhaustive]
955pub struct ListEkmConnectionsRequest {
956 /// Required. The resource name of the location associated with the
957 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
958 /// `projects/*/locations/*`.
959 ///
960 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
961 pub parent: std::string::String,
962
963 /// Optional. Optional limit on the number of
964 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
965 /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
966 /// subsequently be obtained by including the
967 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
968 /// in a subsequent request. If unspecified, the server will pick an
969 /// appropriate default.
970 ///
971 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
972 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
973 pub page_size: i32,
974
975 /// Optional. Optional pagination token, returned earlier via
976 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
977 ///
978 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
979 pub page_token: std::string::String,
980
981 /// Optional. Only include resources that match the filter in the response. For
982 /// more information, see
983 /// [Sorting and filtering list
984 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
985 pub filter: std::string::String,
986
987 /// Optional. Specify how the results should be sorted. If not specified, the
988 /// results will be sorted in the default order. For more information, see
989 /// [Sorting and filtering list
990 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
991 pub order_by: std::string::String,
992
993 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
994}
995
996impl ListEkmConnectionsRequest {
997 pub fn new() -> Self {
998 std::default::Default::default()
999 }
1000
1001 /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1002 ///
1003 /// # Example
1004 /// ```ignore,no_run
1005 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1006 /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1007 /// ```
1008 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1009 self.parent = v.into();
1010 self
1011 }
1012
1013 /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1014 ///
1015 /// # Example
1016 /// ```ignore,no_run
1017 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1018 /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1019 /// ```
1020 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1021 self.page_size = v.into();
1022 self
1023 }
1024
1025 /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1026 ///
1027 /// # Example
1028 /// ```ignore,no_run
1029 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1030 /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1031 /// ```
1032 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1033 self.page_token = v.into();
1034 self
1035 }
1036
1037 /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1038 ///
1039 /// # Example
1040 /// ```ignore,no_run
1041 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1042 /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1043 /// ```
1044 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1045 self.filter = v.into();
1046 self
1047 }
1048
1049 /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1050 ///
1051 /// # Example
1052 /// ```ignore,no_run
1053 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1054 /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1055 /// ```
1056 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1057 self.order_by = v.into();
1058 self
1059 }
1060}
1061
1062impl wkt::message::Message for ListEkmConnectionsRequest {
1063 fn typename() -> &'static str {
1064 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1065 }
1066}
1067
1068/// Response message for
1069/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1070///
1071/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1072#[derive(Clone, Default, PartialEq)]
1073#[non_exhaustive]
1074pub struct ListEkmConnectionsResponse {
1075 /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1076 ///
1077 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1078 pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1079
1080 /// A token to retrieve next page of results. Pass this value in
1081 /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1082 /// to retrieve the next page of results.
1083 ///
1084 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1085 pub next_page_token: std::string::String,
1086
1087 /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1088 /// that matched the query.
1089 ///
1090 /// This field is not populated if
1091 /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1092 /// is applied.
1093 ///
1094 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1095 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1096 pub total_size: i32,
1097
1098 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1099}
1100
1101impl ListEkmConnectionsResponse {
1102 pub fn new() -> Self {
1103 std::default::Default::default()
1104 }
1105
1106 /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1107 ///
1108 /// # Example
1109 /// ```ignore,no_run
1110 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1111 /// use google_cloud_kms_v1::model::EkmConnection;
1112 /// let x = ListEkmConnectionsResponse::new()
1113 /// .set_ekm_connections([
1114 /// EkmConnection::default()/* use setters */,
1115 /// EkmConnection::default()/* use (different) setters */,
1116 /// ]);
1117 /// ```
1118 pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1119 where
1120 T: std::iter::IntoIterator<Item = V>,
1121 V: std::convert::Into<crate::model::EkmConnection>,
1122 {
1123 use std::iter::Iterator;
1124 self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1125 self
1126 }
1127
1128 /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1129 ///
1130 /// # Example
1131 /// ```ignore,no_run
1132 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1133 /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1134 /// ```
1135 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1136 self.next_page_token = v.into();
1137 self
1138 }
1139
1140 /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1141 ///
1142 /// # Example
1143 /// ```ignore,no_run
1144 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1145 /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1146 /// ```
1147 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1148 self.total_size = v.into();
1149 self
1150 }
1151}
1152
1153impl wkt::message::Message for ListEkmConnectionsResponse {
1154 fn typename() -> &'static str {
1155 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1156 }
1157}
1158
1159#[doc(hidden)]
1160impl google_cloud_gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1161 type PageItem = crate::model::EkmConnection;
1162
1163 fn items(self) -> std::vec::Vec<Self::PageItem> {
1164 self.ekm_connections
1165 }
1166
1167 fn next_page_token(&self) -> std::string::String {
1168 use std::clone::Clone;
1169 self.next_page_token.clone()
1170 }
1171}
1172
1173/// Request message for
1174/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1175///
1176/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1177#[derive(Clone, Default, PartialEq)]
1178#[non_exhaustive]
1179pub struct GetEkmConnectionRequest {
1180 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1181 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1182 ///
1183 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1184 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1185 pub name: std::string::String,
1186
1187 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1188}
1189
1190impl GetEkmConnectionRequest {
1191 pub fn new() -> Self {
1192 std::default::Default::default()
1193 }
1194
1195 /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1196 ///
1197 /// # Example
1198 /// ```ignore,no_run
1199 /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1200 /// let x = GetEkmConnectionRequest::new().set_name("example");
1201 /// ```
1202 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1203 self.name = v.into();
1204 self
1205 }
1206}
1207
1208impl wkt::message::Message for GetEkmConnectionRequest {
1209 fn typename() -> &'static str {
1210 "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1211 }
1212}
1213
1214/// Request message for
1215/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1216///
1217/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1218#[derive(Clone, Default, PartialEq)]
1219#[non_exhaustive]
1220pub struct CreateEkmConnectionRequest {
1221 /// Required. The resource name of the location associated with the
1222 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1223 /// `projects/*/locations/*`.
1224 ///
1225 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1226 pub parent: std::string::String,
1227
1228 /// Required. It must be unique within a location and match the regular
1229 /// expression `[a-zA-Z0-9_-]{1,63}`.
1230 pub ekm_connection_id: std::string::String,
1231
1232 /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1233 /// initial field values.
1234 ///
1235 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1236 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1237
1238 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1239}
1240
1241impl CreateEkmConnectionRequest {
1242 pub fn new() -> Self {
1243 std::default::Default::default()
1244 }
1245
1246 /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1247 ///
1248 /// # Example
1249 /// ```ignore,no_run
1250 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1251 /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1252 /// ```
1253 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1254 self.parent = v.into();
1255 self
1256 }
1257
1258 /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1259 ///
1260 /// # Example
1261 /// ```ignore,no_run
1262 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1263 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1264 /// ```
1265 pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1266 mut self,
1267 v: T,
1268 ) -> Self {
1269 self.ekm_connection_id = v.into();
1270 self
1271 }
1272
1273 /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1274 ///
1275 /// # Example
1276 /// ```ignore,no_run
1277 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1278 /// use google_cloud_kms_v1::model::EkmConnection;
1279 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1280 /// ```
1281 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1282 where
1283 T: std::convert::Into<crate::model::EkmConnection>,
1284 {
1285 self.ekm_connection = std::option::Option::Some(v.into());
1286 self
1287 }
1288
1289 /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1290 ///
1291 /// # Example
1292 /// ```ignore,no_run
1293 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1294 /// use google_cloud_kms_v1::model::EkmConnection;
1295 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1296 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1297 /// ```
1298 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1299 where
1300 T: std::convert::Into<crate::model::EkmConnection>,
1301 {
1302 self.ekm_connection = v.map(|x| x.into());
1303 self
1304 }
1305}
1306
1307impl wkt::message::Message for CreateEkmConnectionRequest {
1308 fn typename() -> &'static str {
1309 "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1310 }
1311}
1312
1313/// Request message for
1314/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1315///
1316/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1317#[derive(Clone, Default, PartialEq)]
1318#[non_exhaustive]
1319pub struct UpdateEkmConnectionRequest {
1320 /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1321 /// values.
1322 ///
1323 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1324 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1325
1326 /// Required. List of fields to be updated in this request.
1327 pub update_mask: std::option::Option<wkt::FieldMask>,
1328
1329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1330}
1331
1332impl UpdateEkmConnectionRequest {
1333 pub fn new() -> Self {
1334 std::default::Default::default()
1335 }
1336
1337 /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1338 ///
1339 /// # Example
1340 /// ```ignore,no_run
1341 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1342 /// use google_cloud_kms_v1::model::EkmConnection;
1343 /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1344 /// ```
1345 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1346 where
1347 T: std::convert::Into<crate::model::EkmConnection>,
1348 {
1349 self.ekm_connection = std::option::Option::Some(v.into());
1350 self
1351 }
1352
1353 /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1354 ///
1355 /// # Example
1356 /// ```ignore,no_run
1357 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1358 /// use google_cloud_kms_v1::model::EkmConnection;
1359 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1360 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1361 /// ```
1362 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1363 where
1364 T: std::convert::Into<crate::model::EkmConnection>,
1365 {
1366 self.ekm_connection = v.map(|x| x.into());
1367 self
1368 }
1369
1370 /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1371 ///
1372 /// # Example
1373 /// ```ignore,no_run
1374 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1375 /// use wkt::FieldMask;
1376 /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1377 /// ```
1378 pub fn set_update_mask<T>(mut self, v: T) -> Self
1379 where
1380 T: std::convert::Into<wkt::FieldMask>,
1381 {
1382 self.update_mask = std::option::Option::Some(v.into());
1383 self
1384 }
1385
1386 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1387 ///
1388 /// # Example
1389 /// ```ignore,no_run
1390 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1391 /// use wkt::FieldMask;
1392 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1393 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1394 /// ```
1395 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1396 where
1397 T: std::convert::Into<wkt::FieldMask>,
1398 {
1399 self.update_mask = v.map(|x| x.into());
1400 self
1401 }
1402}
1403
1404impl wkt::message::Message for UpdateEkmConnectionRequest {
1405 fn typename() -> &'static str {
1406 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1407 }
1408}
1409
1410/// Request message for
1411/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1412///
1413/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1414#[derive(Clone, Default, PartialEq)]
1415#[non_exhaustive]
1416pub struct GetEkmConfigRequest {
1417 /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1418 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1419 ///
1420 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1421 /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1422 pub name: std::string::String,
1423
1424 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1425}
1426
1427impl GetEkmConfigRequest {
1428 pub fn new() -> Self {
1429 std::default::Default::default()
1430 }
1431
1432 /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1433 ///
1434 /// # Example
1435 /// ```ignore,no_run
1436 /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1437 /// let x = GetEkmConfigRequest::new().set_name("example");
1438 /// ```
1439 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1440 self.name = v.into();
1441 self
1442 }
1443}
1444
1445impl wkt::message::Message for GetEkmConfigRequest {
1446 fn typename() -> &'static str {
1447 "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1448 }
1449}
1450
1451/// Request message for
1452/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1453///
1454/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1455#[derive(Clone, Default, PartialEq)]
1456#[non_exhaustive]
1457pub struct UpdateEkmConfigRequest {
1458 /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1459 ///
1460 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1461 pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1462
1463 /// Required. List of fields to be updated in this request.
1464 pub update_mask: std::option::Option<wkt::FieldMask>,
1465
1466 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1467}
1468
1469impl UpdateEkmConfigRequest {
1470 pub fn new() -> Self {
1471 std::default::Default::default()
1472 }
1473
1474 /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1475 ///
1476 /// # Example
1477 /// ```ignore,no_run
1478 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1479 /// use google_cloud_kms_v1::model::EkmConfig;
1480 /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1481 /// ```
1482 pub fn set_ekm_config<T>(mut self, v: T) -> Self
1483 where
1484 T: std::convert::Into<crate::model::EkmConfig>,
1485 {
1486 self.ekm_config = std::option::Option::Some(v.into());
1487 self
1488 }
1489
1490 /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1491 ///
1492 /// # Example
1493 /// ```ignore,no_run
1494 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1495 /// use google_cloud_kms_v1::model::EkmConfig;
1496 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1497 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1498 /// ```
1499 pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1500 where
1501 T: std::convert::Into<crate::model::EkmConfig>,
1502 {
1503 self.ekm_config = v.map(|x| x.into());
1504 self
1505 }
1506
1507 /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1508 ///
1509 /// # Example
1510 /// ```ignore,no_run
1511 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1512 /// use wkt::FieldMask;
1513 /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1514 /// ```
1515 pub fn set_update_mask<T>(mut self, v: T) -> Self
1516 where
1517 T: std::convert::Into<wkt::FieldMask>,
1518 {
1519 self.update_mask = std::option::Option::Some(v.into());
1520 self
1521 }
1522
1523 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1524 ///
1525 /// # Example
1526 /// ```ignore,no_run
1527 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1528 /// use wkt::FieldMask;
1529 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1530 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1531 /// ```
1532 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1533 where
1534 T: std::convert::Into<wkt::FieldMask>,
1535 {
1536 self.update_mask = v.map(|x| x.into());
1537 self
1538 }
1539}
1540
1541impl wkt::message::Message for UpdateEkmConfigRequest {
1542 fn typename() -> &'static str {
1543 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1544 }
1545}
1546
1547/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1548/// certificate used to authenticate HTTPS connections to EKM replicas.
1549///
1550/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1551#[derive(Clone, Default, PartialEq)]
1552#[non_exhaustive]
1553pub struct Certificate {
1554 /// Required. The raw certificate bytes in DER format.
1555 pub raw_der: ::bytes::Bytes,
1556
1557 /// Output only. True if the certificate was parsed successfully.
1558 pub parsed: bool,
1559
1560 /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1561 /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1562 ///
1563 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1564 pub issuer: std::string::String,
1565
1566 /// Output only. The subject distinguished name in RFC 2253 format. Only
1567 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1568 ///
1569 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1570 pub subject: std::string::String,
1571
1572 /// Output only. The subject Alternative DNS names. Only present if
1573 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1574 ///
1575 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1576 pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1577
1578 /// Output only. The certificate is not valid before this time. Only present if
1579 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1580 ///
1581 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1582 pub not_before_time: std::option::Option<wkt::Timestamp>,
1583
1584 /// Output only. The certificate is not valid after this time. Only present if
1585 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1586 ///
1587 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1588 pub not_after_time: std::option::Option<wkt::Timestamp>,
1589
1590 /// Output only. The certificate serial number as a hex string. Only present if
1591 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1592 ///
1593 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1594 pub serial_number: std::string::String,
1595
1596 /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1597 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1598 ///
1599 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1600 pub sha256_fingerprint: std::string::String,
1601
1602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1603}
1604
1605impl Certificate {
1606 pub fn new() -> Self {
1607 std::default::Default::default()
1608 }
1609
1610 /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1611 ///
1612 /// # Example
1613 /// ```ignore,no_run
1614 /// # use google_cloud_kms_v1::model::Certificate;
1615 /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1616 /// ```
1617 pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1618 self.raw_der = v.into();
1619 self
1620 }
1621
1622 /// Sets the value of [parsed][crate::model::Certificate::parsed].
1623 ///
1624 /// # Example
1625 /// ```ignore,no_run
1626 /// # use google_cloud_kms_v1::model::Certificate;
1627 /// let x = Certificate::new().set_parsed(true);
1628 /// ```
1629 pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1630 self.parsed = v.into();
1631 self
1632 }
1633
1634 /// Sets the value of [issuer][crate::model::Certificate::issuer].
1635 ///
1636 /// # Example
1637 /// ```ignore,no_run
1638 /// # use google_cloud_kms_v1::model::Certificate;
1639 /// let x = Certificate::new().set_issuer("example");
1640 /// ```
1641 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1642 self.issuer = v.into();
1643 self
1644 }
1645
1646 /// Sets the value of [subject][crate::model::Certificate::subject].
1647 ///
1648 /// # Example
1649 /// ```ignore,no_run
1650 /// # use google_cloud_kms_v1::model::Certificate;
1651 /// let x = Certificate::new().set_subject("example");
1652 /// ```
1653 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.subject = v.into();
1655 self
1656 }
1657
1658 /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1659 ///
1660 /// # Example
1661 /// ```ignore,no_run
1662 /// # use google_cloud_kms_v1::model::Certificate;
1663 /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1664 /// ```
1665 pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1666 where
1667 T: std::iter::IntoIterator<Item = V>,
1668 V: std::convert::Into<std::string::String>,
1669 {
1670 use std::iter::Iterator;
1671 self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1672 self
1673 }
1674
1675 /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1676 ///
1677 /// # Example
1678 /// ```ignore,no_run
1679 /// # use google_cloud_kms_v1::model::Certificate;
1680 /// use wkt::Timestamp;
1681 /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1682 /// ```
1683 pub fn set_not_before_time<T>(mut self, v: T) -> Self
1684 where
1685 T: std::convert::Into<wkt::Timestamp>,
1686 {
1687 self.not_before_time = std::option::Option::Some(v.into());
1688 self
1689 }
1690
1691 /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1692 ///
1693 /// # Example
1694 /// ```ignore,no_run
1695 /// # use google_cloud_kms_v1::model::Certificate;
1696 /// use wkt::Timestamp;
1697 /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1698 /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1699 /// ```
1700 pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1701 where
1702 T: std::convert::Into<wkt::Timestamp>,
1703 {
1704 self.not_before_time = v.map(|x| x.into());
1705 self
1706 }
1707
1708 /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1709 ///
1710 /// # Example
1711 /// ```ignore,no_run
1712 /// # use google_cloud_kms_v1::model::Certificate;
1713 /// use wkt::Timestamp;
1714 /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1715 /// ```
1716 pub fn set_not_after_time<T>(mut self, v: T) -> Self
1717 where
1718 T: std::convert::Into<wkt::Timestamp>,
1719 {
1720 self.not_after_time = std::option::Option::Some(v.into());
1721 self
1722 }
1723
1724 /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1725 ///
1726 /// # Example
1727 /// ```ignore,no_run
1728 /// # use google_cloud_kms_v1::model::Certificate;
1729 /// use wkt::Timestamp;
1730 /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1731 /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1732 /// ```
1733 pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1734 where
1735 T: std::convert::Into<wkt::Timestamp>,
1736 {
1737 self.not_after_time = v.map(|x| x.into());
1738 self
1739 }
1740
1741 /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1742 ///
1743 /// # Example
1744 /// ```ignore,no_run
1745 /// # use google_cloud_kms_v1::model::Certificate;
1746 /// let x = Certificate::new().set_serial_number("example");
1747 /// ```
1748 pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1749 self.serial_number = v.into();
1750 self
1751 }
1752
1753 /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1754 ///
1755 /// # Example
1756 /// ```ignore,no_run
1757 /// # use google_cloud_kms_v1::model::Certificate;
1758 /// let x = Certificate::new().set_sha256_fingerprint("example");
1759 /// ```
1760 pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1761 mut self,
1762 v: T,
1763 ) -> Self {
1764 self.sha256_fingerprint = v.into();
1765 self
1766 }
1767}
1768
1769impl wkt::message::Message for Certificate {
1770 fn typename() -> &'static str {
1771 "type.googleapis.com/google.cloud.kms.v1.Certificate"
1772 }
1773}
1774
1775/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
1776/// individual EKM connection. It can be used for creating
1777/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
1778/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
1779/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
1780/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
1781/// performing cryptographic operations using keys created within the
1782/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1783///
1784/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1785/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1786/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1787/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
1788/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
1789#[derive(Clone, Default, PartialEq)]
1790#[non_exhaustive]
1791pub struct EkmConnection {
1792 /// Output only. The resource name for the
1793 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
1794 /// `projects/*/locations/*/ekmConnections/*`.
1795 ///
1796 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1797 pub name: std::string::String,
1798
1799 /// Output only. The time at which the
1800 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
1801 ///
1802 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1803 pub create_time: std::option::Option<wkt::Timestamp>,
1804
1805 /// Optional. A list of
1806 /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
1807 /// the EKM can be reached. There should be one ServiceResolver per EKM
1808 /// replica. Currently, only a single
1809 /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
1810 /// supported.
1811 ///
1812 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
1813 pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
1814
1815 /// Optional. Etag of the currently stored
1816 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1817 ///
1818 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1819 pub etag: std::string::String,
1820
1821 /// Optional. Describes who can perform control plane operations on the EKM. If
1822 /// unset, this defaults to
1823 /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
1824 ///
1825 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
1826 pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
1827
1828 /// Optional. Identifies the EKM Crypto Space that this
1829 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
1830 /// field is required if
1831 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
1832 /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
1833 ///
1834 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1835 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
1836 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
1837 pub crypto_space_path: std::string::String,
1838
1839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1840}
1841
1842impl EkmConnection {
1843 pub fn new() -> Self {
1844 std::default::Default::default()
1845 }
1846
1847 /// Sets the value of [name][crate::model::EkmConnection::name].
1848 ///
1849 /// # Example
1850 /// ```ignore,no_run
1851 /// # use google_cloud_kms_v1::model::EkmConnection;
1852 /// let x = EkmConnection::new().set_name("example");
1853 /// ```
1854 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1855 self.name = v.into();
1856 self
1857 }
1858
1859 /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
1860 ///
1861 /// # Example
1862 /// ```ignore,no_run
1863 /// # use google_cloud_kms_v1::model::EkmConnection;
1864 /// use wkt::Timestamp;
1865 /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
1866 /// ```
1867 pub fn set_create_time<T>(mut self, v: T) -> Self
1868 where
1869 T: std::convert::Into<wkt::Timestamp>,
1870 {
1871 self.create_time = std::option::Option::Some(v.into());
1872 self
1873 }
1874
1875 /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
1876 ///
1877 /// # Example
1878 /// ```ignore,no_run
1879 /// # use google_cloud_kms_v1::model::EkmConnection;
1880 /// use wkt::Timestamp;
1881 /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1882 /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
1883 /// ```
1884 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1885 where
1886 T: std::convert::Into<wkt::Timestamp>,
1887 {
1888 self.create_time = v.map(|x| x.into());
1889 self
1890 }
1891
1892 /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
1893 ///
1894 /// # Example
1895 /// ```ignore,no_run
1896 /// # use google_cloud_kms_v1::model::EkmConnection;
1897 /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
1898 /// let x = EkmConnection::new()
1899 /// .set_service_resolvers([
1900 /// ServiceResolver::default()/* use setters */,
1901 /// ServiceResolver::default()/* use (different) setters */,
1902 /// ]);
1903 /// ```
1904 pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
1905 where
1906 T: std::iter::IntoIterator<Item = V>,
1907 V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
1908 {
1909 use std::iter::Iterator;
1910 self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
1911 self
1912 }
1913
1914 /// Sets the value of [etag][crate::model::EkmConnection::etag].
1915 ///
1916 /// # Example
1917 /// ```ignore,no_run
1918 /// # use google_cloud_kms_v1::model::EkmConnection;
1919 /// let x = EkmConnection::new().set_etag("example");
1920 /// ```
1921 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1922 self.etag = v.into();
1923 self
1924 }
1925
1926 /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
1927 ///
1928 /// # Example
1929 /// ```ignore,no_run
1930 /// # use google_cloud_kms_v1::model::EkmConnection;
1931 /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
1932 /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
1933 /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
1934 /// ```
1935 pub fn set_key_management_mode<
1936 T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
1937 >(
1938 mut self,
1939 v: T,
1940 ) -> Self {
1941 self.key_management_mode = v.into();
1942 self
1943 }
1944
1945 /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
1946 ///
1947 /// # Example
1948 /// ```ignore,no_run
1949 /// # use google_cloud_kms_v1::model::EkmConnection;
1950 /// let x = EkmConnection::new().set_crypto_space_path("example");
1951 /// ```
1952 pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
1953 mut self,
1954 v: T,
1955 ) -> Self {
1956 self.crypto_space_path = v.into();
1957 self
1958 }
1959}
1960
1961impl wkt::message::Message for EkmConnection {
1962 fn typename() -> &'static str {
1963 "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
1964 }
1965}
1966
1967/// Defines additional types related to [EkmConnection].
1968pub mod ekm_connection {
1969 #[allow(unused_imports)]
1970 use super::*;
1971
1972 /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
1973 /// represents an EKM replica that can be reached within an
1974 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1975 ///
1976 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1977 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
1978 #[derive(Clone, Default, PartialEq)]
1979 #[non_exhaustive]
1980 pub struct ServiceResolver {
1981 /// Required. The resource name of the Service Directory service pointing to
1982 /// an EKM replica, in the format
1983 /// `projects/*/locations/*/namespaces/*/services/*`.
1984 pub service_directory_service: std::string::String,
1985
1986 /// Optional. The filter applied to the endpoints of the resolved service. If
1987 /// no filter is specified, all endpoints will be considered. An endpoint
1988 /// will be chosen arbitrarily from the filtered list for each request.
1989 ///
1990 /// For endpoint filter syntax and examples, see
1991 /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
1992 pub endpoint_filter: std::string::String,
1993
1994 /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
1995 pub hostname: std::string::String,
1996
1997 /// Required. A list of leaf server certificates used to authenticate HTTPS
1998 /// connections to the EKM replica. Currently, a maximum of 10
1999 /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2000 ///
2001 /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2002 pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2003
2004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2005 }
2006
2007 impl ServiceResolver {
2008 pub fn new() -> Self {
2009 std::default::Default::default()
2010 }
2011
2012 /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2013 ///
2014 /// # Example
2015 /// ```ignore,no_run
2016 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2017 /// let x = ServiceResolver::new().set_service_directory_service("example");
2018 /// ```
2019 pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2020 mut self,
2021 v: T,
2022 ) -> Self {
2023 self.service_directory_service = v.into();
2024 self
2025 }
2026
2027 /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2028 ///
2029 /// # Example
2030 /// ```ignore,no_run
2031 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2032 /// let x = ServiceResolver::new().set_endpoint_filter("example");
2033 /// ```
2034 pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2035 mut self,
2036 v: T,
2037 ) -> Self {
2038 self.endpoint_filter = v.into();
2039 self
2040 }
2041
2042 /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2043 ///
2044 /// # Example
2045 /// ```ignore,no_run
2046 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2047 /// let x = ServiceResolver::new().set_hostname("example");
2048 /// ```
2049 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2050 self.hostname = v.into();
2051 self
2052 }
2053
2054 /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2055 ///
2056 /// # Example
2057 /// ```ignore,no_run
2058 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2059 /// use google_cloud_kms_v1::model::Certificate;
2060 /// let x = ServiceResolver::new()
2061 /// .set_server_certificates([
2062 /// Certificate::default()/* use setters */,
2063 /// Certificate::default()/* use (different) setters */,
2064 /// ]);
2065 /// ```
2066 pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2067 where
2068 T: std::iter::IntoIterator<Item = V>,
2069 V: std::convert::Into<crate::model::Certificate>,
2070 {
2071 use std::iter::Iterator;
2072 self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2073 self
2074 }
2075 }
2076
2077 impl wkt::message::Message for ServiceResolver {
2078 fn typename() -> &'static str {
2079 "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2080 }
2081 }
2082
2083 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2084 /// describes who can perform control plane cryptographic operations using this
2085 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2086 ///
2087 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2088 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2089 ///
2090 /// # Working with unknown values
2091 ///
2092 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2093 /// additional enum variants at any time. Adding new variants is not considered
2094 /// a breaking change. Applications should write their code in anticipation of:
2095 ///
2096 /// - New values appearing in future releases of the client library, **and**
2097 /// - New values received dynamically, without application changes.
2098 ///
2099 /// Please consult the [Working with enums] section in the user guide for some
2100 /// guidelines.
2101 ///
2102 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2103 #[derive(Clone, Debug, PartialEq)]
2104 #[non_exhaustive]
2105 pub enum KeyManagementMode {
2106 /// Not specified.
2107 Unspecified,
2108 /// EKM-side key management operations on
2109 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2110 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2111 /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2112 ///
2113 /// * When creating a
2114 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2115 /// this
2116 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2117 /// supply the key path of pre-existing external key material that will be
2118 /// linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2119 /// * Destruction of external key material cannot be requested via the
2120 /// Cloud KMS API and must be performed directly in the EKM.
2121 /// * Automatic rotation of key material is not supported.
2122 ///
2123 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2124 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2125 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2126 Manual,
2127 /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2128 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2129 /// management operations initiated from Cloud KMS. This means that:
2130 ///
2131 /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2132 /// associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2133 /// is
2134 /// created, the EKM automatically generates new key material and a new
2135 /// key path. The caller cannot supply the key path of pre-existing
2136 /// external key material.
2137 /// * Destruction of external key material associated with this
2138 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2139 /// calling
2140 /// [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2141 /// * Automatic rotation of key material is supported.
2142 ///
2143 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2144 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2145 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2146 /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2147 CloudKms,
2148 /// If set, the enum was initialized with an unknown value.
2149 ///
2150 /// Applications can examine the value using [KeyManagementMode::value] or
2151 /// [KeyManagementMode::name].
2152 UnknownValue(key_management_mode::UnknownValue),
2153 }
2154
2155 #[doc(hidden)]
2156 pub mod key_management_mode {
2157 #[allow(unused_imports)]
2158 use super::*;
2159 #[derive(Clone, Debug, PartialEq)]
2160 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2161 }
2162
2163 impl KeyManagementMode {
2164 /// Gets the enum value.
2165 ///
2166 /// Returns `None` if the enum contains an unknown value deserialized from
2167 /// the string representation of enums.
2168 pub fn value(&self) -> std::option::Option<i32> {
2169 match self {
2170 Self::Unspecified => std::option::Option::Some(0),
2171 Self::Manual => std::option::Option::Some(1),
2172 Self::CloudKms => std::option::Option::Some(2),
2173 Self::UnknownValue(u) => u.0.value(),
2174 }
2175 }
2176
2177 /// Gets the enum value as a string.
2178 ///
2179 /// Returns `None` if the enum contains an unknown value deserialized from
2180 /// the integer representation of enums.
2181 pub fn name(&self) -> std::option::Option<&str> {
2182 match self {
2183 Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2184 Self::Manual => std::option::Option::Some("MANUAL"),
2185 Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2186 Self::UnknownValue(u) => u.0.name(),
2187 }
2188 }
2189 }
2190
2191 impl std::default::Default for KeyManagementMode {
2192 fn default() -> Self {
2193 use std::convert::From;
2194 Self::from(0)
2195 }
2196 }
2197
2198 impl std::fmt::Display for KeyManagementMode {
2199 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2200 wkt::internal::display_enum(f, self.name(), self.value())
2201 }
2202 }
2203
2204 impl std::convert::From<i32> for KeyManagementMode {
2205 fn from(value: i32) -> Self {
2206 match value {
2207 0 => Self::Unspecified,
2208 1 => Self::Manual,
2209 2 => Self::CloudKms,
2210 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2211 wkt::internal::UnknownEnumValue::Integer(value),
2212 )),
2213 }
2214 }
2215 }
2216
2217 impl std::convert::From<&str> for KeyManagementMode {
2218 fn from(value: &str) -> Self {
2219 use std::string::ToString;
2220 match value {
2221 "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2222 "MANUAL" => Self::Manual,
2223 "CLOUD_KMS" => Self::CloudKms,
2224 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2225 wkt::internal::UnknownEnumValue::String(value.to_string()),
2226 )),
2227 }
2228 }
2229 }
2230
2231 impl serde::ser::Serialize for KeyManagementMode {
2232 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2233 where
2234 S: serde::Serializer,
2235 {
2236 match self {
2237 Self::Unspecified => serializer.serialize_i32(0),
2238 Self::Manual => serializer.serialize_i32(1),
2239 Self::CloudKms => serializer.serialize_i32(2),
2240 Self::UnknownValue(u) => u.0.serialize(serializer),
2241 }
2242 }
2243 }
2244
2245 impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2246 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2247 where
2248 D: serde::Deserializer<'de>,
2249 {
2250 deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2251 ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2252 ))
2253 }
2254 }
2255}
2256
2257/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2258/// represents configuration parameters that apply to all
2259/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2260/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2261/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2262/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2263/// project and location.
2264///
2265/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2266/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2267/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2268/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2269/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2270#[derive(Clone, Default, PartialEq)]
2271#[non_exhaustive]
2272pub struct EkmConfig {
2273 /// Output only. The resource name for the
2274 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2275 /// `projects/*/locations/*/ekmConfig`.
2276 ///
2277 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2278 pub name: std::string::String,
2279
2280 /// Optional. Resource name of the default
2281 /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2282 /// the empty string removes the default.
2283 ///
2284 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2285 pub default_ekm_connection: std::string::String,
2286
2287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2288}
2289
2290impl EkmConfig {
2291 pub fn new() -> Self {
2292 std::default::Default::default()
2293 }
2294
2295 /// Sets the value of [name][crate::model::EkmConfig::name].
2296 ///
2297 /// # Example
2298 /// ```ignore,no_run
2299 /// # use google_cloud_kms_v1::model::EkmConfig;
2300 /// let x = EkmConfig::new().set_name("example");
2301 /// ```
2302 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2303 self.name = v.into();
2304 self
2305 }
2306
2307 /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2308 ///
2309 /// # Example
2310 /// ```ignore,no_run
2311 /// # use google_cloud_kms_v1::model::EkmConfig;
2312 /// let x = EkmConfig::new().set_default_ekm_connection("example");
2313 /// ```
2314 pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2315 mut self,
2316 v: T,
2317 ) -> Self {
2318 self.default_ekm_connection = v.into();
2319 self
2320 }
2321}
2322
2323impl wkt::message::Message for EkmConfig {
2324 fn typename() -> &'static str {
2325 "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2326 }
2327}
2328
2329/// Request message for
2330/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2331///
2332/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2333#[derive(Clone, Default, PartialEq)]
2334#[non_exhaustive]
2335pub struct VerifyConnectivityRequest {
2336 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2337 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2338 ///
2339 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2340 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2341 pub name: std::string::String,
2342
2343 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2344}
2345
2346impl VerifyConnectivityRequest {
2347 pub fn new() -> Self {
2348 std::default::Default::default()
2349 }
2350
2351 /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2352 ///
2353 /// # Example
2354 /// ```ignore,no_run
2355 /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2356 /// let x = VerifyConnectivityRequest::new().set_name("example");
2357 /// ```
2358 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2359 self.name = v.into();
2360 self
2361 }
2362}
2363
2364impl wkt::message::Message for VerifyConnectivityRequest {
2365 fn typename() -> &'static str {
2366 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2367 }
2368}
2369
2370/// Response message for
2371/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2372///
2373/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2374#[derive(Clone, Default, PartialEq)]
2375#[non_exhaustive]
2376pub struct VerifyConnectivityResponse {
2377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2378}
2379
2380impl VerifyConnectivityResponse {
2381 pub fn new() -> Self {
2382 std::default::Default::default()
2383 }
2384}
2385
2386impl wkt::message::Message for VerifyConnectivityResponse {
2387 fn typename() -> &'static str {
2388 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2389 }
2390}
2391
2392/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2393/// represents a single-tenant HSM instance. It can be used for creating
2394/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2395/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2396/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2397/// well as performing cryptographic operations using keys created within the
2398/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2399///
2400/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2401/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2402/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2403#[derive(Clone, Default, PartialEq)]
2404#[non_exhaustive]
2405pub struct SingleTenantHsmInstance {
2406 /// Identifier. The resource name for this
2407 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2408 /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2409 ///
2410 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2411 pub name: std::string::String,
2412
2413 /// Output only. The time at which the
2414 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2415 /// created.
2416 ///
2417 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2418 pub create_time: std::option::Option<wkt::Timestamp>,
2419
2420 /// Output only. The state of the
2421 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2422 ///
2423 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2424 pub state: crate::model::single_tenant_hsm_instance::State,
2425
2426 /// Required. The quorum auth configuration for the
2427 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2428 ///
2429 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2430 pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2431
2432 /// Output only. The time at which the
2433 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2434 /// deleted.
2435 ///
2436 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2437 pub delete_time: std::option::Option<wkt::Timestamp>,
2438
2439 /// Output only. The system-defined duration that an instance can remain
2440 /// unrefreshed until it is automatically disabled. This will have a value of
2441 /// 120 days.
2442 pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2443
2444 /// Output only. The time at which the instance will be automatically disabled
2445 /// if not refreshed. This field is updated upon creation and after each
2446 /// successful refresh operation and enable. A
2447 /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2448 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2449 /// before this time otherwise the
2450 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2451 /// become disabled.
2452 ///
2453 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2454 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2455 pub disable_time: std::option::Option<wkt::Timestamp>,
2456
2457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2458}
2459
2460impl SingleTenantHsmInstance {
2461 pub fn new() -> Self {
2462 std::default::Default::default()
2463 }
2464
2465 /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2466 ///
2467 /// # Example
2468 /// ```ignore,no_run
2469 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2470 /// let x = SingleTenantHsmInstance::new().set_name("example");
2471 /// ```
2472 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2473 self.name = v.into();
2474 self
2475 }
2476
2477 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2478 ///
2479 /// # Example
2480 /// ```ignore,no_run
2481 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2482 /// use wkt::Timestamp;
2483 /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2484 /// ```
2485 pub fn set_create_time<T>(mut self, v: T) -> Self
2486 where
2487 T: std::convert::Into<wkt::Timestamp>,
2488 {
2489 self.create_time = std::option::Option::Some(v.into());
2490 self
2491 }
2492
2493 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2494 ///
2495 /// # Example
2496 /// ```ignore,no_run
2497 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2498 /// use wkt::Timestamp;
2499 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2500 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2501 /// ```
2502 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2503 where
2504 T: std::convert::Into<wkt::Timestamp>,
2505 {
2506 self.create_time = v.map(|x| x.into());
2507 self
2508 }
2509
2510 /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2511 ///
2512 /// # Example
2513 /// ```ignore,no_run
2514 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2515 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2516 /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2517 /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2518 /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2519 /// ```
2520 pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2521 mut self,
2522 v: T,
2523 ) -> Self {
2524 self.state = v.into();
2525 self
2526 }
2527
2528 /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2529 ///
2530 /// # Example
2531 /// ```ignore,no_run
2532 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2533 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2534 /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2535 /// ```
2536 pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2537 where
2538 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2539 {
2540 self.quorum_auth = std::option::Option::Some(v.into());
2541 self
2542 }
2543
2544 /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2545 ///
2546 /// # Example
2547 /// ```ignore,no_run
2548 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2549 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2550 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2551 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2552 /// ```
2553 pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2554 where
2555 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2556 {
2557 self.quorum_auth = v.map(|x| x.into());
2558 self
2559 }
2560
2561 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2562 ///
2563 /// # Example
2564 /// ```ignore,no_run
2565 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2566 /// use wkt::Timestamp;
2567 /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2568 /// ```
2569 pub fn set_delete_time<T>(mut self, v: T) -> Self
2570 where
2571 T: std::convert::Into<wkt::Timestamp>,
2572 {
2573 self.delete_time = std::option::Option::Some(v.into());
2574 self
2575 }
2576
2577 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2578 ///
2579 /// # Example
2580 /// ```ignore,no_run
2581 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2582 /// use wkt::Timestamp;
2583 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2584 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2585 /// ```
2586 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2587 where
2588 T: std::convert::Into<wkt::Timestamp>,
2589 {
2590 self.delete_time = v.map(|x| x.into());
2591 self
2592 }
2593
2594 /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2595 ///
2596 /// # Example
2597 /// ```ignore,no_run
2598 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2599 /// use wkt::Duration;
2600 /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2601 /// ```
2602 pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2603 where
2604 T: std::convert::Into<wkt::Duration>,
2605 {
2606 self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2607 self
2608 }
2609
2610 /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2611 ///
2612 /// # Example
2613 /// ```ignore,no_run
2614 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2615 /// use wkt::Duration;
2616 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2617 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2618 /// ```
2619 pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2620 mut self,
2621 v: std::option::Option<T>,
2622 ) -> Self
2623 where
2624 T: std::convert::Into<wkt::Duration>,
2625 {
2626 self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2627 self
2628 }
2629
2630 /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2631 ///
2632 /// # Example
2633 /// ```ignore,no_run
2634 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2635 /// use wkt::Timestamp;
2636 /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2637 /// ```
2638 pub fn set_disable_time<T>(mut self, v: T) -> Self
2639 where
2640 T: std::convert::Into<wkt::Timestamp>,
2641 {
2642 self.disable_time = std::option::Option::Some(v.into());
2643 self
2644 }
2645
2646 /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2647 ///
2648 /// # Example
2649 /// ```ignore,no_run
2650 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2651 /// use wkt::Timestamp;
2652 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2653 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2654 /// ```
2655 pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2656 where
2657 T: std::convert::Into<wkt::Timestamp>,
2658 {
2659 self.disable_time = v.map(|x| x.into());
2660 self
2661 }
2662}
2663
2664impl wkt::message::Message for SingleTenantHsmInstance {
2665 fn typename() -> &'static str {
2666 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2667 }
2668}
2669
2670/// Defines additional types related to [SingleTenantHsmInstance].
2671pub mod single_tenant_hsm_instance {
2672 #[allow(unused_imports)]
2673 use super::*;
2674
2675 /// Configuration for M of N quorum auth.
2676 #[derive(Clone, Default, PartialEq)]
2677 #[non_exhaustive]
2678 pub struct QuorumAuth {
2679 /// Required. The total number of approvers. This is the N value used
2680 /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2681 /// or equal to 16.
2682 pub total_approver_count: i32,
2683
2684 /// Output only. The required numbers of approvers. The M value used for M of
2685 /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2686 /// to
2687 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2688 ///
2689 ///
2690 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2691 pub required_approver_count: i32,
2692
2693 /// Output only. The public keys associated with the 2FA keys for M of N
2694 /// quorum auth.
2695 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2696
2697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2698 }
2699
2700 impl QuorumAuth {
2701 pub fn new() -> Self {
2702 std::default::Default::default()
2703 }
2704
2705 /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2706 ///
2707 /// # Example
2708 /// ```ignore,no_run
2709 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2710 /// let x = QuorumAuth::new().set_total_approver_count(42);
2711 /// ```
2712 pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2713 self.total_approver_count = v.into();
2714 self
2715 }
2716
2717 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2718 ///
2719 /// # Example
2720 /// ```ignore,no_run
2721 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2722 /// let x = QuorumAuth::new().set_required_approver_count(42);
2723 /// ```
2724 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2725 self.required_approver_count = v.into();
2726 self
2727 }
2728
2729 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
2730 ///
2731 /// # Example
2732 /// ```ignore,no_run
2733 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2734 /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
2735 /// ```
2736 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
2737 where
2738 T: std::iter::IntoIterator<Item = V>,
2739 V: std::convert::Into<std::string::String>,
2740 {
2741 use std::iter::Iterator;
2742 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
2743 self
2744 }
2745 }
2746
2747 impl wkt::message::Message for QuorumAuth {
2748 fn typename() -> &'static str {
2749 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
2750 }
2751 }
2752
2753 /// The set of states of a
2754 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2755 ///
2756 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2757 ///
2758 /// # Working with unknown values
2759 ///
2760 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2761 /// additional enum variants at any time. Adding new variants is not considered
2762 /// a breaking change. Applications should write their code in anticipation of:
2763 ///
2764 /// - New values appearing in future releases of the client library, **and**
2765 /// - New values received dynamically, without application changes.
2766 ///
2767 /// Please consult the [Working with enums] section in the user guide for some
2768 /// guidelines.
2769 ///
2770 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2771 #[derive(Clone, Debug, PartialEq)]
2772 #[non_exhaustive]
2773 pub enum State {
2774 /// Not specified.
2775 Unspecified,
2776 /// The
2777 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2778 /// being created.
2779 ///
2780 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2781 Creating,
2782 /// The
2783 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2784 /// waiting for 2FA keys to be registered. This can be done by calling
2785 /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
2786 /// with the [RegisterTwoFactorAuthKeys][] operation.
2787 ///
2788 /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
2789 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2790 PendingTwoFactorAuthRegistration,
2791 /// The
2792 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2793 /// ready to use. A
2794 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2795 /// must be in the
2796 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
2797 /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
2798 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
2799 /// be usable.
2800 ///
2801 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2802 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2803 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
2804 Active,
2805 /// The
2806 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2807 /// being disabled.
2808 ///
2809 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2810 Disabling,
2811 /// The
2812 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2813 /// disabled.
2814 ///
2815 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2816 Disabled,
2817 /// The
2818 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2819 /// being deleted. Requests to the instance will be rejected in this state.
2820 ///
2821 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2822 Deleting,
2823 /// The
2824 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2825 /// has been deleted.
2826 ///
2827 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2828 Deleted,
2829 /// The
2830 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2831 /// has failed and can not be recovered or used.
2832 ///
2833 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2834 Failed,
2835 /// If set, the enum was initialized with an unknown value.
2836 ///
2837 /// Applications can examine the value using [State::value] or
2838 /// [State::name].
2839 UnknownValue(state::UnknownValue),
2840 }
2841
2842 #[doc(hidden)]
2843 pub mod state {
2844 #[allow(unused_imports)]
2845 use super::*;
2846 #[derive(Clone, Debug, PartialEq)]
2847 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2848 }
2849
2850 impl State {
2851 /// Gets the enum value.
2852 ///
2853 /// Returns `None` if the enum contains an unknown value deserialized from
2854 /// the string representation of enums.
2855 pub fn value(&self) -> std::option::Option<i32> {
2856 match self {
2857 Self::Unspecified => std::option::Option::Some(0),
2858 Self::Creating => std::option::Option::Some(1),
2859 Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
2860 Self::Active => std::option::Option::Some(3),
2861 Self::Disabling => std::option::Option::Some(4),
2862 Self::Disabled => std::option::Option::Some(5),
2863 Self::Deleting => std::option::Option::Some(6),
2864 Self::Deleted => std::option::Option::Some(7),
2865 Self::Failed => std::option::Option::Some(8),
2866 Self::UnknownValue(u) => u.0.value(),
2867 }
2868 }
2869
2870 /// Gets the enum value as a string.
2871 ///
2872 /// Returns `None` if the enum contains an unknown value deserialized from
2873 /// the integer representation of enums.
2874 pub fn name(&self) -> std::option::Option<&str> {
2875 match self {
2876 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
2877 Self::Creating => std::option::Option::Some("CREATING"),
2878 Self::PendingTwoFactorAuthRegistration => {
2879 std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
2880 }
2881 Self::Active => std::option::Option::Some("ACTIVE"),
2882 Self::Disabling => std::option::Option::Some("DISABLING"),
2883 Self::Disabled => std::option::Option::Some("DISABLED"),
2884 Self::Deleting => std::option::Option::Some("DELETING"),
2885 Self::Deleted => std::option::Option::Some("DELETED"),
2886 Self::Failed => std::option::Option::Some("FAILED"),
2887 Self::UnknownValue(u) => u.0.name(),
2888 }
2889 }
2890 }
2891
2892 impl std::default::Default for State {
2893 fn default() -> Self {
2894 use std::convert::From;
2895 Self::from(0)
2896 }
2897 }
2898
2899 impl std::fmt::Display for State {
2900 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2901 wkt::internal::display_enum(f, self.name(), self.value())
2902 }
2903 }
2904
2905 impl std::convert::From<i32> for State {
2906 fn from(value: i32) -> Self {
2907 match value {
2908 0 => Self::Unspecified,
2909 1 => Self::Creating,
2910 2 => Self::PendingTwoFactorAuthRegistration,
2911 3 => Self::Active,
2912 4 => Self::Disabling,
2913 5 => Self::Disabled,
2914 6 => Self::Deleting,
2915 7 => Self::Deleted,
2916 8 => Self::Failed,
2917 _ => Self::UnknownValue(state::UnknownValue(
2918 wkt::internal::UnknownEnumValue::Integer(value),
2919 )),
2920 }
2921 }
2922 }
2923
2924 impl std::convert::From<&str> for State {
2925 fn from(value: &str) -> Self {
2926 use std::string::ToString;
2927 match value {
2928 "STATE_UNSPECIFIED" => Self::Unspecified,
2929 "CREATING" => Self::Creating,
2930 "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
2931 "ACTIVE" => Self::Active,
2932 "DISABLING" => Self::Disabling,
2933 "DISABLED" => Self::Disabled,
2934 "DELETING" => Self::Deleting,
2935 "DELETED" => Self::Deleted,
2936 "FAILED" => Self::Failed,
2937 _ => Self::UnknownValue(state::UnknownValue(
2938 wkt::internal::UnknownEnumValue::String(value.to_string()),
2939 )),
2940 }
2941 }
2942 }
2943
2944 impl serde::ser::Serialize for State {
2945 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2946 where
2947 S: serde::Serializer,
2948 {
2949 match self {
2950 Self::Unspecified => serializer.serialize_i32(0),
2951 Self::Creating => serializer.serialize_i32(1),
2952 Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
2953 Self::Active => serializer.serialize_i32(3),
2954 Self::Disabling => serializer.serialize_i32(4),
2955 Self::Disabled => serializer.serialize_i32(5),
2956 Self::Deleting => serializer.serialize_i32(6),
2957 Self::Deleted => serializer.serialize_i32(7),
2958 Self::Failed => serializer.serialize_i32(8),
2959 Self::UnknownValue(u) => u.0.serialize(serializer),
2960 }
2961 }
2962 }
2963
2964 impl<'de> serde::de::Deserialize<'de> for State {
2965 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2966 where
2967 D: serde::Deserializer<'de>,
2968 {
2969 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
2970 ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
2971 ))
2972 }
2973 }
2974}
2975
2976/// A
2977/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2978/// represents a proposal to perform an operation on a
2979/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2980///
2981/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2982/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2983#[derive(Clone, Default, PartialEq)]
2984#[non_exhaustive]
2985pub struct SingleTenantHsmInstanceProposal {
2986 /// Identifier. The resource name for this
2987 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2988 /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
2989 ///
2990 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2991 pub name: std::string::String,
2992
2993 /// Output only. The time at which the
2994 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2995 /// was created.
2996 ///
2997 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2998 pub create_time: std::option::Option<wkt::Timestamp>,
2999
3000 /// Output only. The state of the
3001 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3002 ///
3003 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3004 pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3005
3006 /// Output only. The root cause of the most recent failure. Only present if
3007 /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3008 /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3009 ///
3010 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3011 pub failure_reason: std::string::String,
3012
3013 /// Output only. The time at which the
3014 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3015 /// was deleted.
3016 ///
3017 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3018 pub delete_time: std::option::Option<wkt::Timestamp>,
3019
3020 /// Output only. The time at which the soft-deleted
3021 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3022 /// will be permanently purged. This field is only populated
3023 /// when the state is DELETED and will be set a time after expiration of the
3024 /// proposal, i.e. >= expire_time or (create_time + ttl).
3025 ///
3026 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3027 pub purge_time: std::option::Option<wkt::Timestamp>,
3028
3029 /// The approval parameters for the
3030 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3031 /// The type of parameters is determined by the operation being proposed.
3032 ///
3033 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3034 pub approval_parameters:
3035 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3036
3037 /// The expiration of the
3038 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3039 /// If not set, the
3040 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3041 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3042 /// time is 5 minutes.
3043 ///
3044 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3045 pub expiration:
3046 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3047
3048 /// The operation to perform on the
3049 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3050 ///
3051 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3052 pub operation:
3053 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3054
3055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3056}
3057
3058impl SingleTenantHsmInstanceProposal {
3059 pub fn new() -> Self {
3060 std::default::Default::default()
3061 }
3062
3063 /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3064 ///
3065 /// # Example
3066 /// ```ignore,no_run
3067 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3068 /// let x = SingleTenantHsmInstanceProposal::new().set_name("example");
3069 /// ```
3070 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3071 self.name = v.into();
3072 self
3073 }
3074
3075 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3076 ///
3077 /// # Example
3078 /// ```ignore,no_run
3079 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3080 /// use wkt::Timestamp;
3081 /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3082 /// ```
3083 pub fn set_create_time<T>(mut self, v: T) -> Self
3084 where
3085 T: std::convert::Into<wkt::Timestamp>,
3086 {
3087 self.create_time = std::option::Option::Some(v.into());
3088 self
3089 }
3090
3091 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3092 ///
3093 /// # Example
3094 /// ```ignore,no_run
3095 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3096 /// use wkt::Timestamp;
3097 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3098 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3099 /// ```
3100 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3101 where
3102 T: std::convert::Into<wkt::Timestamp>,
3103 {
3104 self.create_time = v.map(|x| x.into());
3105 self
3106 }
3107
3108 /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3109 ///
3110 /// # Example
3111 /// ```ignore,no_run
3112 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3113 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3114 /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3115 /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3116 /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3117 /// ```
3118 pub fn set_state<
3119 T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3120 >(
3121 mut self,
3122 v: T,
3123 ) -> Self {
3124 self.state = v.into();
3125 self
3126 }
3127
3128 /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3129 ///
3130 /// # Example
3131 /// ```ignore,no_run
3132 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3133 /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3134 /// ```
3135 pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3136 self.failure_reason = v.into();
3137 self
3138 }
3139
3140 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3141 ///
3142 /// # Example
3143 /// ```ignore,no_run
3144 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3145 /// use wkt::Timestamp;
3146 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3147 /// ```
3148 pub fn set_delete_time<T>(mut self, v: T) -> Self
3149 where
3150 T: std::convert::Into<wkt::Timestamp>,
3151 {
3152 self.delete_time = std::option::Option::Some(v.into());
3153 self
3154 }
3155
3156 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3157 ///
3158 /// # Example
3159 /// ```ignore,no_run
3160 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3161 /// use wkt::Timestamp;
3162 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3163 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3164 /// ```
3165 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3166 where
3167 T: std::convert::Into<wkt::Timestamp>,
3168 {
3169 self.delete_time = v.map(|x| x.into());
3170 self
3171 }
3172
3173 /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3174 ///
3175 /// # Example
3176 /// ```ignore,no_run
3177 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3178 /// use wkt::Timestamp;
3179 /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3180 /// ```
3181 pub fn set_purge_time<T>(mut self, v: T) -> Self
3182 where
3183 T: std::convert::Into<wkt::Timestamp>,
3184 {
3185 self.purge_time = std::option::Option::Some(v.into());
3186 self
3187 }
3188
3189 /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3190 ///
3191 /// # Example
3192 /// ```ignore,no_run
3193 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3194 /// use wkt::Timestamp;
3195 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3196 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3197 /// ```
3198 pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3199 where
3200 T: std::convert::Into<wkt::Timestamp>,
3201 {
3202 self.purge_time = v.map(|x| x.into());
3203 self
3204 }
3205
3206 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3207 ///
3208 /// Note that all the setters affecting `approval_parameters` are mutually
3209 /// exclusive.
3210 ///
3211 /// # Example
3212 /// ```ignore,no_run
3213 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3214 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3215 /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3216 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3217 /// ```
3218 pub fn set_approval_parameters<
3219 T: std::convert::Into<
3220 std::option::Option<
3221 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3222 >,
3223 >,
3224 >(
3225 mut self,
3226 v: T,
3227 ) -> Self {
3228 self.approval_parameters = v.into();
3229 self
3230 }
3231
3232 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3233 /// if it holds a `QuorumParameters`, `None` if the field is not set or
3234 /// holds a different branch.
3235 pub fn quorum_parameters(
3236 &self,
3237 ) -> std::option::Option<
3238 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3239 > {
3240 #[allow(unreachable_patterns)]
3241 self.approval_parameters.as_ref().and_then(|v| match v {
3242 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3243 _ => std::option::Option::None,
3244 })
3245 }
3246
3247 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3248 /// to hold a `QuorumParameters`.
3249 ///
3250 /// Note that all the setters affecting `approval_parameters` are
3251 /// mutually exclusive.
3252 ///
3253 /// # Example
3254 /// ```ignore,no_run
3255 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3256 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3257 /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3258 /// assert!(x.quorum_parameters().is_some());
3259 /// assert!(x.required_action_quorum_parameters().is_none());
3260 /// ```
3261 pub fn set_quorum_parameters<
3262 T: std::convert::Into<
3263 std::boxed::Box<
3264 crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3265 >,
3266 >,
3267 >(
3268 mut self,
3269 v: T,
3270 ) -> Self {
3271 self.approval_parameters = std::option::Option::Some(
3272 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3273 v.into(),
3274 ),
3275 );
3276 self
3277 }
3278
3279 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3280 /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3281 /// holds a different branch.
3282 pub fn required_action_quorum_parameters(
3283 &self,
3284 ) -> std::option::Option<
3285 &std::boxed::Box<
3286 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3287 >,
3288 > {
3289 #[allow(unreachable_patterns)]
3290 self.approval_parameters.as_ref().and_then(|v| match v {
3291 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3292 _ => std::option::Option::None,
3293 })
3294 }
3295
3296 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3297 /// to hold a `RequiredActionQuorumParameters`.
3298 ///
3299 /// Note that all the setters affecting `approval_parameters` are
3300 /// mutually exclusive.
3301 ///
3302 /// # Example
3303 /// ```ignore,no_run
3304 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3305 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3306 /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3307 /// assert!(x.required_action_quorum_parameters().is_some());
3308 /// assert!(x.quorum_parameters().is_none());
3309 /// ```
3310 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{
3311 self.approval_parameters = std::option::Option::Some(
3312 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3313 v.into()
3314 )
3315 );
3316 self
3317 }
3318
3319 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3320 ///
3321 /// Note that all the setters affecting `expiration` are mutually
3322 /// exclusive.
3323 ///
3324 /// # Example
3325 /// ```ignore,no_run
3326 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3327 /// use wkt::Timestamp;
3328 /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3329 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3330 /// ```
3331 pub fn set_expiration<
3332 T: std::convert::Into<
3333 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3334 >,
3335 >(
3336 mut self,
3337 v: T,
3338 ) -> Self {
3339 self.expiration = v.into();
3340 self
3341 }
3342
3343 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3344 /// if it holds a `ExpireTime`, `None` if the field is not set or
3345 /// holds a different branch.
3346 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3347 #[allow(unreachable_patterns)]
3348 self.expiration.as_ref().and_then(|v| match v {
3349 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3350 std::option::Option::Some(v)
3351 }
3352 _ => std::option::Option::None,
3353 })
3354 }
3355
3356 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3357 /// to hold a `ExpireTime`.
3358 ///
3359 /// Note that all the setters affecting `expiration` are
3360 /// mutually exclusive.
3361 ///
3362 /// # Example
3363 /// ```ignore,no_run
3364 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3365 /// use wkt::Timestamp;
3366 /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3367 /// assert!(x.expire_time().is_some());
3368 /// assert!(x.ttl().is_none());
3369 /// ```
3370 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3371 mut self,
3372 v: T,
3373 ) -> Self {
3374 self.expiration = std::option::Option::Some(
3375 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3376 );
3377 self
3378 }
3379
3380 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3381 /// if it holds a `Ttl`, `None` if the field is not set or
3382 /// holds a different branch.
3383 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3384 #[allow(unreachable_patterns)]
3385 self.expiration.as_ref().and_then(|v| match v {
3386 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3387 std::option::Option::Some(v)
3388 }
3389 _ => std::option::Option::None,
3390 })
3391 }
3392
3393 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3394 /// to hold a `Ttl`.
3395 ///
3396 /// Note that all the setters affecting `expiration` are
3397 /// mutually exclusive.
3398 ///
3399 /// # Example
3400 /// ```ignore,no_run
3401 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3402 /// use wkt::Duration;
3403 /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3404 /// assert!(x.ttl().is_some());
3405 /// assert!(x.expire_time().is_none());
3406 /// ```
3407 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3408 self.expiration = std::option::Option::Some(
3409 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3410 );
3411 self
3412 }
3413
3414 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3415 ///
3416 /// Note that all the setters affecting `operation` are mutually
3417 /// exclusive.
3418 ///
3419 /// # Example
3420 /// ```ignore,no_run
3421 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3422 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3423 /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3424 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3425 /// ```
3426 pub fn set_operation<
3427 T: std::convert::Into<
3428 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3429 >,
3430 >(
3431 mut self,
3432 v: T,
3433 ) -> Self {
3434 self.operation = v.into();
3435 self
3436 }
3437
3438 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3439 /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3440 /// holds a different branch.
3441 pub fn register_two_factor_auth_keys(
3442 &self,
3443 ) -> std::option::Option<
3444 &std::boxed::Box<
3445 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3446 >,
3447 > {
3448 #[allow(unreachable_patterns)]
3449 self.operation.as_ref().and_then(|v| match v {
3450 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3451 _ => std::option::Option::None,
3452 })
3453 }
3454
3455 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3456 /// to hold a `RegisterTwoFactorAuthKeys`.
3457 ///
3458 /// Note that all the setters affecting `operation` are
3459 /// mutually exclusive.
3460 ///
3461 /// # Example
3462 /// ```ignore,no_run
3463 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3464 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3465 /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3466 /// assert!(x.register_two_factor_auth_keys().is_some());
3467 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3468 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3469 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3470 /// assert!(x.add_quorum_member().is_none());
3471 /// assert!(x.remove_quorum_member().is_none());
3472 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3473 /// ```
3474 pub fn set_register_two_factor_auth_keys<
3475 T: std::convert::Into<
3476 std::boxed::Box<
3477 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3478 >,
3479 >,
3480 >(
3481 mut self,
3482 v: T,
3483 ) -> Self {
3484 self.operation = std::option::Option::Some(
3485 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3486 v.into(),
3487 ),
3488 );
3489 self
3490 }
3491
3492 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3493 /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3494 /// holds a different branch.
3495 pub fn disable_single_tenant_hsm_instance(
3496 &self,
3497 ) -> std::option::Option<
3498 &std::boxed::Box<
3499 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3500 >,
3501 > {
3502 #[allow(unreachable_patterns)]
3503 self.operation.as_ref().and_then(|v| match v {
3504 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3505 _ => std::option::Option::None,
3506 })
3507 }
3508
3509 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3510 /// to hold a `DisableSingleTenantHsmInstance`.
3511 ///
3512 /// Note that all the setters affecting `operation` are
3513 /// mutually exclusive.
3514 ///
3515 /// # Example
3516 /// ```ignore,no_run
3517 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3518 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3519 /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3520 /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3521 /// assert!(x.register_two_factor_auth_keys().is_none());
3522 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3523 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3524 /// assert!(x.add_quorum_member().is_none());
3525 /// assert!(x.remove_quorum_member().is_none());
3526 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3527 /// ```
3528 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{
3529 self.operation = std::option::Option::Some(
3530 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3531 v.into()
3532 )
3533 );
3534 self
3535 }
3536
3537 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3538 /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3539 /// holds a different branch.
3540 pub fn enable_single_tenant_hsm_instance(
3541 &self,
3542 ) -> std::option::Option<
3543 &std::boxed::Box<
3544 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3545 >,
3546 > {
3547 #[allow(unreachable_patterns)]
3548 self.operation.as_ref().and_then(|v| match v {
3549 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3550 _ => std::option::Option::None,
3551 })
3552 }
3553
3554 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3555 /// to hold a `EnableSingleTenantHsmInstance`.
3556 ///
3557 /// Note that all the setters affecting `operation` are
3558 /// mutually exclusive.
3559 ///
3560 /// # Example
3561 /// ```ignore,no_run
3562 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3563 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3564 /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3565 /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3566 /// assert!(x.register_two_factor_auth_keys().is_none());
3567 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3568 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3569 /// assert!(x.add_quorum_member().is_none());
3570 /// assert!(x.remove_quorum_member().is_none());
3571 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3572 /// ```
3573 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{
3574 self.operation = std::option::Option::Some(
3575 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3576 v.into()
3577 )
3578 );
3579 self
3580 }
3581
3582 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3583 /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3584 /// holds a different branch.
3585 pub fn delete_single_tenant_hsm_instance(
3586 &self,
3587 ) -> std::option::Option<
3588 &std::boxed::Box<
3589 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3590 >,
3591 > {
3592 #[allow(unreachable_patterns)]
3593 self.operation.as_ref().and_then(|v| match v {
3594 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3595 _ => std::option::Option::None,
3596 })
3597 }
3598
3599 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3600 /// to hold a `DeleteSingleTenantHsmInstance`.
3601 ///
3602 /// Note that all the setters affecting `operation` are
3603 /// mutually exclusive.
3604 ///
3605 /// # Example
3606 /// ```ignore,no_run
3607 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3608 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3609 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3610 /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3611 /// assert!(x.register_two_factor_auth_keys().is_none());
3612 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3613 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3614 /// assert!(x.add_quorum_member().is_none());
3615 /// assert!(x.remove_quorum_member().is_none());
3616 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3617 /// ```
3618 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{
3619 self.operation = std::option::Option::Some(
3620 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3621 v.into()
3622 )
3623 );
3624 self
3625 }
3626
3627 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3628 /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3629 /// holds a different branch.
3630 pub fn add_quorum_member(
3631 &self,
3632 ) -> std::option::Option<
3633 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3634 > {
3635 #[allow(unreachable_patterns)]
3636 self.operation.as_ref().and_then(|v| match v {
3637 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3638 std::option::Option::Some(v)
3639 }
3640 _ => std::option::Option::None,
3641 })
3642 }
3643
3644 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3645 /// to hold a `AddQuorumMember`.
3646 ///
3647 /// Note that all the setters affecting `operation` are
3648 /// mutually exclusive.
3649 ///
3650 /// # Example
3651 /// ```ignore,no_run
3652 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3653 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3654 /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3655 /// assert!(x.add_quorum_member().is_some());
3656 /// assert!(x.register_two_factor_auth_keys().is_none());
3657 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3658 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3659 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3660 /// assert!(x.remove_quorum_member().is_none());
3661 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3662 /// ```
3663 pub fn set_add_quorum_member<
3664 T: std::convert::Into<
3665 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3666 >,
3667 >(
3668 mut self,
3669 v: T,
3670 ) -> Self {
3671 self.operation = std::option::Option::Some(
3672 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3673 );
3674 self
3675 }
3676
3677 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3678 /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3679 /// holds a different branch.
3680 pub fn remove_quorum_member(
3681 &self,
3682 ) -> std::option::Option<
3683 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3684 > {
3685 #[allow(unreachable_patterns)]
3686 self.operation.as_ref().and_then(|v| match v {
3687 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3688 std::option::Option::Some(v)
3689 }
3690 _ => std::option::Option::None,
3691 })
3692 }
3693
3694 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3695 /// to hold a `RemoveQuorumMember`.
3696 ///
3697 /// Note that all the setters affecting `operation` are
3698 /// mutually 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::RemoveQuorumMember;
3704 /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3705 /// assert!(x.remove_quorum_member().is_some());
3706 /// assert!(x.register_two_factor_auth_keys().is_none());
3707 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3708 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3709 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3710 /// assert!(x.add_quorum_member().is_none());
3711 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3712 /// ```
3713 pub fn set_remove_quorum_member<
3714 T: std::convert::Into<
3715 std::boxed::Box<
3716 crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
3717 >,
3718 >,
3719 >(
3720 mut self,
3721 v: T,
3722 ) -> Self {
3723 self.operation = std::option::Option::Some(
3724 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
3725 v.into(),
3726 ),
3727 );
3728 self
3729 }
3730
3731 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3732 /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
3733 /// holds a different branch.
3734 pub fn refresh_single_tenant_hsm_instance(
3735 &self,
3736 ) -> std::option::Option<
3737 &std::boxed::Box<
3738 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
3739 >,
3740 > {
3741 #[allow(unreachable_patterns)]
3742 self.operation.as_ref().and_then(|v| match v {
3743 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3744 _ => std::option::Option::None,
3745 })
3746 }
3747
3748 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3749 /// to hold a `RefreshSingleTenantHsmInstance`.
3750 ///
3751 /// Note that all the setters affecting `operation` are
3752 /// mutually exclusive.
3753 ///
3754 /// # Example
3755 /// ```ignore,no_run
3756 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3757 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
3758 /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
3759 /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
3760 /// assert!(x.register_two_factor_auth_keys().is_none());
3761 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3762 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3763 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3764 /// assert!(x.add_quorum_member().is_none());
3765 /// assert!(x.remove_quorum_member().is_none());
3766 /// ```
3767 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{
3768 self.operation = std::option::Option::Some(
3769 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
3770 v.into()
3771 )
3772 );
3773 self
3774 }
3775}
3776
3777impl wkt::message::Message for SingleTenantHsmInstanceProposal {
3778 fn typename() -> &'static str {
3779 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
3780 }
3781}
3782
3783/// Defines additional types related to [SingleTenantHsmInstanceProposal].
3784pub mod single_tenant_hsm_instance_proposal {
3785 #[allow(unused_imports)]
3786 use super::*;
3787
3788 /// Parameters of quorum approval for the
3789 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3790 ///
3791 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3792 #[derive(Clone, Default, PartialEq)]
3793 #[non_exhaustive]
3794 pub struct QuorumParameters {
3795 /// Output only. The required numbers of approvers. This is the M value used
3796 /// for M of N quorum auth. It is less than the number of public keys.
3797 pub required_approver_count: i32,
3798
3799 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
3800 /// of N of these challenges are required to be signed to approve the
3801 /// operation.
3802 pub challenges: std::vec::Vec<crate::model::Challenge>,
3803
3804 /// Output only. The public keys associated with the 2FA keys that have
3805 /// already approved the
3806 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3807 /// by signing the challenge.
3808 ///
3809 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3810 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
3811
3812 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3813 }
3814
3815 impl QuorumParameters {
3816 pub fn new() -> Self {
3817 std::default::Default::default()
3818 }
3819
3820 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
3821 ///
3822 /// # Example
3823 /// ```ignore,no_run
3824 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3825 /// let x = QuorumParameters::new().set_required_approver_count(42);
3826 /// ```
3827 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3828 self.required_approver_count = v.into();
3829 self
3830 }
3831
3832 /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
3833 ///
3834 /// # Example
3835 /// ```ignore,no_run
3836 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3837 /// use google_cloud_kms_v1::model::Challenge;
3838 /// let x = QuorumParameters::new()
3839 /// .set_challenges([
3840 /// Challenge::default()/* use setters */,
3841 /// Challenge::default()/* use (different) setters */,
3842 /// ]);
3843 /// ```
3844 pub fn set_challenges<T, V>(mut self, v: T) -> Self
3845 where
3846 T: std::iter::IntoIterator<Item = V>,
3847 V: std::convert::Into<crate::model::Challenge>,
3848 {
3849 use std::iter::Iterator;
3850 self.challenges = v.into_iter().map(|i| i.into()).collect();
3851 self
3852 }
3853
3854 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
3855 ///
3856 /// # Example
3857 /// ```ignore,no_run
3858 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3859 /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
3860 /// ```
3861 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
3862 where
3863 T: std::iter::IntoIterator<Item = V>,
3864 V: std::convert::Into<std::string::String>,
3865 {
3866 use std::iter::Iterator;
3867 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
3868 self
3869 }
3870 }
3871
3872 impl wkt::message::Message for QuorumParameters {
3873 fn typename() -> &'static str {
3874 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
3875 }
3876 }
3877
3878 /// Parameters for an approval that has both required challenges and a
3879 /// quorum.
3880 #[derive(Clone, Default, PartialEq)]
3881 #[non_exhaustive]
3882 pub struct RequiredActionQuorumParameters {
3883 /// Output only. A list of specific challenges that must be signed.
3884 /// For some operations, this will contain a single challenge.
3885 pub required_challenges: std::vec::Vec<crate::model::Challenge>,
3886
3887 /// Output only. The required number of quorum approvers. This is the M value
3888 /// used for M of N quorum auth. It is less than the number of public keys.
3889 pub required_approver_count: i32,
3890
3891 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
3892 /// of N of these challenges are required to be signed to approve the
3893 /// operation.
3894 pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
3895
3896 /// Output only. The public keys associated with the 2FA keys that have
3897 /// already approved the
3898 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3899 /// by signing the challenge.
3900 ///
3901 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3902 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
3903
3904 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3905 }
3906
3907 impl RequiredActionQuorumParameters {
3908 pub fn new() -> Self {
3909 std::default::Default::default()
3910 }
3911
3912 /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
3913 ///
3914 /// # Example
3915 /// ```ignore,no_run
3916 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3917 /// use google_cloud_kms_v1::model::Challenge;
3918 /// let x = RequiredActionQuorumParameters::new()
3919 /// .set_required_challenges([
3920 /// Challenge::default()/* use setters */,
3921 /// Challenge::default()/* use (different) setters */,
3922 /// ]);
3923 /// ```
3924 pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
3925 where
3926 T: std::iter::IntoIterator<Item = V>,
3927 V: std::convert::Into<crate::model::Challenge>,
3928 {
3929 use std::iter::Iterator;
3930 self.required_challenges = v.into_iter().map(|i| i.into()).collect();
3931 self
3932 }
3933
3934 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
3935 ///
3936 /// # Example
3937 /// ```ignore,no_run
3938 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3939 /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
3940 /// ```
3941 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3942 self.required_approver_count = v.into();
3943 self
3944 }
3945
3946 /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
3947 ///
3948 /// # Example
3949 /// ```ignore,no_run
3950 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3951 /// use google_cloud_kms_v1::model::Challenge;
3952 /// let x = RequiredActionQuorumParameters::new()
3953 /// .set_quorum_challenges([
3954 /// Challenge::default()/* use setters */,
3955 /// Challenge::default()/* use (different) setters */,
3956 /// ]);
3957 /// ```
3958 pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
3959 where
3960 T: std::iter::IntoIterator<Item = V>,
3961 V: std::convert::Into<crate::model::Challenge>,
3962 {
3963 use std::iter::Iterator;
3964 self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
3965 self
3966 }
3967
3968 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
3969 ///
3970 /// # Example
3971 /// ```ignore,no_run
3972 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3973 /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
3974 /// ```
3975 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
3976 where
3977 T: std::iter::IntoIterator<Item = V>,
3978 V: std::convert::Into<std::string::String>,
3979 {
3980 use std::iter::Iterator;
3981 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
3982 self
3983 }
3984 }
3985
3986 impl wkt::message::Message for RequiredActionQuorumParameters {
3987 fn typename() -> &'static str {
3988 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
3989 }
3990 }
3991
3992 /// Register 2FA keys for the
3993 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3994 /// This operation requires all Challenges to be signed by 2FA keys. The
3995 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
3996 /// be in the
3997 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
3998 /// state to perform this operation.
3999 ///
4000 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4001 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4002 #[derive(Clone, Default, PartialEq)]
4003 #[non_exhaustive]
4004 pub struct RegisterTwoFactorAuthKeys {
4005 /// Required. The required numbers of approvers to set for the
4006 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4007 /// This is the M value used for M of N quorum auth. Must be greater than or
4008 /// equal to 2 and less than or equal to
4009 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4010 ///
4011 ///
4012 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4013 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4014 pub required_approver_count: i32,
4015
4016 /// Required. The public keys associated with the 2FA keys for M of N quorum
4017 /// auth. Public keys must be associated with RSA 2048 keys.
4018 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4019
4020 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4021 }
4022
4023 impl RegisterTwoFactorAuthKeys {
4024 pub fn new() -> Self {
4025 std::default::Default::default()
4026 }
4027
4028 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4029 ///
4030 /// # Example
4031 /// ```ignore,no_run
4032 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4033 /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4034 /// ```
4035 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4036 self.required_approver_count = v.into();
4037 self
4038 }
4039
4040 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4041 ///
4042 /// # Example
4043 /// ```ignore,no_run
4044 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4045 /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4046 /// ```
4047 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4048 where
4049 T: std::iter::IntoIterator<Item = V>,
4050 V: std::convert::Into<std::string::String>,
4051 {
4052 use std::iter::Iterator;
4053 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4054 self
4055 }
4056 }
4057
4058 impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4059 fn typename() -> &'static str {
4060 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4061 }
4062 }
4063
4064 /// Disable the
4065 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4066 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4067 /// be in the
4068 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4069 /// perform this operation.
4070 ///
4071 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4072 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4073 #[derive(Clone, Default, PartialEq)]
4074 #[non_exhaustive]
4075 pub struct DisableSingleTenantHsmInstance {
4076 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4077 }
4078
4079 impl DisableSingleTenantHsmInstance {
4080 pub fn new() -> Self {
4081 std::default::Default::default()
4082 }
4083 }
4084
4085 impl wkt::message::Message for DisableSingleTenantHsmInstance {
4086 fn typename() -> &'static str {
4087 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4088 }
4089 }
4090
4091 /// Enable the
4092 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4093 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4094 /// be in the
4095 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4096 /// state to perform this operation.
4097 ///
4098 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4099 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4100 #[derive(Clone, Default, PartialEq)]
4101 #[non_exhaustive]
4102 pub struct EnableSingleTenantHsmInstance {
4103 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4104 }
4105
4106 impl EnableSingleTenantHsmInstance {
4107 pub fn new() -> Self {
4108 std::default::Default::default()
4109 }
4110 }
4111
4112 impl wkt::message::Message for EnableSingleTenantHsmInstance {
4113 fn typename() -> &'static str {
4114 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4115 }
4116 }
4117
4118 /// Delete the
4119 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4120 /// Deleting a
4121 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4122 /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4123 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4124 /// unusable. The
4125 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4126 /// not be in the
4127 /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4128 /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4129 /// to perform this operation.
4130 ///
4131 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4132 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4133 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4134 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4135 #[derive(Clone, Default, PartialEq)]
4136 #[non_exhaustive]
4137 pub struct DeleteSingleTenantHsmInstance {
4138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4139 }
4140
4141 impl DeleteSingleTenantHsmInstance {
4142 pub fn new() -> Self {
4143 std::default::Default::default()
4144 }
4145 }
4146
4147 impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4148 fn typename() -> &'static str {
4149 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4150 }
4151 }
4152
4153 /// Add a quorum member to the
4154 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4155 /// This will increase the
4156 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4157 /// by 1. The
4158 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4159 /// be in the
4160 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4161 /// perform this operation.
4162 ///
4163 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4164 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4165 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4166 #[derive(Clone, Default, PartialEq)]
4167 #[non_exhaustive]
4168 pub struct AddQuorumMember {
4169 /// Required. The public key associated with the 2FA key for the new quorum
4170 /// member to add. Public keys must be associated with RSA 2048 keys.
4171 pub two_factor_public_key_pem: std::string::String,
4172
4173 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4174 }
4175
4176 impl AddQuorumMember {
4177 pub fn new() -> Self {
4178 std::default::Default::default()
4179 }
4180
4181 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4182 ///
4183 /// # Example
4184 /// ```ignore,no_run
4185 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4186 /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4187 /// ```
4188 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4189 mut self,
4190 v: T,
4191 ) -> Self {
4192 self.two_factor_public_key_pem = v.into();
4193 self
4194 }
4195 }
4196
4197 impl wkt::message::Message for AddQuorumMember {
4198 fn typename() -> &'static str {
4199 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4200 }
4201 }
4202
4203 /// Remove a quorum member from the
4204 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4205 /// This will reduce
4206 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4207 /// by 1. The
4208 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4209 /// be in the
4210 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4211 /// perform this operation.
4212 ///
4213 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4214 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4215 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4216 #[derive(Clone, Default, PartialEq)]
4217 #[non_exhaustive]
4218 pub struct RemoveQuorumMember {
4219 /// Required. The public key associated with the 2FA key for the quorum
4220 /// member to remove. Public keys must be associated with RSA 2048 keys.
4221 pub two_factor_public_key_pem: std::string::String,
4222
4223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4224 }
4225
4226 impl RemoveQuorumMember {
4227 pub fn new() -> Self {
4228 std::default::Default::default()
4229 }
4230
4231 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4232 ///
4233 /// # Example
4234 /// ```ignore,no_run
4235 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4236 /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4237 /// ```
4238 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4239 mut self,
4240 v: T,
4241 ) -> Self {
4242 self.two_factor_public_key_pem = v.into();
4243 self
4244 }
4245 }
4246
4247 impl wkt::message::Message for RemoveQuorumMember {
4248 fn typename() -> &'static str {
4249 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4250 }
4251 }
4252
4253 /// Refreshes the
4254 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4255 /// This operation must be performed periodically to keep the
4256 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4257 /// active. This operation must be performed before
4258 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4259 /// has passed. The
4260 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4261 /// be in the
4262 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4263 /// perform this operation.
4264 ///
4265 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4266 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4267 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4268 #[derive(Clone, Default, PartialEq)]
4269 #[non_exhaustive]
4270 pub struct RefreshSingleTenantHsmInstance {
4271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4272 }
4273
4274 impl RefreshSingleTenantHsmInstance {
4275 pub fn new() -> Self {
4276 std::default::Default::default()
4277 }
4278 }
4279
4280 impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4281 fn typename() -> &'static str {
4282 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4283 }
4284 }
4285
4286 /// The set of states of a
4287 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4288 ///
4289 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4290 ///
4291 /// # Working with unknown values
4292 ///
4293 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4294 /// additional enum variants at any time. Adding new variants is not considered
4295 /// a breaking change. Applications should write their code in anticipation of:
4296 ///
4297 /// - New values appearing in future releases of the client library, **and**
4298 /// - New values received dynamically, without application changes.
4299 ///
4300 /// Please consult the [Working with enums] section in the user guide for some
4301 /// guidelines.
4302 ///
4303 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4304 #[derive(Clone, Debug, PartialEq)]
4305 #[non_exhaustive]
4306 pub enum State {
4307 /// Not specified.
4308 Unspecified,
4309 /// The
4310 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4311 /// is being created.
4312 ///
4313 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4314 Creating,
4315 /// The
4316 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4317 /// is pending approval.
4318 ///
4319 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4320 Pending,
4321 /// The
4322 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4323 /// has been approved.
4324 ///
4325 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4326 Approved,
4327 /// The
4328 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4329 /// is being executed.
4330 ///
4331 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4332 Running,
4333 /// The
4334 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4335 /// has been executed successfully.
4336 ///
4337 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4338 Succeeded,
4339 /// The
4340 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4341 /// has failed.
4342 ///
4343 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4344 Failed,
4345 /// The
4346 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4347 /// has been deleted and will be purged after the purge_time.
4348 ///
4349 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4350 Deleted,
4351 /// If set, the enum was initialized with an unknown value.
4352 ///
4353 /// Applications can examine the value using [State::value] or
4354 /// [State::name].
4355 UnknownValue(state::UnknownValue),
4356 }
4357
4358 #[doc(hidden)]
4359 pub mod state {
4360 #[allow(unused_imports)]
4361 use super::*;
4362 #[derive(Clone, Debug, PartialEq)]
4363 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4364 }
4365
4366 impl State {
4367 /// Gets the enum value.
4368 ///
4369 /// Returns `None` if the enum contains an unknown value deserialized from
4370 /// the string representation of enums.
4371 pub fn value(&self) -> std::option::Option<i32> {
4372 match self {
4373 Self::Unspecified => std::option::Option::Some(0),
4374 Self::Creating => std::option::Option::Some(1),
4375 Self::Pending => std::option::Option::Some(2),
4376 Self::Approved => std::option::Option::Some(3),
4377 Self::Running => std::option::Option::Some(4),
4378 Self::Succeeded => std::option::Option::Some(5),
4379 Self::Failed => std::option::Option::Some(6),
4380 Self::Deleted => std::option::Option::Some(7),
4381 Self::UnknownValue(u) => u.0.value(),
4382 }
4383 }
4384
4385 /// Gets the enum value as a string.
4386 ///
4387 /// Returns `None` if the enum contains an unknown value deserialized from
4388 /// the integer representation of enums.
4389 pub fn name(&self) -> std::option::Option<&str> {
4390 match self {
4391 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4392 Self::Creating => std::option::Option::Some("CREATING"),
4393 Self::Pending => std::option::Option::Some("PENDING"),
4394 Self::Approved => std::option::Option::Some("APPROVED"),
4395 Self::Running => std::option::Option::Some("RUNNING"),
4396 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4397 Self::Failed => std::option::Option::Some("FAILED"),
4398 Self::Deleted => std::option::Option::Some("DELETED"),
4399 Self::UnknownValue(u) => u.0.name(),
4400 }
4401 }
4402 }
4403
4404 impl std::default::Default for State {
4405 fn default() -> Self {
4406 use std::convert::From;
4407 Self::from(0)
4408 }
4409 }
4410
4411 impl std::fmt::Display for State {
4412 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4413 wkt::internal::display_enum(f, self.name(), self.value())
4414 }
4415 }
4416
4417 impl std::convert::From<i32> for State {
4418 fn from(value: i32) -> Self {
4419 match value {
4420 0 => Self::Unspecified,
4421 1 => Self::Creating,
4422 2 => Self::Pending,
4423 3 => Self::Approved,
4424 4 => Self::Running,
4425 5 => Self::Succeeded,
4426 6 => Self::Failed,
4427 7 => Self::Deleted,
4428 _ => Self::UnknownValue(state::UnknownValue(
4429 wkt::internal::UnknownEnumValue::Integer(value),
4430 )),
4431 }
4432 }
4433 }
4434
4435 impl std::convert::From<&str> for State {
4436 fn from(value: &str) -> Self {
4437 use std::string::ToString;
4438 match value {
4439 "STATE_UNSPECIFIED" => Self::Unspecified,
4440 "CREATING" => Self::Creating,
4441 "PENDING" => Self::Pending,
4442 "APPROVED" => Self::Approved,
4443 "RUNNING" => Self::Running,
4444 "SUCCEEDED" => Self::Succeeded,
4445 "FAILED" => Self::Failed,
4446 "DELETED" => Self::Deleted,
4447 _ => Self::UnknownValue(state::UnknownValue(
4448 wkt::internal::UnknownEnumValue::String(value.to_string()),
4449 )),
4450 }
4451 }
4452 }
4453
4454 impl serde::ser::Serialize for State {
4455 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4456 where
4457 S: serde::Serializer,
4458 {
4459 match self {
4460 Self::Unspecified => serializer.serialize_i32(0),
4461 Self::Creating => serializer.serialize_i32(1),
4462 Self::Pending => serializer.serialize_i32(2),
4463 Self::Approved => serializer.serialize_i32(3),
4464 Self::Running => serializer.serialize_i32(4),
4465 Self::Succeeded => serializer.serialize_i32(5),
4466 Self::Failed => serializer.serialize_i32(6),
4467 Self::Deleted => serializer.serialize_i32(7),
4468 Self::UnknownValue(u) => u.0.serialize(serializer),
4469 }
4470 }
4471 }
4472
4473 impl<'de> serde::de::Deserialize<'de> for State {
4474 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4475 where
4476 D: serde::Deserializer<'de>,
4477 {
4478 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4479 ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4480 ))
4481 }
4482 }
4483
4484 /// The approval parameters for the
4485 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4486 /// The type of parameters is determined by the operation being proposed.
4487 ///
4488 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4489 #[derive(Clone, Debug, PartialEq)]
4490 #[non_exhaustive]
4491 pub enum ApprovalParameters {
4492 /// Output only. The quorum approval parameters for the
4493 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4494 ///
4495 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4496 QuorumParameters(
4497 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4498 ),
4499 /// Output only. Parameters for an approval of a
4500 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4501 /// that has both required challenges and a quorum.
4502 ///
4503 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4504 RequiredActionQuorumParameters(
4505 std::boxed::Box<
4506 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4507 >,
4508 ),
4509 }
4510
4511 /// The expiration of the
4512 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4513 /// If not set, the
4514 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4515 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4516 /// time is 5 minutes.
4517 ///
4518 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4519 #[derive(Clone, Debug, PartialEq)]
4520 #[non_exhaustive]
4521 pub enum Expiration {
4522 /// The time at which the
4523 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4524 /// will expire if not approved and executed.
4525 ///
4526 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4527 ExpireTime(std::boxed::Box<wkt::Timestamp>),
4528 /// Input only. The TTL for the
4529 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4530 /// Proposals will expire after this duration.
4531 ///
4532 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4533 Ttl(std::boxed::Box<wkt::Duration>),
4534 }
4535
4536 /// The operation to perform on the
4537 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4538 ///
4539 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4540 #[derive(Clone, Debug, PartialEq)]
4541 #[non_exhaustive]
4542 pub enum Operation {
4543 /// Register 2FA keys for the
4544 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4545 /// This operation requires all N Challenges to be signed by 2FA keys. The
4546 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4547 /// must be in the
4548 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4549 /// state to perform this operation.
4550 ///
4551 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4552 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4553 RegisterTwoFactorAuthKeys(
4554 std::boxed::Box<
4555 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4556 >,
4557 ),
4558 /// Disable the
4559 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4560 /// The
4561 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4562 /// must be in the
4563 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4564 /// to perform this operation.
4565 ///
4566 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4567 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4568 DisableSingleTenantHsmInstance(
4569 std::boxed::Box<
4570 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4571 >,
4572 ),
4573 /// Enable the
4574 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4575 /// The
4576 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4577 /// must be in the
4578 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4579 /// state to perform this operation.
4580 ///
4581 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4582 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4583 EnableSingleTenantHsmInstance(
4584 std::boxed::Box<
4585 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4586 >,
4587 ),
4588 /// Delete the
4589 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4590 /// Deleting a
4591 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4592 /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4593 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4594 /// unusable. The
4595 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4596 /// must be in the
4597 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
4598 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4599 /// state to perform this operation.
4600 ///
4601 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4602 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4603 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4604 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4605 DeleteSingleTenantHsmInstance(
4606 std::boxed::Box<
4607 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
4608 >,
4609 ),
4610 /// Add a quorum member to the
4611 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4612 /// This will increase the
4613 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4614 /// by 1. The
4615 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4616 /// must be in the
4617 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4618 /// to perform this operation.
4619 ///
4620 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4621 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4622 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4623 AddQuorumMember(
4624 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
4625 ),
4626 /// Remove a quorum member from the
4627 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4628 /// This will reduce
4629 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4630 /// by 1. The
4631 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4632 /// must be in the
4633 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4634 /// to perform this operation.
4635 ///
4636 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4637 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4638 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4639 RemoveQuorumMember(
4640 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
4641 ),
4642 /// Refreshes the
4643 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4644 /// This operation must be performed periodically to keep the
4645 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4646 /// active. This operation must be performed before
4647 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4648 /// has passed. The
4649 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4650 /// must be in the
4651 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4652 /// to perform this operation.
4653 ///
4654 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4655 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4656 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4657 RefreshSingleTenantHsmInstance(
4658 std::boxed::Box<
4659 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4660 >,
4661 ),
4662 }
4663}
4664
4665/// A challenge to be signed by a 2FA key.
4666#[derive(Clone, Default, PartialEq)]
4667#[non_exhaustive]
4668pub struct Challenge {
4669 /// Output only. The challenge to be signed by the 2FA key indicated by the
4670 /// public key.
4671 pub challenge: ::bytes::Bytes,
4672
4673 /// Output only. The public key associated with the 2FA key that should sign
4674 /// the challenge.
4675 pub public_key_pem: std::string::String,
4676
4677 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4678}
4679
4680impl Challenge {
4681 pub fn new() -> Self {
4682 std::default::Default::default()
4683 }
4684
4685 /// Sets the value of [challenge][crate::model::Challenge::challenge].
4686 ///
4687 /// # Example
4688 /// ```ignore,no_run
4689 /// # use google_cloud_kms_v1::model::Challenge;
4690 /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
4691 /// ```
4692 pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4693 self.challenge = v.into();
4694 self
4695 }
4696
4697 /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
4698 ///
4699 /// # Example
4700 /// ```ignore,no_run
4701 /// # use google_cloud_kms_v1::model::Challenge;
4702 /// let x = Challenge::new().set_public_key_pem("example");
4703 /// ```
4704 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4705 self.public_key_pem = v.into();
4706 self
4707 }
4708}
4709
4710impl wkt::message::Message for Challenge {
4711 fn typename() -> &'static str {
4712 "type.googleapis.com/google.cloud.kms.v1.Challenge"
4713 }
4714}
4715
4716/// A reply to a challenge signed by a 2FA key.
4717#[derive(Clone, Default, PartialEq)]
4718#[non_exhaustive]
4719pub struct ChallengeReply {
4720 /// Required. The signed challenge associated with the 2FA key.
4721 /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
4722 pub signed_challenge: ::bytes::Bytes,
4723
4724 /// Required. The public key associated with the 2FA key.
4725 pub public_key_pem: std::string::String,
4726
4727 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4728}
4729
4730impl ChallengeReply {
4731 pub fn new() -> Self {
4732 std::default::Default::default()
4733 }
4734
4735 /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
4736 ///
4737 /// # Example
4738 /// ```ignore,no_run
4739 /// # use google_cloud_kms_v1::model::ChallengeReply;
4740 /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
4741 /// ```
4742 pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4743 self.signed_challenge = v.into();
4744 self
4745 }
4746
4747 /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
4748 ///
4749 /// # Example
4750 /// ```ignore,no_run
4751 /// # use google_cloud_kms_v1::model::ChallengeReply;
4752 /// let x = ChallengeReply::new().set_public_key_pem("example");
4753 /// ```
4754 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4755 self.public_key_pem = v.into();
4756 self
4757 }
4758}
4759
4760impl wkt::message::Message for ChallengeReply {
4761 fn typename() -> &'static str {
4762 "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
4763 }
4764}
4765
4766/// Request message for
4767/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
4768///
4769/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4770#[derive(Clone, Default, PartialEq)]
4771#[non_exhaustive]
4772pub struct ListSingleTenantHsmInstancesRequest {
4773 /// Required. The resource name of the location associated with the
4774 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4775 /// list, in the format `projects/*/locations/*`.
4776 ///
4777 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4778 pub parent: std::string::String,
4779
4780 /// Optional. Optional limit on the number of
4781 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4782 /// include in the response. Further
4783 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
4784 /// subsequently be
4785 /// obtained by including the
4786 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
4787 /// in a subsequent request. If unspecified, the server will pick an
4788 /// appropriate default.
4789 ///
4790 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4791 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4792 pub page_size: i32,
4793
4794 /// Optional. Optional pagination token, returned earlier via
4795 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
4796 ///
4797 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4798 pub page_token: std::string::String,
4799
4800 /// Optional. Only include resources that match the filter in the response. For
4801 /// more information, see
4802 /// [Sorting and filtering list
4803 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
4804 pub filter: std::string::String,
4805
4806 /// Optional. Specify how the results should be sorted. If not specified, the
4807 /// results will be sorted in the default order. For more information, see
4808 /// [Sorting and filtering list
4809 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
4810 pub order_by: std::string::String,
4811
4812 /// Optional. If set to true,
4813 /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
4814 /// will also return
4815 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
4816 /// DELETED state.
4817 ///
4818 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4819 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4820 pub show_deleted: bool,
4821
4822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4823}
4824
4825impl ListSingleTenantHsmInstancesRequest {
4826 pub fn new() -> Self {
4827 std::default::Default::default()
4828 }
4829
4830 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
4831 ///
4832 /// # Example
4833 /// ```ignore,no_run
4834 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4835 /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
4836 /// ```
4837 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4838 self.parent = v.into();
4839 self
4840 }
4841
4842 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
4843 ///
4844 /// # Example
4845 /// ```ignore,no_run
4846 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4847 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
4848 /// ```
4849 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4850 self.page_size = v.into();
4851 self
4852 }
4853
4854 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
4855 ///
4856 /// # Example
4857 /// ```ignore,no_run
4858 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4859 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
4860 /// ```
4861 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4862 self.page_token = v.into();
4863 self
4864 }
4865
4866 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
4867 ///
4868 /// # Example
4869 /// ```ignore,no_run
4870 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4871 /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
4872 /// ```
4873 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4874 self.filter = v.into();
4875 self
4876 }
4877
4878 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
4879 ///
4880 /// # Example
4881 /// ```ignore,no_run
4882 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4883 /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
4884 /// ```
4885 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4886 self.order_by = v.into();
4887 self
4888 }
4889
4890 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
4891 ///
4892 /// # Example
4893 /// ```ignore,no_run
4894 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
4895 /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
4896 /// ```
4897 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4898 self.show_deleted = v.into();
4899 self
4900 }
4901}
4902
4903impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
4904 fn typename() -> &'static str {
4905 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
4906 }
4907}
4908
4909/// Response message for
4910/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
4911///
4912/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4913#[derive(Clone, Default, PartialEq)]
4914#[non_exhaustive]
4915pub struct ListSingleTenantHsmInstancesResponse {
4916 /// The list of
4917 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
4918 ///
4919 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4920 pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
4921
4922 /// A token to retrieve next page of results. Pass this value in
4923 /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
4924 /// to retrieve the next page of results.
4925 ///
4926 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
4927 pub next_page_token: std::string::String,
4928
4929 /// The total number of
4930 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
4931 /// that matched the query.
4932 ///
4933 /// This field is not populated if
4934 /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
4935 /// is applied.
4936 ///
4937 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
4938 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4939 pub total_size: i32,
4940
4941 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4942}
4943
4944impl ListSingleTenantHsmInstancesResponse {
4945 pub fn new() -> Self {
4946 std::default::Default::default()
4947 }
4948
4949 /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
4950 ///
4951 /// # Example
4952 /// ```ignore,no_run
4953 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
4954 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
4955 /// let x = ListSingleTenantHsmInstancesResponse::new()
4956 /// .set_single_tenant_hsm_instances([
4957 /// SingleTenantHsmInstance::default()/* use setters */,
4958 /// SingleTenantHsmInstance::default()/* use (different) setters */,
4959 /// ]);
4960 /// ```
4961 pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
4962 where
4963 T: std::iter::IntoIterator<Item = V>,
4964 V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
4965 {
4966 use std::iter::Iterator;
4967 self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
4968 self
4969 }
4970
4971 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
4972 ///
4973 /// # Example
4974 /// ```ignore,no_run
4975 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
4976 /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
4977 /// ```
4978 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4979 self.next_page_token = v.into();
4980 self
4981 }
4982
4983 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
4984 ///
4985 /// # Example
4986 /// ```ignore,no_run
4987 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
4988 /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
4989 /// ```
4990 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4991 self.total_size = v.into();
4992 self
4993 }
4994}
4995
4996impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
4997 fn typename() -> &'static str {
4998 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
4999 }
5000}
5001
5002#[doc(hidden)]
5003impl google_cloud_gax::paginator::internal::PageableResponse
5004 for ListSingleTenantHsmInstancesResponse
5005{
5006 type PageItem = crate::model::SingleTenantHsmInstance;
5007
5008 fn items(self) -> std::vec::Vec<Self::PageItem> {
5009 self.single_tenant_hsm_instances
5010 }
5011
5012 fn next_page_token(&self) -> std::string::String {
5013 use std::clone::Clone;
5014 self.next_page_token.clone()
5015 }
5016}
5017
5018/// Request message for
5019/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5020///
5021/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5022#[derive(Clone, Default, PartialEq)]
5023#[non_exhaustive]
5024pub struct GetSingleTenantHsmInstanceRequest {
5025 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5026 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5027 /// to get.
5028 ///
5029 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5030 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5031 pub name: std::string::String,
5032
5033 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5034}
5035
5036impl GetSingleTenantHsmInstanceRequest {
5037 pub fn new() -> Self {
5038 std::default::Default::default()
5039 }
5040
5041 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5042 ///
5043 /// # Example
5044 /// ```ignore,no_run
5045 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5046 /// let x = GetSingleTenantHsmInstanceRequest::new().set_name("example");
5047 /// ```
5048 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5049 self.name = v.into();
5050 self
5051 }
5052}
5053
5054impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5055 fn typename() -> &'static str {
5056 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5057 }
5058}
5059
5060/// Request message for
5061/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5062///
5063/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5064#[derive(Clone, Default, PartialEq)]
5065#[non_exhaustive]
5066pub struct CreateSingleTenantHsmInstanceRequest {
5067 /// Required. The resource name of the location associated with the
5068 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5069 /// the format `projects/*/locations/*`.
5070 ///
5071 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5072 pub parent: std::string::String,
5073
5074 /// Optional. It must be unique within a location and match the regular
5075 /// expression `[a-zA-Z0-9_-]{1,63}`.
5076 pub single_tenant_hsm_instance_id: std::string::String,
5077
5078 /// Required. An
5079 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5080 /// initial field values.
5081 ///
5082 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5083 pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5084
5085 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5086}
5087
5088impl CreateSingleTenantHsmInstanceRequest {
5089 pub fn new() -> Self {
5090 std::default::Default::default()
5091 }
5092
5093 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5094 ///
5095 /// # Example
5096 /// ```ignore,no_run
5097 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5098 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5099 /// ```
5100 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5101 self.parent = v.into();
5102 self
5103 }
5104
5105 /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5106 ///
5107 /// # Example
5108 /// ```ignore,no_run
5109 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5110 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5111 /// ```
5112 pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5113 mut self,
5114 v: T,
5115 ) -> Self {
5116 self.single_tenant_hsm_instance_id = v.into();
5117 self
5118 }
5119
5120 /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5121 ///
5122 /// # Example
5123 /// ```ignore,no_run
5124 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5125 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5126 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5127 /// ```
5128 pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5129 where
5130 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5131 {
5132 self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5133 self
5134 }
5135
5136 /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5137 ///
5138 /// # Example
5139 /// ```ignore,no_run
5140 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5141 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5142 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5143 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5144 /// ```
5145 pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5146 where
5147 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5148 {
5149 self.single_tenant_hsm_instance = v.map(|x| x.into());
5150 self
5151 }
5152}
5153
5154impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5155 fn typename() -> &'static str {
5156 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5157 }
5158}
5159
5160/// Metadata message for
5161/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5162/// long-running operation response.
5163///
5164/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5165#[derive(Clone, Default, PartialEq)]
5166#[non_exhaustive]
5167pub struct CreateSingleTenantHsmInstanceMetadata {
5168 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5169}
5170
5171impl CreateSingleTenantHsmInstanceMetadata {
5172 pub fn new() -> Self {
5173 std::default::Default::default()
5174 }
5175}
5176
5177impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5178 fn typename() -> &'static str {
5179 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5180 }
5181}
5182
5183/// Request message for
5184/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5185///
5186/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5187#[derive(Clone, Default, PartialEq)]
5188#[non_exhaustive]
5189pub struct CreateSingleTenantHsmInstanceProposalRequest {
5190 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5191 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5192 /// associated with the
5193 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5194 ///
5195 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5196 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5197 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5198 pub parent: std::string::String,
5199
5200 /// Optional. It must be unique within a location and match the regular
5201 /// expression `[a-zA-Z0-9_-]{1,63}`.
5202 pub single_tenant_hsm_instance_proposal_id: std::string::String,
5203
5204 /// Required. The
5205 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5206 /// to create.
5207 ///
5208 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5209 pub single_tenant_hsm_instance_proposal:
5210 std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5211
5212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5213}
5214
5215impl CreateSingleTenantHsmInstanceProposalRequest {
5216 pub fn new() -> Self {
5217 std::default::Default::default()
5218 }
5219
5220 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5221 ///
5222 /// # Example
5223 /// ```ignore,no_run
5224 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5225 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent("example");
5226 /// ```
5227 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5228 self.parent = v.into();
5229 self
5230 }
5231
5232 /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5233 ///
5234 /// # Example
5235 /// ```ignore,no_run
5236 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5237 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5238 /// ```
5239 pub fn set_single_tenant_hsm_instance_proposal_id<
5240 T: std::convert::Into<std::string::String>,
5241 >(
5242 mut self,
5243 v: T,
5244 ) -> Self {
5245 self.single_tenant_hsm_instance_proposal_id = v.into();
5246 self
5247 }
5248
5249 /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5250 ///
5251 /// # Example
5252 /// ```ignore,no_run
5253 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5254 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5255 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5256 /// ```
5257 pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5258 where
5259 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5260 {
5261 self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5262 self
5263 }
5264
5265 /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5266 ///
5267 /// # Example
5268 /// ```ignore,no_run
5269 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5270 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5271 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5272 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5273 /// ```
5274 pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5275 mut self,
5276 v: std::option::Option<T>,
5277 ) -> Self
5278 where
5279 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5280 {
5281 self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5282 self
5283 }
5284}
5285
5286impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5287 fn typename() -> &'static str {
5288 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5289 }
5290}
5291
5292/// Metadata message for
5293/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5294/// long-running operation response.
5295///
5296/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5297#[derive(Clone, Default, PartialEq)]
5298#[non_exhaustive]
5299pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5300 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5301}
5302
5303impl CreateSingleTenantHsmInstanceProposalMetadata {
5304 pub fn new() -> Self {
5305 std::default::Default::default()
5306 }
5307}
5308
5309impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5310 fn typename() -> &'static str {
5311 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5312 }
5313}
5314
5315/// Request message for
5316/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5317///
5318/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5319#[derive(Clone, Default, PartialEq)]
5320#[non_exhaustive]
5321pub struct GetSingleTenantHsmInstanceProposalRequest {
5322 /// Required. The
5323 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5324 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5325 /// to get.
5326 ///
5327 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5328 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5329 pub name: std::string::String,
5330
5331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5332}
5333
5334impl GetSingleTenantHsmInstanceProposalRequest {
5335 pub fn new() -> Self {
5336 std::default::Default::default()
5337 }
5338
5339 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5340 ///
5341 /// # Example
5342 /// ```ignore,no_run
5343 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5344 /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5345 /// ```
5346 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5347 self.name = v.into();
5348 self
5349 }
5350}
5351
5352impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5353 fn typename() -> &'static str {
5354 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5355 }
5356}
5357
5358/// Request message for
5359/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5360///
5361/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5362#[derive(Clone, Default, PartialEq)]
5363#[non_exhaustive]
5364pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5365 /// Required. The
5366 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5367 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5368 /// to approve.
5369 ///
5370 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5371 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5372 pub name: std::string::String,
5373
5374 /// The approval payload. The type of approval payload must correspond to the
5375 /// type of approval_parameters in the proposal.
5376 pub approval_payload: std::option::Option<
5377 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5378 >,
5379
5380 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5381}
5382
5383impl ApproveSingleTenantHsmInstanceProposalRequest {
5384 pub fn new() -> Self {
5385 std::default::Default::default()
5386 }
5387
5388 /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5389 ///
5390 /// # Example
5391 /// ```ignore,no_run
5392 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5393 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5394 /// ```
5395 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5396 self.name = v.into();
5397 self
5398 }
5399
5400 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5401 ///
5402 /// Note that all the setters affecting `approval_payload` are mutually
5403 /// exclusive.
5404 ///
5405 /// # Example
5406 /// ```ignore,no_run
5407 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5408 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5409 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5410 /// google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5411 /// ```
5412 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
5413 {
5414 self.approval_payload = v.into();
5415 self
5416 }
5417
5418 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5419 /// if it holds a `QuorumReply`, `None` if the field is not set or
5420 /// holds a different branch.
5421 pub fn quorum_reply(
5422 &self,
5423 ) -> std::option::Option<
5424 &std::boxed::Box<
5425 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5426 >,
5427 > {
5428 #[allow(unreachable_patterns)]
5429 self.approval_payload.as_ref().and_then(|v| match v {
5430 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5431 _ => std::option::Option::None,
5432 })
5433 }
5434
5435 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5436 /// to hold a `QuorumReply`.
5437 ///
5438 /// Note that all the setters affecting `approval_payload` are
5439 /// mutually exclusive.
5440 ///
5441 /// # Example
5442 /// ```ignore,no_run
5443 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5444 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5445 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5446 /// assert!(x.quorum_reply().is_some());
5447 /// assert!(x.required_action_quorum_reply().is_none());
5448 /// ```
5449 pub fn set_quorum_reply<
5450 T: std::convert::Into<
5451 std::boxed::Box<
5452 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5453 >,
5454 >,
5455 >(
5456 mut self,
5457 v: T,
5458 ) -> Self {
5459 self.approval_payload = std::option::Option::Some(
5460 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5461 v.into()
5462 )
5463 );
5464 self
5465 }
5466
5467 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5468 /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5469 /// holds a different branch.
5470 pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5471 #[allow(unreachable_patterns)]
5472 self.approval_payload.as_ref().and_then(|v| match v {
5473 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5474 _ => std::option::Option::None,
5475 })
5476 }
5477
5478 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5479 /// to hold a `RequiredActionQuorumReply`.
5480 ///
5481 /// Note that all the setters affecting `approval_payload` are
5482 /// mutually exclusive.
5483 ///
5484 /// # Example
5485 /// ```ignore,no_run
5486 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5487 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5488 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5489 /// assert!(x.required_action_quorum_reply().is_some());
5490 /// assert!(x.quorum_reply().is_none());
5491 /// ```
5492 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{
5493 self.approval_payload = std::option::Option::Some(
5494 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5495 v.into()
5496 )
5497 );
5498 self
5499 }
5500}
5501
5502impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5503 fn typename() -> &'static str {
5504 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5505 }
5506}
5507
5508/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5509pub mod approve_single_tenant_hsm_instance_proposal_request {
5510 #[allow(unused_imports)]
5511 use super::*;
5512
5513 /// The reply to
5514 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5515 /// for approving the proposal.
5516 ///
5517 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5518 #[derive(Clone, Default, PartialEq)]
5519 #[non_exhaustive]
5520 pub struct QuorumReply {
5521 /// Required. The challenge replies to approve the proposal. Challenge
5522 /// replies can be sent across multiple requests. The proposal will be
5523 /// approved when
5524 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5525 /// challenge replies are provided.
5526 ///
5527 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5528 pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5529
5530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5531 }
5532
5533 impl QuorumReply {
5534 pub fn new() -> Self {
5535 std::default::Default::default()
5536 }
5537
5538 /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5539 ///
5540 /// # Example
5541 /// ```ignore,no_run
5542 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5543 /// use google_cloud_kms_v1::model::ChallengeReply;
5544 /// let x = QuorumReply::new()
5545 /// .set_challenge_replies([
5546 /// ChallengeReply::default()/* use setters */,
5547 /// ChallengeReply::default()/* use (different) setters */,
5548 /// ]);
5549 /// ```
5550 pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5551 where
5552 T: std::iter::IntoIterator<Item = V>,
5553 V: std::convert::Into<crate::model::ChallengeReply>,
5554 {
5555 use std::iter::Iterator;
5556 self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5557 self
5558 }
5559 }
5560
5561 impl wkt::message::Message for QuorumReply {
5562 fn typename() -> &'static str {
5563 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
5564 }
5565 }
5566
5567 /// The reply to
5568 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5569 /// for approving the proposal.
5570 ///
5571 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5572 #[derive(Clone, Default, PartialEq)]
5573 #[non_exhaustive]
5574 pub struct RequiredActionQuorumReply {
5575 /// Required. All required challenges must be signed for the proposal to be
5576 /// approved. These can be sent across multiple requests.
5577 pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5578
5579 /// Required. Quorum members' signed challenge replies. These can be provided
5580 /// across multiple requests. The proposal will be approved when
5581 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
5582 /// quorum_challenge_replies are provided and when all
5583 /// required_challenge_replies are provided.
5584 ///
5585 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
5586 pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5587
5588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5589 }
5590
5591 impl RequiredActionQuorumReply {
5592 pub fn new() -> Self {
5593 std::default::Default::default()
5594 }
5595
5596 /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
5597 ///
5598 /// # Example
5599 /// ```ignore,no_run
5600 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5601 /// use google_cloud_kms_v1::model::ChallengeReply;
5602 /// let x = RequiredActionQuorumReply::new()
5603 /// .set_required_challenge_replies([
5604 /// ChallengeReply::default()/* use setters */,
5605 /// ChallengeReply::default()/* use (different) setters */,
5606 /// ]);
5607 /// ```
5608 pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
5609 where
5610 T: std::iter::IntoIterator<Item = V>,
5611 V: std::convert::Into<crate::model::ChallengeReply>,
5612 {
5613 use std::iter::Iterator;
5614 self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5615 self
5616 }
5617
5618 /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
5619 ///
5620 /// # Example
5621 /// ```ignore,no_run
5622 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5623 /// use google_cloud_kms_v1::model::ChallengeReply;
5624 /// let x = RequiredActionQuorumReply::new()
5625 /// .set_quorum_challenge_replies([
5626 /// ChallengeReply::default()/* use setters */,
5627 /// ChallengeReply::default()/* use (different) setters */,
5628 /// ]);
5629 /// ```
5630 pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
5631 where
5632 T: std::iter::IntoIterator<Item = V>,
5633 V: std::convert::Into<crate::model::ChallengeReply>,
5634 {
5635 use std::iter::Iterator;
5636 self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5637 self
5638 }
5639 }
5640
5641 impl wkt::message::Message for RequiredActionQuorumReply {
5642 fn typename() -> &'static str {
5643 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
5644 }
5645 }
5646
5647 /// The approval payload. The type of approval payload must correspond to the
5648 /// type of approval_parameters in the proposal.
5649 #[derive(Clone, Debug, PartialEq)]
5650 #[non_exhaustive]
5651 pub enum ApprovalPayload {
5652 /// Required. The reply to
5653 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5654 /// for approving the proposal.
5655 ///
5656 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5657 QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
5658 /// Required. The reply to
5659 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5660 /// for approving the proposal.
5661 ///
5662 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5663 RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
5664 }
5665}
5666
5667/// Response message for
5668/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5669///
5670/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5671#[derive(Clone, Default, PartialEq)]
5672#[non_exhaustive]
5673pub struct ApproveSingleTenantHsmInstanceProposalResponse {
5674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5675}
5676
5677impl ApproveSingleTenantHsmInstanceProposalResponse {
5678 pub fn new() -> Self {
5679 std::default::Default::default()
5680 }
5681}
5682
5683impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
5684 fn typename() -> &'static str {
5685 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
5686 }
5687}
5688
5689/// Request message for
5690/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5691///
5692/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5693#[derive(Clone, Default, PartialEq)]
5694#[non_exhaustive]
5695pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
5696 /// Required. The
5697 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5698 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5699 /// to execute.
5700 ///
5701 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5702 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5703 pub name: std::string::String,
5704
5705 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5706}
5707
5708impl ExecuteSingleTenantHsmInstanceProposalRequest {
5709 pub fn new() -> Self {
5710 std::default::Default::default()
5711 }
5712
5713 /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
5714 ///
5715 /// # Example
5716 /// ```ignore,no_run
5717 /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
5718 /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5719 /// ```
5720 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5721 self.name = v.into();
5722 self
5723 }
5724}
5725
5726impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
5727 fn typename() -> &'static str {
5728 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
5729 }
5730}
5731
5732/// Response message for
5733/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5734///
5735/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5736#[derive(Clone, Default, PartialEq)]
5737#[non_exhaustive]
5738pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
5739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5740}
5741
5742impl ExecuteSingleTenantHsmInstanceProposalResponse {
5743 pub fn new() -> Self {
5744 std::default::Default::default()
5745 }
5746}
5747
5748impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
5749 fn typename() -> &'static str {
5750 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
5751 }
5752}
5753
5754/// Metadata message for
5755/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
5756/// long-running operation response.
5757///
5758/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5759#[derive(Clone, Default, PartialEq)]
5760#[non_exhaustive]
5761pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
5762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5763}
5764
5765impl ExecuteSingleTenantHsmInstanceProposalMetadata {
5766 pub fn new() -> Self {
5767 std::default::Default::default()
5768 }
5769}
5770
5771impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
5772 fn typename() -> &'static str {
5773 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
5774 }
5775}
5776
5777/// Request message for
5778/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
5779///
5780/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5781#[derive(Clone, Default, PartialEq)]
5782#[non_exhaustive]
5783pub struct ListSingleTenantHsmInstanceProposalsRequest {
5784 /// Required. The resource name of the single tenant HSM instance associated
5785 /// with the
5786 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5787 /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
5788 ///
5789 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5790 pub parent: std::string::String,
5791
5792 /// Optional. Optional limit on the number of
5793 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5794 /// to include in the response. Further
5795 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5796 /// can subsequently be obtained by including the
5797 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
5798 /// in a subsequent request. If unspecified, the server will pick an
5799 /// appropriate default.
5800 ///
5801 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
5802 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5803 pub page_size: i32,
5804
5805 /// Optional. Optional pagination token, returned earlier via
5806 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
5807 ///
5808 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
5809 pub page_token: std::string::String,
5810
5811 /// Optional. Only include resources that match the filter in the response. For
5812 /// more information, see
5813 /// [Sorting and filtering list
5814 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5815 pub filter: std::string::String,
5816
5817 /// Optional. Specify how the results should be sorted. If not specified, the
5818 /// results will be sorted in the default order. For more information, see
5819 /// [Sorting and filtering list
5820 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5821 pub order_by: std::string::String,
5822
5823 /// Optional. If set to true,
5824 /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
5825 /// will also return
5826 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5827 /// in DELETED state.
5828 ///
5829 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5830 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5831 pub show_deleted: bool,
5832
5833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5834}
5835
5836impl ListSingleTenantHsmInstanceProposalsRequest {
5837 pub fn new() -> Self {
5838 std::default::Default::default()
5839 }
5840
5841 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
5842 ///
5843 /// # Example
5844 /// ```ignore,no_run
5845 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5846 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent("example");
5847 /// ```
5848 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5849 self.parent = v.into();
5850 self
5851 }
5852
5853 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
5854 ///
5855 /// # Example
5856 /// ```ignore,no_run
5857 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5858 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
5859 /// ```
5860 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5861 self.page_size = v.into();
5862 self
5863 }
5864
5865 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
5866 ///
5867 /// # Example
5868 /// ```ignore,no_run
5869 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5870 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
5871 /// ```
5872 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5873 self.page_token = v.into();
5874 self
5875 }
5876
5877 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
5878 ///
5879 /// # Example
5880 /// ```ignore,no_run
5881 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5882 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
5883 /// ```
5884 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5885 self.filter = v.into();
5886 self
5887 }
5888
5889 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
5890 ///
5891 /// # Example
5892 /// ```ignore,no_run
5893 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5894 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
5895 /// ```
5896 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5897 self.order_by = v.into();
5898 self
5899 }
5900
5901 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
5902 ///
5903 /// # Example
5904 /// ```ignore,no_run
5905 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
5906 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
5907 /// ```
5908 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5909 self.show_deleted = v.into();
5910 self
5911 }
5912}
5913
5914impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
5915 fn typename() -> &'static str {
5916 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
5917 }
5918}
5919
5920/// Response message for
5921/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
5922///
5923/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5924#[derive(Clone, Default, PartialEq)]
5925#[non_exhaustive]
5926pub struct ListSingleTenantHsmInstanceProposalsResponse {
5927 /// The list of
5928 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5929 ///
5930 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5931 pub single_tenant_hsm_instance_proposals:
5932 std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
5933
5934 /// A token to retrieve next page of results. Pass this value in
5935 /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
5936 /// to retrieve the next page of results.
5937 ///
5938 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
5939 pub next_page_token: std::string::String,
5940
5941 /// The total number of
5942 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5943 /// that matched the query.
5944 ///
5945 /// This field is not populated if
5946 /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
5947 /// is applied.
5948 ///
5949 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
5950 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5951 pub total_size: i32,
5952
5953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5954}
5955
5956impl ListSingleTenantHsmInstanceProposalsResponse {
5957 pub fn new() -> Self {
5958 std::default::Default::default()
5959 }
5960
5961 /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
5962 ///
5963 /// # Example
5964 /// ```ignore,no_run
5965 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
5966 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5967 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
5968 /// .set_single_tenant_hsm_instance_proposals([
5969 /// SingleTenantHsmInstanceProposal::default()/* use setters */,
5970 /// SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
5971 /// ]);
5972 /// ```
5973 pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
5974 where
5975 T: std::iter::IntoIterator<Item = V>,
5976 V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5977 {
5978 use std::iter::Iterator;
5979 self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
5980 self
5981 }
5982
5983 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
5984 ///
5985 /// # Example
5986 /// ```ignore,no_run
5987 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
5988 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
5989 /// ```
5990 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5991 self.next_page_token = v.into();
5992 self
5993 }
5994
5995 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
5996 ///
5997 /// # Example
5998 /// ```ignore,no_run
5999 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6000 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6001 /// ```
6002 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6003 self.total_size = v.into();
6004 self
6005 }
6006}
6007
6008impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6009 fn typename() -> &'static str {
6010 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6011 }
6012}
6013
6014#[doc(hidden)]
6015impl google_cloud_gax::paginator::internal::PageableResponse
6016 for ListSingleTenantHsmInstanceProposalsResponse
6017{
6018 type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6019
6020 fn items(self) -> std::vec::Vec<Self::PageItem> {
6021 self.single_tenant_hsm_instance_proposals
6022 }
6023
6024 fn next_page_token(&self) -> std::string::String {
6025 use std::clone::Clone;
6026 self.next_page_token.clone()
6027 }
6028}
6029
6030/// Request message for
6031/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6032///
6033/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6034#[derive(Clone, Default, PartialEq)]
6035#[non_exhaustive]
6036pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6037 /// Required. The
6038 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6039 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6040 /// to delete.
6041 ///
6042 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6043 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6044 pub name: std::string::String,
6045
6046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6047}
6048
6049impl DeleteSingleTenantHsmInstanceProposalRequest {
6050 pub fn new() -> Self {
6051 std::default::Default::default()
6052 }
6053
6054 /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6055 ///
6056 /// # Example
6057 /// ```ignore,no_run
6058 /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6059 /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
6060 /// ```
6061 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6062 self.name = v.into();
6063 self
6064 }
6065}
6066
6067impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6068 fn typename() -> &'static str {
6069 "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6070 }
6071}
6072
6073/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6074/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6075///
6076/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6077/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6078#[derive(Clone, Default, PartialEq)]
6079#[non_exhaustive]
6080pub struct KeyRing {
6081 /// Output only. The resource name for the
6082 /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6083 /// `projects/*/locations/*/keyRings/*`.
6084 ///
6085 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6086 pub name: std::string::String,
6087
6088 /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6089 /// was created.
6090 ///
6091 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6092 pub create_time: std::option::Option<wkt::Timestamp>,
6093
6094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6095}
6096
6097impl KeyRing {
6098 pub fn new() -> Self {
6099 std::default::Default::default()
6100 }
6101
6102 /// Sets the value of [name][crate::model::KeyRing::name].
6103 ///
6104 /// # Example
6105 /// ```ignore,no_run
6106 /// # use google_cloud_kms_v1::model::KeyRing;
6107 /// let x = KeyRing::new().set_name("example");
6108 /// ```
6109 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6110 self.name = v.into();
6111 self
6112 }
6113
6114 /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6115 ///
6116 /// # Example
6117 /// ```ignore,no_run
6118 /// # use google_cloud_kms_v1::model::KeyRing;
6119 /// use wkt::Timestamp;
6120 /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6121 /// ```
6122 pub fn set_create_time<T>(mut self, v: T) -> Self
6123 where
6124 T: std::convert::Into<wkt::Timestamp>,
6125 {
6126 self.create_time = std::option::Option::Some(v.into());
6127 self
6128 }
6129
6130 /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6131 ///
6132 /// # Example
6133 /// ```ignore,no_run
6134 /// # use google_cloud_kms_v1::model::KeyRing;
6135 /// use wkt::Timestamp;
6136 /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6137 /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6138 /// ```
6139 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6140 where
6141 T: std::convert::Into<wkt::Timestamp>,
6142 {
6143 self.create_time = v.map(|x| x.into());
6144 self
6145 }
6146}
6147
6148impl wkt::message::Message for KeyRing {
6149 fn typename() -> &'static str {
6150 "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6151 }
6152}
6153
6154/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6155/// can be used for cryptographic operations.
6156///
6157/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6158/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6159/// key material used in cryptographic operations.
6160///
6161/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6162/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6163#[derive(Clone, Default, PartialEq)]
6164#[non_exhaustive]
6165pub struct CryptoKey {
6166 /// Output only. The resource name for this
6167 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6168 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6169 ///
6170 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6171 pub name: std::string::String,
6172
6173 /// Output only. A copy of the "primary"
6174 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6175 /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6176 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6177 /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6178 ///
6179 /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6180 /// updated via
6181 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6182 ///
6183 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6184 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6185 /// may have a primary. For other keys, this field will be omitted.
6186 ///
6187 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6188 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6189 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6190 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6191 /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6192 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6193 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6194 pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6195
6196 /// Immutable. The immutable purpose of this
6197 /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6198 ///
6199 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6200 pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6201
6202 /// Output only. The time at which this
6203 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6204 ///
6205 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6206 pub create_time: std::option::Option<wkt::Timestamp>,
6207
6208 /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6209 /// the Key Management Service will automatically:
6210 ///
6211 /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6212 /// 1. Mark the new version as primary.
6213 ///
6214 /// Key rotations performed manually via
6215 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6216 /// and
6217 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6218 /// do not affect
6219 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6220 ///
6221 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6222 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6223 /// support automatic rotation. For other keys, this field must be omitted.
6224 ///
6225 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6226 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6227 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6228 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6229 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6230 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6231 pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6232
6233 /// A template describing settings for new
6234 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6235 /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6236 /// instances created by either
6237 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6238 /// or auto-rotation are controlled by this template.
6239 ///
6240 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6241 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6242 pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6243
6244 /// Labels with user-defined metadata. For more information, see
6245 /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6246 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6247
6248 /// Immutable. Whether this key may contain imported versions only.
6249 pub import_only: bool,
6250
6251 /// Immutable. The period of time that versions of this key spend in the
6252 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6253 /// state before transitioning to
6254 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6255 /// If not specified at creation time, the default duration is 30 days.
6256 ///
6257 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6258 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6259 pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6260
6261 /// Immutable. The resource name of the backend environment where the key
6262 /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6263 /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6264 /// where all related cryptographic operations are performed. Only applicable
6265 /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6266 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6267 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6268 /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6269 /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6270 /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6271 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6272 /// with the resource name in the format
6273 /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6274 /// Note, this list is non-exhaustive and may apply to additional
6275 /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6276 ///
6277 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6278 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6279 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6280 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6281 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6282 pub crypto_key_backend: std::string::String,
6283
6284 /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6285 /// If this field is present and this key is enrolled in Key Access
6286 /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6287 /// decrypt, and sign operations, and the operation will fail if rejected by
6288 /// the policy. The policy is defined by specifying zero or more allowed
6289 /// justification codes.
6290 /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6291 /// By default, this field is absent, and all justification codes are allowed.
6292 pub key_access_justifications_policy:
6293 std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6294
6295 /// Controls the rate of automatic rotation.
6296 pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6297
6298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6299}
6300
6301impl CryptoKey {
6302 pub fn new() -> Self {
6303 std::default::Default::default()
6304 }
6305
6306 /// Sets the value of [name][crate::model::CryptoKey::name].
6307 ///
6308 /// # Example
6309 /// ```ignore,no_run
6310 /// # use google_cloud_kms_v1::model::CryptoKey;
6311 /// let x = CryptoKey::new().set_name("example");
6312 /// ```
6313 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6314 self.name = v.into();
6315 self
6316 }
6317
6318 /// Sets the value of [primary][crate::model::CryptoKey::primary].
6319 ///
6320 /// # Example
6321 /// ```ignore,no_run
6322 /// # use google_cloud_kms_v1::model::CryptoKey;
6323 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6324 /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6325 /// ```
6326 pub fn set_primary<T>(mut self, v: T) -> Self
6327 where
6328 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6329 {
6330 self.primary = std::option::Option::Some(v.into());
6331 self
6332 }
6333
6334 /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6335 ///
6336 /// # Example
6337 /// ```ignore,no_run
6338 /// # use google_cloud_kms_v1::model::CryptoKey;
6339 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6340 /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6341 /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6342 /// ```
6343 pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6344 where
6345 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6346 {
6347 self.primary = v.map(|x| x.into());
6348 self
6349 }
6350
6351 /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6352 ///
6353 /// # Example
6354 /// ```ignore,no_run
6355 /// # use google_cloud_kms_v1::model::CryptoKey;
6356 /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6357 /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6358 /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6359 /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6360 /// ```
6361 pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6362 mut self,
6363 v: T,
6364 ) -> Self {
6365 self.purpose = v.into();
6366 self
6367 }
6368
6369 /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6370 ///
6371 /// # Example
6372 /// ```ignore,no_run
6373 /// # use google_cloud_kms_v1::model::CryptoKey;
6374 /// use wkt::Timestamp;
6375 /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6376 /// ```
6377 pub fn set_create_time<T>(mut self, v: T) -> Self
6378 where
6379 T: std::convert::Into<wkt::Timestamp>,
6380 {
6381 self.create_time = std::option::Option::Some(v.into());
6382 self
6383 }
6384
6385 /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6386 ///
6387 /// # Example
6388 /// ```ignore,no_run
6389 /// # use google_cloud_kms_v1::model::CryptoKey;
6390 /// use wkt::Timestamp;
6391 /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6392 /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6393 /// ```
6394 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6395 where
6396 T: std::convert::Into<wkt::Timestamp>,
6397 {
6398 self.create_time = v.map(|x| x.into());
6399 self
6400 }
6401
6402 /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6403 ///
6404 /// # Example
6405 /// ```ignore,no_run
6406 /// # use google_cloud_kms_v1::model::CryptoKey;
6407 /// use wkt::Timestamp;
6408 /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6409 /// ```
6410 pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6411 where
6412 T: std::convert::Into<wkt::Timestamp>,
6413 {
6414 self.next_rotation_time = std::option::Option::Some(v.into());
6415 self
6416 }
6417
6418 /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6419 ///
6420 /// # Example
6421 /// ```ignore,no_run
6422 /// # use google_cloud_kms_v1::model::CryptoKey;
6423 /// use wkt::Timestamp;
6424 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6425 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6426 /// ```
6427 pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6428 where
6429 T: std::convert::Into<wkt::Timestamp>,
6430 {
6431 self.next_rotation_time = v.map(|x| x.into());
6432 self
6433 }
6434
6435 /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6436 ///
6437 /// # Example
6438 /// ```ignore,no_run
6439 /// # use google_cloud_kms_v1::model::CryptoKey;
6440 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6441 /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6442 /// ```
6443 pub fn set_version_template<T>(mut self, v: T) -> Self
6444 where
6445 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6446 {
6447 self.version_template = std::option::Option::Some(v.into());
6448 self
6449 }
6450
6451 /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6452 ///
6453 /// # Example
6454 /// ```ignore,no_run
6455 /// # use google_cloud_kms_v1::model::CryptoKey;
6456 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6457 /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6458 /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6459 /// ```
6460 pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6461 where
6462 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6463 {
6464 self.version_template = v.map(|x| x.into());
6465 self
6466 }
6467
6468 /// Sets the value of [labels][crate::model::CryptoKey::labels].
6469 ///
6470 /// # Example
6471 /// ```ignore,no_run
6472 /// # use google_cloud_kms_v1::model::CryptoKey;
6473 /// let x = CryptoKey::new().set_labels([
6474 /// ("key0", "abc"),
6475 /// ("key1", "xyz"),
6476 /// ]);
6477 /// ```
6478 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6479 where
6480 T: std::iter::IntoIterator<Item = (K, V)>,
6481 K: std::convert::Into<std::string::String>,
6482 V: std::convert::Into<std::string::String>,
6483 {
6484 use std::iter::Iterator;
6485 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6486 self
6487 }
6488
6489 /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6490 ///
6491 /// # Example
6492 /// ```ignore,no_run
6493 /// # use google_cloud_kms_v1::model::CryptoKey;
6494 /// let x = CryptoKey::new().set_import_only(true);
6495 /// ```
6496 pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6497 self.import_only = v.into();
6498 self
6499 }
6500
6501 /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6502 ///
6503 /// # Example
6504 /// ```ignore,no_run
6505 /// # use google_cloud_kms_v1::model::CryptoKey;
6506 /// use wkt::Duration;
6507 /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6508 /// ```
6509 pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6510 where
6511 T: std::convert::Into<wkt::Duration>,
6512 {
6513 self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6514 self
6515 }
6516
6517 /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6518 ///
6519 /// # Example
6520 /// ```ignore,no_run
6521 /// # use google_cloud_kms_v1::model::CryptoKey;
6522 /// use wkt::Duration;
6523 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6524 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6525 /// ```
6526 pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
6527 where
6528 T: std::convert::Into<wkt::Duration>,
6529 {
6530 self.destroy_scheduled_duration = v.map(|x| x.into());
6531 self
6532 }
6533
6534 /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
6535 ///
6536 /// # Example
6537 /// ```ignore,no_run
6538 /// # use google_cloud_kms_v1::model::CryptoKey;
6539 /// let x = CryptoKey::new().set_crypto_key_backend("example");
6540 /// ```
6541 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
6542 mut self,
6543 v: T,
6544 ) -> Self {
6545 self.crypto_key_backend = v.into();
6546 self
6547 }
6548
6549 /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6550 ///
6551 /// # Example
6552 /// ```ignore,no_run
6553 /// # use google_cloud_kms_v1::model::CryptoKey;
6554 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6555 /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
6556 /// ```
6557 pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
6558 where
6559 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6560 {
6561 self.key_access_justifications_policy = std::option::Option::Some(v.into());
6562 self
6563 }
6564
6565 /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6566 ///
6567 /// # Example
6568 /// ```ignore,no_run
6569 /// # use google_cloud_kms_v1::model::CryptoKey;
6570 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6571 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
6572 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
6573 /// ```
6574 pub fn set_or_clear_key_access_justifications_policy<T>(
6575 mut self,
6576 v: std::option::Option<T>,
6577 ) -> Self
6578 where
6579 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6580 {
6581 self.key_access_justifications_policy = v.map(|x| x.into());
6582 self
6583 }
6584
6585 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
6586 ///
6587 /// Note that all the setters affecting `rotation_schedule` are mutually
6588 /// exclusive.
6589 ///
6590 /// # Example
6591 /// ```ignore,no_run
6592 /// # use google_cloud_kms_v1::model::CryptoKey;
6593 /// use wkt::Duration;
6594 /// let x = CryptoKey::new().set_rotation_schedule(Some(
6595 /// google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
6596 /// ```
6597 pub fn set_rotation_schedule<
6598 T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
6599 >(
6600 mut self,
6601 v: T,
6602 ) -> Self {
6603 self.rotation_schedule = v.into();
6604 self
6605 }
6606
6607 /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6608 /// if it holds a `RotationPeriod`, `None` if the field is not set or
6609 /// holds a different branch.
6610 pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6611 #[allow(unreachable_patterns)]
6612 self.rotation_schedule.as_ref().and_then(|v| match v {
6613 crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
6614 std::option::Option::Some(v)
6615 }
6616 _ => std::option::Option::None,
6617 })
6618 }
6619
6620 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6621 /// to hold a `RotationPeriod`.
6622 ///
6623 /// Note that all the setters affecting `rotation_schedule` are
6624 /// mutually exclusive.
6625 ///
6626 /// # Example
6627 /// ```ignore,no_run
6628 /// # use google_cloud_kms_v1::model::CryptoKey;
6629 /// use wkt::Duration;
6630 /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
6631 /// assert!(x.rotation_period().is_some());
6632 /// ```
6633 pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
6634 mut self,
6635 v: T,
6636 ) -> Self {
6637 self.rotation_schedule = std::option::Option::Some(
6638 crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
6639 );
6640 self
6641 }
6642}
6643
6644impl wkt::message::Message for CryptoKey {
6645 fn typename() -> &'static str {
6646 "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
6647 }
6648}
6649
6650/// Defines additional types related to [CryptoKey].
6651pub mod crypto_key {
6652 #[allow(unused_imports)]
6653 use super::*;
6654
6655 /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
6656 /// describes the cryptographic capabilities of a
6657 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
6658 /// for the operations allowed by its purpose. For more information, see [Key
6659 /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
6660 ///
6661 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6662 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
6663 ///
6664 /// # Working with unknown values
6665 ///
6666 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6667 /// additional enum variants at any time. Adding new variants is not considered
6668 /// a breaking change. Applications should write their code in anticipation of:
6669 ///
6670 /// - New values appearing in future releases of the client library, **and**
6671 /// - New values received dynamically, without application changes.
6672 ///
6673 /// Please consult the [Working with enums] section in the user guide for some
6674 /// guidelines.
6675 ///
6676 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6677 #[derive(Clone, Debug, PartialEq)]
6678 #[non_exhaustive]
6679 pub enum CryptoKeyPurpose {
6680 /// Not specified.
6681 Unspecified,
6682 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6683 /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
6684 /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
6685 ///
6686 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6687 /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
6688 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6689 EncryptDecrypt,
6690 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6691 /// with
6692 /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
6693 /// and
6694 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6695 ///
6696 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6697 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
6698 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6699 AsymmetricSign,
6700 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6701 /// with
6702 /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
6703 /// and
6704 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6705 ///
6706 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6707 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
6708 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6709 AsymmetricDecrypt,
6710 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6711 /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
6712 /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
6713 /// This purpose is meant to be used for interoperable symmetric
6714 /// encryption and does not support automatic CryptoKey rotation.
6715 ///
6716 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6717 /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
6718 /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
6719 RawEncryptDecrypt,
6720 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6721 /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
6722 ///
6723 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6724 /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
6725 Mac,
6726 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6727 /// with
6728 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
6729 /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
6730 ///
6731 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6732 /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
6733 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6734 KeyEncapsulation,
6735 /// If set, the enum was initialized with an unknown value.
6736 ///
6737 /// Applications can examine the value using [CryptoKeyPurpose::value] or
6738 /// [CryptoKeyPurpose::name].
6739 UnknownValue(crypto_key_purpose::UnknownValue),
6740 }
6741
6742 #[doc(hidden)]
6743 pub mod crypto_key_purpose {
6744 #[allow(unused_imports)]
6745 use super::*;
6746 #[derive(Clone, Debug, PartialEq)]
6747 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6748 }
6749
6750 impl CryptoKeyPurpose {
6751 /// Gets the enum value.
6752 ///
6753 /// Returns `None` if the enum contains an unknown value deserialized from
6754 /// the string representation of enums.
6755 pub fn value(&self) -> std::option::Option<i32> {
6756 match self {
6757 Self::Unspecified => std::option::Option::Some(0),
6758 Self::EncryptDecrypt => std::option::Option::Some(1),
6759 Self::AsymmetricSign => std::option::Option::Some(5),
6760 Self::AsymmetricDecrypt => std::option::Option::Some(6),
6761 Self::RawEncryptDecrypt => std::option::Option::Some(7),
6762 Self::Mac => std::option::Option::Some(9),
6763 Self::KeyEncapsulation => std::option::Option::Some(10),
6764 Self::UnknownValue(u) => u.0.value(),
6765 }
6766 }
6767
6768 /// Gets the enum value as a string.
6769 ///
6770 /// Returns `None` if the enum contains an unknown value deserialized from
6771 /// the integer representation of enums.
6772 pub fn name(&self) -> std::option::Option<&str> {
6773 match self {
6774 Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
6775 Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
6776 Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
6777 Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
6778 Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
6779 Self::Mac => std::option::Option::Some("MAC"),
6780 Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
6781 Self::UnknownValue(u) => u.0.name(),
6782 }
6783 }
6784 }
6785
6786 impl std::default::Default for CryptoKeyPurpose {
6787 fn default() -> Self {
6788 use std::convert::From;
6789 Self::from(0)
6790 }
6791 }
6792
6793 impl std::fmt::Display for CryptoKeyPurpose {
6794 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6795 wkt::internal::display_enum(f, self.name(), self.value())
6796 }
6797 }
6798
6799 impl std::convert::From<i32> for CryptoKeyPurpose {
6800 fn from(value: i32) -> Self {
6801 match value {
6802 0 => Self::Unspecified,
6803 1 => Self::EncryptDecrypt,
6804 5 => Self::AsymmetricSign,
6805 6 => Self::AsymmetricDecrypt,
6806 7 => Self::RawEncryptDecrypt,
6807 9 => Self::Mac,
6808 10 => Self::KeyEncapsulation,
6809 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
6810 wkt::internal::UnknownEnumValue::Integer(value),
6811 )),
6812 }
6813 }
6814 }
6815
6816 impl std::convert::From<&str> for CryptoKeyPurpose {
6817 fn from(value: &str) -> Self {
6818 use std::string::ToString;
6819 match value {
6820 "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
6821 "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
6822 "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
6823 "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
6824 "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
6825 "MAC" => Self::Mac,
6826 "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
6827 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
6828 wkt::internal::UnknownEnumValue::String(value.to_string()),
6829 )),
6830 }
6831 }
6832 }
6833
6834 impl serde::ser::Serialize for CryptoKeyPurpose {
6835 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6836 where
6837 S: serde::Serializer,
6838 {
6839 match self {
6840 Self::Unspecified => serializer.serialize_i32(0),
6841 Self::EncryptDecrypt => serializer.serialize_i32(1),
6842 Self::AsymmetricSign => serializer.serialize_i32(5),
6843 Self::AsymmetricDecrypt => serializer.serialize_i32(6),
6844 Self::RawEncryptDecrypt => serializer.serialize_i32(7),
6845 Self::Mac => serializer.serialize_i32(9),
6846 Self::KeyEncapsulation => serializer.serialize_i32(10),
6847 Self::UnknownValue(u) => u.0.serialize(serializer),
6848 }
6849 }
6850 }
6851
6852 impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
6853 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6854 where
6855 D: serde::Deserializer<'de>,
6856 {
6857 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
6858 ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
6859 ))
6860 }
6861 }
6862
6863 /// Controls the rate of automatic rotation.
6864 #[derive(Clone, Debug, PartialEq)]
6865 #[non_exhaustive]
6866 pub enum RotationSchedule {
6867 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
6868 /// will be advanced by this period when the service automatically rotates a
6869 /// key. Must be at least 24 hours and at most 876,000 hours.
6870 ///
6871 /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
6872 /// set,
6873 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
6874 /// must also be set.
6875 ///
6876 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6877 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6878 /// support automatic rotation. For other keys, this field must be omitted.
6879 ///
6880 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6881 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6882 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6883 /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
6884 RotationPeriod(std::boxed::Box<wkt::Duration>),
6885 }
6886}
6887
6888/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
6889/// specifies the properties to use when creating a new
6890/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
6891/// with
6892/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6893/// or automatically as a result of auto-rotation.
6894///
6895/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6896/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
6897/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6898#[derive(Clone, Default, PartialEq)]
6899#[non_exhaustive]
6900pub struct CryptoKeyVersionTemplate {
6901 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
6902 /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
6903 /// template. Immutable. Defaults to
6904 /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
6905 ///
6906 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6907 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6908 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
6909 pub protection_level: crate::model::ProtectionLevel,
6910
6911 /// Required.
6912 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
6913 /// to use when creating a
6914 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
6915 /// template.
6916 ///
6917 /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
6918 /// this field is omitted and
6919 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
6920 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
6921 ///
6922 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6923 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6924 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6925 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
6926 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
6927
6928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6929}
6930
6931impl CryptoKeyVersionTemplate {
6932 pub fn new() -> Self {
6933 std::default::Default::default()
6934 }
6935
6936 /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
6937 ///
6938 /// # Example
6939 /// ```ignore,no_run
6940 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6941 /// use google_cloud_kms_v1::model::ProtectionLevel;
6942 /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
6943 /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
6944 /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
6945 /// ```
6946 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
6947 mut self,
6948 v: T,
6949 ) -> Self {
6950 self.protection_level = v.into();
6951 self
6952 }
6953
6954 /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
6955 ///
6956 /// # Example
6957 /// ```ignore,no_run
6958 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6959 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
6960 /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
6961 /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
6962 /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
6963 /// ```
6964 pub fn set_algorithm<
6965 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
6966 >(
6967 mut self,
6968 v: T,
6969 ) -> Self {
6970 self.algorithm = v.into();
6971 self
6972 }
6973}
6974
6975impl wkt::message::Message for CryptoKeyVersionTemplate {
6976 fn typename() -> &'static str {
6977 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
6978 }
6979}
6980
6981/// Contains an HSM-generated attestation about a key operation. For more
6982/// information, see [Verifying attestations]
6983/// (<https://cloud.google.com/kms/docs/attest-key>).
6984#[derive(Clone, Default, PartialEq)]
6985#[non_exhaustive]
6986pub struct KeyOperationAttestation {
6987 /// Output only. The format of the attestation data.
6988 pub format: crate::model::key_operation_attestation::AttestationFormat,
6989
6990 /// Output only. The attestation data provided by the HSM when the key
6991 /// operation was performed.
6992 pub content: ::bytes::Bytes,
6993
6994 /// Output only. The certificate chains needed to validate the attestation
6995 pub cert_chains:
6996 std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
6997
6998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6999}
7000
7001impl KeyOperationAttestation {
7002 pub fn new() -> Self {
7003 std::default::Default::default()
7004 }
7005
7006 /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7007 ///
7008 /// # Example
7009 /// ```ignore,no_run
7010 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7011 /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7012 /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7013 /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7014 /// ```
7015 pub fn set_format<
7016 T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7017 >(
7018 mut self,
7019 v: T,
7020 ) -> Self {
7021 self.format = v.into();
7022 self
7023 }
7024
7025 /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7026 ///
7027 /// # Example
7028 /// ```ignore,no_run
7029 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7030 /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7031 /// ```
7032 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7033 self.content = v.into();
7034 self
7035 }
7036
7037 /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7038 ///
7039 /// # Example
7040 /// ```ignore,no_run
7041 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7042 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7043 /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7044 /// ```
7045 pub fn set_cert_chains<T>(mut self, v: T) -> Self
7046 where
7047 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7048 {
7049 self.cert_chains = std::option::Option::Some(v.into());
7050 self
7051 }
7052
7053 /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7054 ///
7055 /// # Example
7056 /// ```ignore,no_run
7057 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7058 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7059 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7060 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7061 /// ```
7062 pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7063 where
7064 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7065 {
7066 self.cert_chains = v.map(|x| x.into());
7067 self
7068 }
7069}
7070
7071impl wkt::message::Message for KeyOperationAttestation {
7072 fn typename() -> &'static str {
7073 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7074 }
7075}
7076
7077/// Defines additional types related to [KeyOperationAttestation].
7078pub mod key_operation_attestation {
7079 #[allow(unused_imports)]
7080 use super::*;
7081
7082 /// Certificate chains needed to verify the attestation.
7083 /// Certificates in chains are PEM-encoded and are ordered based on
7084 /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7085 #[derive(Clone, Default, PartialEq)]
7086 #[non_exhaustive]
7087 pub struct CertificateChains {
7088 /// Cavium certificate chain corresponding to the attestation.
7089 pub cavium_certs: std::vec::Vec<std::string::String>,
7090
7091 /// Google card certificate chain corresponding to the attestation.
7092 pub google_card_certs: std::vec::Vec<std::string::String>,
7093
7094 /// Google partition certificate chain corresponding to the attestation.
7095 pub google_partition_certs: std::vec::Vec<std::string::String>,
7096
7097 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7098 }
7099
7100 impl CertificateChains {
7101 pub fn new() -> Self {
7102 std::default::Default::default()
7103 }
7104
7105 /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7106 ///
7107 /// # Example
7108 /// ```ignore,no_run
7109 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7110 /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7111 /// ```
7112 pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7113 where
7114 T: std::iter::IntoIterator<Item = V>,
7115 V: std::convert::Into<std::string::String>,
7116 {
7117 use std::iter::Iterator;
7118 self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7119 self
7120 }
7121
7122 /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7123 ///
7124 /// # Example
7125 /// ```ignore,no_run
7126 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7127 /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7128 /// ```
7129 pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7130 where
7131 T: std::iter::IntoIterator<Item = V>,
7132 V: std::convert::Into<std::string::String>,
7133 {
7134 use std::iter::Iterator;
7135 self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7136 self
7137 }
7138
7139 /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7140 ///
7141 /// # Example
7142 /// ```ignore,no_run
7143 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7144 /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7145 /// ```
7146 pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7147 where
7148 T: std::iter::IntoIterator<Item = V>,
7149 V: std::convert::Into<std::string::String>,
7150 {
7151 use std::iter::Iterator;
7152 self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7153 self
7154 }
7155 }
7156
7157 impl wkt::message::Message for CertificateChains {
7158 fn typename() -> &'static str {
7159 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7160 }
7161 }
7162
7163 /// Attestation formats provided by the HSM.
7164 ///
7165 /// # Working with unknown values
7166 ///
7167 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7168 /// additional enum variants at any time. Adding new variants is not considered
7169 /// a breaking change. Applications should write their code in anticipation of:
7170 ///
7171 /// - New values appearing in future releases of the client library, **and**
7172 /// - New values received dynamically, without application changes.
7173 ///
7174 /// Please consult the [Working with enums] section in the user guide for some
7175 /// guidelines.
7176 ///
7177 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7178 #[derive(Clone, Debug, PartialEq)]
7179 #[non_exhaustive]
7180 pub enum AttestationFormat {
7181 /// Not specified.
7182 Unspecified,
7183 /// Cavium HSM attestation compressed with gzip. Note that this format is
7184 /// defined by Cavium and subject to change at any time.
7185 ///
7186 /// See
7187 /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7188 CaviumV1Compressed,
7189 /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7190 /// introduced in Cavium's version 3.2-08.
7191 CaviumV2Compressed,
7192 /// If set, the enum was initialized with an unknown value.
7193 ///
7194 /// Applications can examine the value using [AttestationFormat::value] or
7195 /// [AttestationFormat::name].
7196 UnknownValue(attestation_format::UnknownValue),
7197 }
7198
7199 #[doc(hidden)]
7200 pub mod attestation_format {
7201 #[allow(unused_imports)]
7202 use super::*;
7203 #[derive(Clone, Debug, PartialEq)]
7204 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7205 }
7206
7207 impl AttestationFormat {
7208 /// Gets the enum value.
7209 ///
7210 /// Returns `None` if the enum contains an unknown value deserialized from
7211 /// the string representation of enums.
7212 pub fn value(&self) -> std::option::Option<i32> {
7213 match self {
7214 Self::Unspecified => std::option::Option::Some(0),
7215 Self::CaviumV1Compressed => std::option::Option::Some(3),
7216 Self::CaviumV2Compressed => std::option::Option::Some(4),
7217 Self::UnknownValue(u) => u.0.value(),
7218 }
7219 }
7220
7221 /// Gets the enum value as a string.
7222 ///
7223 /// Returns `None` if the enum contains an unknown value deserialized from
7224 /// the integer representation of enums.
7225 pub fn name(&self) -> std::option::Option<&str> {
7226 match self {
7227 Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7228 Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7229 Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7230 Self::UnknownValue(u) => u.0.name(),
7231 }
7232 }
7233 }
7234
7235 impl std::default::Default for AttestationFormat {
7236 fn default() -> Self {
7237 use std::convert::From;
7238 Self::from(0)
7239 }
7240 }
7241
7242 impl std::fmt::Display for AttestationFormat {
7243 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7244 wkt::internal::display_enum(f, self.name(), self.value())
7245 }
7246 }
7247
7248 impl std::convert::From<i32> for AttestationFormat {
7249 fn from(value: i32) -> Self {
7250 match value {
7251 0 => Self::Unspecified,
7252 3 => Self::CaviumV1Compressed,
7253 4 => Self::CaviumV2Compressed,
7254 _ => Self::UnknownValue(attestation_format::UnknownValue(
7255 wkt::internal::UnknownEnumValue::Integer(value),
7256 )),
7257 }
7258 }
7259 }
7260
7261 impl std::convert::From<&str> for AttestationFormat {
7262 fn from(value: &str) -> Self {
7263 use std::string::ToString;
7264 match value {
7265 "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7266 "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7267 "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7268 _ => Self::UnknownValue(attestation_format::UnknownValue(
7269 wkt::internal::UnknownEnumValue::String(value.to_string()),
7270 )),
7271 }
7272 }
7273 }
7274
7275 impl serde::ser::Serialize for AttestationFormat {
7276 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7277 where
7278 S: serde::Serializer,
7279 {
7280 match self {
7281 Self::Unspecified => serializer.serialize_i32(0),
7282 Self::CaviumV1Compressed => serializer.serialize_i32(3),
7283 Self::CaviumV2Compressed => serializer.serialize_i32(4),
7284 Self::UnknownValue(u) => u.0.serialize(serializer),
7285 }
7286 }
7287 }
7288
7289 impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7290 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7291 where
7292 D: serde::Deserializer<'de>,
7293 {
7294 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7295 ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7296 ))
7297 }
7298 }
7299}
7300
7301/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7302/// individual cryptographic key, and the associated key material.
7303///
7304/// An
7305/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7306/// version can be used for cryptographic operations.
7307///
7308/// For security reasons, the raw cryptographic key material represented by a
7309/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7310/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7311/// authorized user or application invokes Cloud KMS.
7312///
7313/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7314/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7315#[derive(Clone, Default, PartialEq)]
7316#[non_exhaustive]
7317pub struct CryptoKeyVersion {
7318 /// Output only. The resource name for this
7319 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7320 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7321 ///
7322 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7323 pub name: std::string::String,
7324
7325 /// The current state of the
7326 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7327 ///
7328 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7329 pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7330
7331 /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7332 /// describing how crypto operations are performed with this
7333 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7334 ///
7335 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7336 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7337 pub protection_level: crate::model::ProtectionLevel,
7338
7339 /// Output only. The
7340 /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7341 /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7342 /// supports.
7343 ///
7344 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7345 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7346 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7347
7348 /// Output only. Statement that was generated and signed by the HSM at key
7349 /// creation time. Use this statement to verify attributes of the key as stored
7350 /// on the HSM, independently of Google. Only provided for key versions with
7351 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7352 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7353 ///
7354 /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7355 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7356 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7357
7358 /// Output only. The time at which this
7359 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7360 ///
7361 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7362 pub create_time: std::option::Option<wkt::Timestamp>,
7363
7364 /// Output only. The time this
7365 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7366 /// generated.
7367 ///
7368 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7369 pub generate_time: std::option::Option<wkt::Timestamp>,
7370
7371 /// Output only. The time this
7372 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7373 /// scheduled for destruction. Only present if
7374 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7375 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7376 ///
7377 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7378 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7379 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7380 pub destroy_time: std::option::Option<wkt::Timestamp>,
7381
7382 /// Output only. The time this CryptoKeyVersion's key material was
7383 /// destroyed. Only present if
7384 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7385 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7386 ///
7387 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7388 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7389 pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7390
7391 /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7392 /// used in the most recent import of this
7393 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7394 /// the underlying key material was imported.
7395 ///
7396 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7397 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7398 pub import_job: std::string::String,
7399
7400 /// Output only. The time at which this
7401 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7402 /// most recently imported.
7403 ///
7404 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7405 pub import_time: std::option::Option<wkt::Timestamp>,
7406
7407 /// Output only. The root cause of the most recent import failure. Only present
7408 /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7409 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7410 ///
7411 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7412 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7413 pub import_failure_reason: std::string::String,
7414
7415 /// Output only. The root cause of the most recent generation failure. Only
7416 /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7417 /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7418 ///
7419 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7420 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7421 pub generation_failure_reason: std::string::String,
7422
7423 /// Output only. The root cause of the most recent external destruction
7424 /// failure. Only present if
7425 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7426 /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7427 ///
7428 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7429 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7430 pub external_destruction_failure_reason: std::string::String,
7431
7432 /// ExternalProtectionLevelOptions stores a group of additional fields for
7433 /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7434 /// are specific to the
7435 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7436 /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7437 /// protection levels.
7438 ///
7439 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7440 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7441 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7442 pub external_protection_level_options:
7443 std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7444
7445 /// Output only. Whether or not this key version is eligible for reimport, by
7446 /// being specified as a target in
7447 /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7448 ///
7449 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7450 pub reimport_eligible: bool,
7451
7452 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7453}
7454
7455impl CryptoKeyVersion {
7456 pub fn new() -> Self {
7457 std::default::Default::default()
7458 }
7459
7460 /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7461 ///
7462 /// # Example
7463 /// ```ignore,no_run
7464 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7465 /// let x = CryptoKeyVersion::new().set_name("example");
7466 /// ```
7467 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7468 self.name = v.into();
7469 self
7470 }
7471
7472 /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7473 ///
7474 /// # Example
7475 /// ```ignore,no_run
7476 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7477 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7478 /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7479 /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7480 /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7481 /// ```
7482 pub fn set_state<
7483 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
7484 >(
7485 mut self,
7486 v: T,
7487 ) -> Self {
7488 self.state = v.into();
7489 self
7490 }
7491
7492 /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
7493 ///
7494 /// # Example
7495 /// ```ignore,no_run
7496 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7497 /// use google_cloud_kms_v1::model::ProtectionLevel;
7498 /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
7499 /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
7500 /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
7501 /// ```
7502 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7503 mut self,
7504 v: T,
7505 ) -> Self {
7506 self.protection_level = v.into();
7507 self
7508 }
7509
7510 /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
7511 ///
7512 /// # Example
7513 /// ```ignore,no_run
7514 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7515 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7516 /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7517 /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7518 /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7519 /// ```
7520 pub fn set_algorithm<
7521 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7522 >(
7523 mut self,
7524 v: T,
7525 ) -> Self {
7526 self.algorithm = v.into();
7527 self
7528 }
7529
7530 /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7531 ///
7532 /// # Example
7533 /// ```ignore,no_run
7534 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7535 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7536 /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
7537 /// ```
7538 pub fn set_attestation<T>(mut self, v: T) -> Self
7539 where
7540 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7541 {
7542 self.attestation = std::option::Option::Some(v.into());
7543 self
7544 }
7545
7546 /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7547 ///
7548 /// # Example
7549 /// ```ignore,no_run
7550 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7551 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7552 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
7553 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
7554 /// ```
7555 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
7556 where
7557 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7558 {
7559 self.attestation = v.map(|x| x.into());
7560 self
7561 }
7562
7563 /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7564 ///
7565 /// # Example
7566 /// ```ignore,no_run
7567 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7568 /// use wkt::Timestamp;
7569 /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
7570 /// ```
7571 pub fn set_create_time<T>(mut self, v: T) -> Self
7572 where
7573 T: std::convert::Into<wkt::Timestamp>,
7574 {
7575 self.create_time = std::option::Option::Some(v.into());
7576 self
7577 }
7578
7579 /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7580 ///
7581 /// # Example
7582 /// ```ignore,no_run
7583 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7584 /// use wkt::Timestamp;
7585 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7586 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
7587 /// ```
7588 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7589 where
7590 T: std::convert::Into<wkt::Timestamp>,
7591 {
7592 self.create_time = v.map(|x| x.into());
7593 self
7594 }
7595
7596 /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7597 ///
7598 /// # Example
7599 /// ```ignore,no_run
7600 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7601 /// use wkt::Timestamp;
7602 /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
7603 /// ```
7604 pub fn set_generate_time<T>(mut self, v: T) -> Self
7605 where
7606 T: std::convert::Into<wkt::Timestamp>,
7607 {
7608 self.generate_time = std::option::Option::Some(v.into());
7609 self
7610 }
7611
7612 /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7613 ///
7614 /// # Example
7615 /// ```ignore,no_run
7616 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7617 /// use wkt::Timestamp;
7618 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
7619 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
7620 /// ```
7621 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
7622 where
7623 T: std::convert::Into<wkt::Timestamp>,
7624 {
7625 self.generate_time = v.map(|x| x.into());
7626 self
7627 }
7628
7629 /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7630 ///
7631 /// # Example
7632 /// ```ignore,no_run
7633 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7634 /// use wkt::Timestamp;
7635 /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
7636 /// ```
7637 pub fn set_destroy_time<T>(mut self, v: T) -> Self
7638 where
7639 T: std::convert::Into<wkt::Timestamp>,
7640 {
7641 self.destroy_time = std::option::Option::Some(v.into());
7642 self
7643 }
7644
7645 /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7646 ///
7647 /// # Example
7648 /// ```ignore,no_run
7649 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7650 /// use wkt::Timestamp;
7651 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
7652 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
7653 /// ```
7654 pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
7655 where
7656 T: std::convert::Into<wkt::Timestamp>,
7657 {
7658 self.destroy_time = v.map(|x| x.into());
7659 self
7660 }
7661
7662 /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7663 ///
7664 /// # Example
7665 /// ```ignore,no_run
7666 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7667 /// use wkt::Timestamp;
7668 /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
7669 /// ```
7670 pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
7671 where
7672 T: std::convert::Into<wkt::Timestamp>,
7673 {
7674 self.destroy_event_time = std::option::Option::Some(v.into());
7675 self
7676 }
7677
7678 /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7679 ///
7680 /// # Example
7681 /// ```ignore,no_run
7682 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7683 /// use wkt::Timestamp;
7684 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
7685 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
7686 /// ```
7687 pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
7688 where
7689 T: std::convert::Into<wkt::Timestamp>,
7690 {
7691 self.destroy_event_time = v.map(|x| x.into());
7692 self
7693 }
7694
7695 /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
7696 ///
7697 /// # Example
7698 /// ```ignore,no_run
7699 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7700 /// let x = CryptoKeyVersion::new().set_import_job("example");
7701 /// ```
7702 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7703 self.import_job = v.into();
7704 self
7705 }
7706
7707 /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7708 ///
7709 /// # Example
7710 /// ```ignore,no_run
7711 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7712 /// use wkt::Timestamp;
7713 /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
7714 /// ```
7715 pub fn set_import_time<T>(mut self, v: T) -> Self
7716 where
7717 T: std::convert::Into<wkt::Timestamp>,
7718 {
7719 self.import_time = std::option::Option::Some(v.into());
7720 self
7721 }
7722
7723 /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7724 ///
7725 /// # Example
7726 /// ```ignore,no_run
7727 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7728 /// use wkt::Timestamp;
7729 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
7730 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
7731 /// ```
7732 pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
7733 where
7734 T: std::convert::Into<wkt::Timestamp>,
7735 {
7736 self.import_time = v.map(|x| x.into());
7737 self
7738 }
7739
7740 /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
7741 ///
7742 /// # Example
7743 /// ```ignore,no_run
7744 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7745 /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
7746 /// ```
7747 pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
7748 mut self,
7749 v: T,
7750 ) -> Self {
7751 self.import_failure_reason = v.into();
7752 self
7753 }
7754
7755 /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
7756 ///
7757 /// # Example
7758 /// ```ignore,no_run
7759 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7760 /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
7761 /// ```
7762 pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
7763 mut self,
7764 v: T,
7765 ) -> Self {
7766 self.generation_failure_reason = v.into();
7767 self
7768 }
7769
7770 /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
7771 ///
7772 /// # Example
7773 /// ```ignore,no_run
7774 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7775 /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
7776 /// ```
7777 pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
7778 mut self,
7779 v: T,
7780 ) -> Self {
7781 self.external_destruction_failure_reason = v.into();
7782 self
7783 }
7784
7785 /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
7786 ///
7787 /// # Example
7788 /// ```ignore,no_run
7789 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7790 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
7791 /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
7792 /// ```
7793 pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
7794 where
7795 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
7796 {
7797 self.external_protection_level_options = std::option::Option::Some(v.into());
7798 self
7799 }
7800
7801 /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
7802 ///
7803 /// # Example
7804 /// ```ignore,no_run
7805 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7806 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
7807 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
7808 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
7809 /// ```
7810 pub fn set_or_clear_external_protection_level_options<T>(
7811 mut self,
7812 v: std::option::Option<T>,
7813 ) -> Self
7814 where
7815 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
7816 {
7817 self.external_protection_level_options = v.map(|x| x.into());
7818 self
7819 }
7820
7821 /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
7822 ///
7823 /// # Example
7824 /// ```ignore,no_run
7825 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7826 /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
7827 /// ```
7828 pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7829 self.reimport_eligible = v.into();
7830 self
7831 }
7832}
7833
7834impl wkt::message::Message for CryptoKeyVersion {
7835 fn typename() -> &'static str {
7836 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
7837 }
7838}
7839
7840/// Defines additional types related to [CryptoKeyVersion].
7841pub mod crypto_key_version {
7842 #[allow(unused_imports)]
7843 use super::*;
7844
7845 /// The algorithm of the
7846 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
7847 /// parameters must be used for each cryptographic operation.
7848 ///
7849 /// The
7850 /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
7851 /// algorithm is usable with
7852 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7853 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7854 ///
7855 /// Algorithms beginning with `RSA_SIGN_` are usable with
7856 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7857 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
7858 ///
7859 /// The fields in the name after `RSA_SIGN_` correspond to the following
7860 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
7861 ///
7862 /// For PSS, the salt length used is equal to the length of digest
7863 /// algorithm. For example,
7864 /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
7865 /// will use PSS with a salt length of 256 bits or 32 bytes.
7866 ///
7867 /// Algorithms beginning with `RSA_DECRYPT_` are usable with
7868 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7869 /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
7870 ///
7871 /// The fields in the name after `RSA_DECRYPT_` correspond to the following
7872 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
7873 ///
7874 /// Algorithms beginning with `EC_SIGN_` are usable with
7875 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7876 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
7877 ///
7878 /// The fields in the name after `EC_SIGN_` correspond to the following
7879 /// parameters: elliptic curve, digest algorithm.
7880 ///
7881 /// Algorithms beginning with `HMAC_` are usable with
7882 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
7883 /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
7884 ///
7885 /// The suffix following `HMAC_` corresponds to the hash algorithm being used
7886 /// (eg. SHA256).
7887 ///
7888 /// Algorithms beginning with `PQ_` are post-quantum.
7889 ///
7890 /// For more information, see [Key purposes and algorithms]
7891 /// (<https://cloud.google.com/kms/docs/algorithms>).
7892 ///
7893 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
7894 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
7895 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7896 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
7897 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7898 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7899 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
7900 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
7901 ///
7902 /// # Working with unknown values
7903 ///
7904 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7905 /// additional enum variants at any time. Adding new variants is not considered
7906 /// a breaking change. Applications should write their code in anticipation of:
7907 ///
7908 /// - New values appearing in future releases of the client library, **and**
7909 /// - New values received dynamically, without application changes.
7910 ///
7911 /// Please consult the [Working with enums] section in the user guide for some
7912 /// guidelines.
7913 ///
7914 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7915 #[derive(Clone, Debug, PartialEq)]
7916 #[non_exhaustive]
7917 pub enum CryptoKeyVersionAlgorithm {
7918 /// Not specified.
7919 Unspecified,
7920 /// Creates symmetric encryption keys.
7921 GoogleSymmetricEncryption,
7922 /// AES-GCM (Galois Counter Mode) using 128-bit keys.
7923 Aes128Gcm,
7924 /// AES-GCM (Galois Counter Mode) using 256-bit keys.
7925 Aes256Gcm,
7926 /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
7927 Aes128Cbc,
7928 /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
7929 Aes256Cbc,
7930 /// AES-CTR (Counter Mode) using 128-bit keys.
7931 Aes128Ctr,
7932 /// AES-CTR (Counter Mode) using 256-bit keys.
7933 Aes256Ctr,
7934 /// RSASSA-PSS 2048 bit key with a SHA256 digest.
7935 RsaSignPss2048Sha256,
7936 /// RSASSA-PSS 3072 bit key with a SHA256 digest.
7937 RsaSignPss3072Sha256,
7938 /// RSASSA-PSS 4096 bit key with a SHA256 digest.
7939 RsaSignPss4096Sha256,
7940 /// RSASSA-PSS 4096 bit key with a SHA512 digest.
7941 RsaSignPss4096Sha512,
7942 /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
7943 RsaSignPkcs12048Sha256,
7944 /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
7945 RsaSignPkcs13072Sha256,
7946 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
7947 RsaSignPkcs14096Sha256,
7948 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
7949 RsaSignPkcs14096Sha512,
7950 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
7951 RsaSignRawPkcs12048,
7952 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
7953 RsaSignRawPkcs13072,
7954 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
7955 RsaSignRawPkcs14096,
7956 /// RSAES-OAEP 2048 bit key with a SHA256 digest.
7957 RsaDecryptOaep2048Sha256,
7958 /// RSAES-OAEP 3072 bit key with a SHA256 digest.
7959 RsaDecryptOaep3072Sha256,
7960 /// RSAES-OAEP 4096 bit key with a SHA256 digest.
7961 RsaDecryptOaep4096Sha256,
7962 /// RSAES-OAEP 4096 bit key with a SHA512 digest.
7963 RsaDecryptOaep4096Sha512,
7964 /// RSAES-OAEP 2048 bit key with a SHA1 digest.
7965 RsaDecryptOaep2048Sha1,
7966 /// RSAES-OAEP 3072 bit key with a SHA1 digest.
7967 RsaDecryptOaep3072Sha1,
7968 /// RSAES-OAEP 4096 bit key with a SHA1 digest.
7969 RsaDecryptOaep4096Sha1,
7970 /// ECDSA on the NIST P-256 curve with a SHA256 digest.
7971 /// Other hash functions can also be used:
7972 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
7973 EcSignP256Sha256,
7974 /// ECDSA on the NIST P-384 curve with a SHA384 digest.
7975 /// Other hash functions can also be used:
7976 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
7977 EcSignP384Sha384,
7978 /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
7979 /// HSM protection level.
7980 /// Other hash functions can also be used:
7981 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
7982 EcSignSecp256K1Sha256,
7983 /// EdDSA on the Curve25519 in pure mode (taking data as input).
7984 EcSignEd25519,
7985 /// HMAC-SHA256 signing with a 256 bit key.
7986 HmacSha256,
7987 /// HMAC-SHA1 signing with a 160 bit key.
7988 HmacSha1,
7989 /// HMAC-SHA384 signing with a 384 bit key.
7990 HmacSha384,
7991 /// HMAC-SHA512 signing with a 512 bit key.
7992 HmacSha512,
7993 /// HMAC-SHA224 signing with a 224 bit key.
7994 HmacSha224,
7995 /// Algorithm representing symmetric encryption by an external key manager.
7996 ExternalSymmetricEncryption,
7997 /// ML-KEM-768 (FIPS 203)
7998 MlKem768,
7999 /// ML-KEM-1024 (FIPS 203)
8000 MlKem1024,
8001 /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
8002 /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8003 KemXwing,
8004 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8005 /// security level 3. Randomized version.
8006 PqSignMlDsa65,
8007 /// The post-quantum stateless hash-based digital signature algorithm, at
8008 /// security level 1. Randomized version.
8009 PqSignSlhDsaSha2128S,
8010 /// If set, the enum was initialized with an unknown value.
8011 ///
8012 /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8013 /// [CryptoKeyVersionAlgorithm::name].
8014 UnknownValue(crypto_key_version_algorithm::UnknownValue),
8015 }
8016
8017 #[doc(hidden)]
8018 pub mod crypto_key_version_algorithm {
8019 #[allow(unused_imports)]
8020 use super::*;
8021 #[derive(Clone, Debug, PartialEq)]
8022 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8023 }
8024
8025 impl CryptoKeyVersionAlgorithm {
8026 /// Gets the enum value.
8027 ///
8028 /// Returns `None` if the enum contains an unknown value deserialized from
8029 /// the string representation of enums.
8030 pub fn value(&self) -> std::option::Option<i32> {
8031 match self {
8032 Self::Unspecified => std::option::Option::Some(0),
8033 Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8034 Self::Aes128Gcm => std::option::Option::Some(41),
8035 Self::Aes256Gcm => std::option::Option::Some(19),
8036 Self::Aes128Cbc => std::option::Option::Some(42),
8037 Self::Aes256Cbc => std::option::Option::Some(43),
8038 Self::Aes128Ctr => std::option::Option::Some(44),
8039 Self::Aes256Ctr => std::option::Option::Some(45),
8040 Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8041 Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8042 Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8043 Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8044 Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8045 Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8046 Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8047 Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8048 Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8049 Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8050 Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8051 Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8052 Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8053 Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8054 Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8055 Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8056 Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8057 Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8058 Self::EcSignP256Sha256 => std::option::Option::Some(12),
8059 Self::EcSignP384Sha384 => std::option::Option::Some(13),
8060 Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8061 Self::EcSignEd25519 => std::option::Option::Some(40),
8062 Self::HmacSha256 => std::option::Option::Some(32),
8063 Self::HmacSha1 => std::option::Option::Some(33),
8064 Self::HmacSha384 => std::option::Option::Some(34),
8065 Self::HmacSha512 => std::option::Option::Some(35),
8066 Self::HmacSha224 => std::option::Option::Some(36),
8067 Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8068 Self::MlKem768 => std::option::Option::Some(47),
8069 Self::MlKem1024 => std::option::Option::Some(48),
8070 Self::KemXwing => std::option::Option::Some(63),
8071 Self::PqSignMlDsa65 => std::option::Option::Some(56),
8072 Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8073 Self::UnknownValue(u) => u.0.value(),
8074 }
8075 }
8076
8077 /// Gets the enum value as a string.
8078 ///
8079 /// Returns `None` if the enum contains an unknown value deserialized from
8080 /// the integer representation of enums.
8081 pub fn name(&self) -> std::option::Option<&str> {
8082 match self {
8083 Self::Unspecified => {
8084 std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8085 }
8086 Self::GoogleSymmetricEncryption => {
8087 std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8088 }
8089 Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8090 Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8091 Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8092 Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8093 Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8094 Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8095 Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8096 Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8097 Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8098 Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8099 Self::RsaSignPkcs12048Sha256 => {
8100 std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8101 }
8102 Self::RsaSignPkcs13072Sha256 => {
8103 std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8104 }
8105 Self::RsaSignPkcs14096Sha256 => {
8106 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8107 }
8108 Self::RsaSignPkcs14096Sha512 => {
8109 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8110 }
8111 Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8112 Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8113 Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8114 Self::RsaDecryptOaep2048Sha256 => {
8115 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8116 }
8117 Self::RsaDecryptOaep3072Sha256 => {
8118 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8119 }
8120 Self::RsaDecryptOaep4096Sha256 => {
8121 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8122 }
8123 Self::RsaDecryptOaep4096Sha512 => {
8124 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8125 }
8126 Self::RsaDecryptOaep2048Sha1 => {
8127 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8128 }
8129 Self::RsaDecryptOaep3072Sha1 => {
8130 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8131 }
8132 Self::RsaDecryptOaep4096Sha1 => {
8133 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8134 }
8135 Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8136 Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8137 Self::EcSignSecp256K1Sha256 => {
8138 std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8139 }
8140 Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8141 Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8142 Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8143 Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8144 Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8145 Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8146 Self::ExternalSymmetricEncryption => {
8147 std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8148 }
8149 Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8150 Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8151 Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8152 Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8153 Self::PqSignSlhDsaSha2128S => {
8154 std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8155 }
8156 Self::UnknownValue(u) => u.0.name(),
8157 }
8158 }
8159 }
8160
8161 impl std::default::Default for CryptoKeyVersionAlgorithm {
8162 fn default() -> Self {
8163 use std::convert::From;
8164 Self::from(0)
8165 }
8166 }
8167
8168 impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8169 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8170 wkt::internal::display_enum(f, self.name(), self.value())
8171 }
8172 }
8173
8174 impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8175 fn from(value: i32) -> Self {
8176 match value {
8177 0 => Self::Unspecified,
8178 1 => Self::GoogleSymmetricEncryption,
8179 2 => Self::RsaSignPss2048Sha256,
8180 3 => Self::RsaSignPss3072Sha256,
8181 4 => Self::RsaSignPss4096Sha256,
8182 5 => Self::RsaSignPkcs12048Sha256,
8183 6 => Self::RsaSignPkcs13072Sha256,
8184 7 => Self::RsaSignPkcs14096Sha256,
8185 8 => Self::RsaDecryptOaep2048Sha256,
8186 9 => Self::RsaDecryptOaep3072Sha256,
8187 10 => Self::RsaDecryptOaep4096Sha256,
8188 12 => Self::EcSignP256Sha256,
8189 13 => Self::EcSignP384Sha384,
8190 15 => Self::RsaSignPss4096Sha512,
8191 16 => Self::RsaSignPkcs14096Sha512,
8192 17 => Self::RsaDecryptOaep4096Sha512,
8193 18 => Self::ExternalSymmetricEncryption,
8194 19 => Self::Aes256Gcm,
8195 28 => Self::RsaSignRawPkcs12048,
8196 29 => Self::RsaSignRawPkcs13072,
8197 30 => Self::RsaSignRawPkcs14096,
8198 31 => Self::EcSignSecp256K1Sha256,
8199 32 => Self::HmacSha256,
8200 33 => Self::HmacSha1,
8201 34 => Self::HmacSha384,
8202 35 => Self::HmacSha512,
8203 36 => Self::HmacSha224,
8204 37 => Self::RsaDecryptOaep2048Sha1,
8205 38 => Self::RsaDecryptOaep3072Sha1,
8206 39 => Self::RsaDecryptOaep4096Sha1,
8207 40 => Self::EcSignEd25519,
8208 41 => Self::Aes128Gcm,
8209 42 => Self::Aes128Cbc,
8210 43 => Self::Aes256Cbc,
8211 44 => Self::Aes128Ctr,
8212 45 => Self::Aes256Ctr,
8213 47 => Self::MlKem768,
8214 48 => Self::MlKem1024,
8215 56 => Self::PqSignMlDsa65,
8216 57 => Self::PqSignSlhDsaSha2128S,
8217 63 => Self::KemXwing,
8218 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8219 wkt::internal::UnknownEnumValue::Integer(value),
8220 )),
8221 }
8222 }
8223 }
8224
8225 impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8226 fn from(value: &str) -> Self {
8227 use std::string::ToString;
8228 match value {
8229 "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8230 "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8231 "AES_128_GCM" => Self::Aes128Gcm,
8232 "AES_256_GCM" => Self::Aes256Gcm,
8233 "AES_128_CBC" => Self::Aes128Cbc,
8234 "AES_256_CBC" => Self::Aes256Cbc,
8235 "AES_128_CTR" => Self::Aes128Ctr,
8236 "AES_256_CTR" => Self::Aes256Ctr,
8237 "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8238 "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8239 "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8240 "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8241 "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8242 "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8243 "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8244 "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8245 "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8246 "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8247 "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8248 "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8249 "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8250 "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8251 "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8252 "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8253 "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8254 "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8255 "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8256 "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8257 "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8258 "EC_SIGN_ED25519" => Self::EcSignEd25519,
8259 "HMAC_SHA256" => Self::HmacSha256,
8260 "HMAC_SHA1" => Self::HmacSha1,
8261 "HMAC_SHA384" => Self::HmacSha384,
8262 "HMAC_SHA512" => Self::HmacSha512,
8263 "HMAC_SHA224" => Self::HmacSha224,
8264 "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8265 "ML_KEM_768" => Self::MlKem768,
8266 "ML_KEM_1024" => Self::MlKem1024,
8267 "KEM_XWING" => Self::KemXwing,
8268 "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8269 "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8270 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8271 wkt::internal::UnknownEnumValue::String(value.to_string()),
8272 )),
8273 }
8274 }
8275 }
8276
8277 impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8278 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8279 where
8280 S: serde::Serializer,
8281 {
8282 match self {
8283 Self::Unspecified => serializer.serialize_i32(0),
8284 Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8285 Self::Aes128Gcm => serializer.serialize_i32(41),
8286 Self::Aes256Gcm => serializer.serialize_i32(19),
8287 Self::Aes128Cbc => serializer.serialize_i32(42),
8288 Self::Aes256Cbc => serializer.serialize_i32(43),
8289 Self::Aes128Ctr => serializer.serialize_i32(44),
8290 Self::Aes256Ctr => serializer.serialize_i32(45),
8291 Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8292 Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8293 Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8294 Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8295 Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8296 Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8297 Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8298 Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8299 Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8300 Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8301 Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8302 Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8303 Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8304 Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8305 Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8306 Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8307 Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8308 Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8309 Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8310 Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8311 Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8312 Self::EcSignEd25519 => serializer.serialize_i32(40),
8313 Self::HmacSha256 => serializer.serialize_i32(32),
8314 Self::HmacSha1 => serializer.serialize_i32(33),
8315 Self::HmacSha384 => serializer.serialize_i32(34),
8316 Self::HmacSha512 => serializer.serialize_i32(35),
8317 Self::HmacSha224 => serializer.serialize_i32(36),
8318 Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8319 Self::MlKem768 => serializer.serialize_i32(47),
8320 Self::MlKem1024 => serializer.serialize_i32(48),
8321 Self::KemXwing => serializer.serialize_i32(63),
8322 Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8323 Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8324 Self::UnknownValue(u) => u.0.serialize(serializer),
8325 }
8326 }
8327 }
8328
8329 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8330 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8331 where
8332 D: serde::Deserializer<'de>,
8333 {
8334 deserializer.deserialize_any(
8335 wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8336 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8337 ),
8338 )
8339 }
8340 }
8341
8342 /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8343 /// indicating if it can be used.
8344 ///
8345 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8346 ///
8347 /// # Working with unknown values
8348 ///
8349 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8350 /// additional enum variants at any time. Adding new variants is not considered
8351 /// a breaking change. Applications should write their code in anticipation of:
8352 ///
8353 /// - New values appearing in future releases of the client library, **and**
8354 /// - New values received dynamically, without application changes.
8355 ///
8356 /// Please consult the [Working with enums] section in the user guide for some
8357 /// guidelines.
8358 ///
8359 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8360 #[derive(Clone, Debug, PartialEq)]
8361 #[non_exhaustive]
8362 pub enum CryptoKeyVersionState {
8363 /// Not specified.
8364 Unspecified,
8365 /// This version is still being generated. It may not be used, enabled,
8366 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8367 /// version
8368 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8369 /// as soon as the version is ready.
8370 ///
8371 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8372 PendingGeneration,
8373 /// This version may be used for cryptographic operations.
8374 Enabled,
8375 /// This version may not be used, but the key material is still available,
8376 /// and the version can be placed back into the
8377 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8378 /// state.
8379 ///
8380 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8381 Disabled,
8382 /// The key material of this version is destroyed and no longer stored.
8383 /// This version may only become
8384 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8385 /// again if this version is
8386 /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8387 /// and the original key material is reimported with a call to
8388 /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8389 ///
8390 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8391 /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
8392 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8393 Destroyed,
8394 /// This version is scheduled for destruction, and will be destroyed soon.
8395 /// Call
8396 /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
8397 /// to put it back into the
8398 /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
8399 /// state.
8400 ///
8401 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
8402 /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8403 DestroyScheduled,
8404 /// This version is still being imported. It may not be used, enabled,
8405 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8406 /// version
8407 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8408 /// as soon as the version is ready.
8409 ///
8410 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8411 PendingImport,
8412 /// This version was not imported successfully. It may not be used, enabled,
8413 /// disabled, or destroyed. The submitted key material has been discarded.
8414 /// Additional details can be found in
8415 /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
8416 ///
8417 /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
8418 ImportFailed,
8419 /// This version was not generated successfully. It may not be used, enabled,
8420 /// disabled, or destroyed. Additional details can be found in
8421 /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
8422 ///
8423 /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
8424 GenerationFailed,
8425 /// This version was destroyed, and it may not be used or enabled again.
8426 /// Cloud KMS is waiting for the corresponding key material residing in an
8427 /// external key manager to be destroyed.
8428 PendingExternalDestruction,
8429 /// This version was destroyed, and it may not be used or enabled again.
8430 /// However, Cloud KMS could not confirm that the corresponding key material
8431 /// residing in an external key manager was destroyed. Additional details can
8432 /// be found in
8433 /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
8434 ///
8435 /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
8436 ExternalDestructionFailed,
8437 /// If set, the enum was initialized with an unknown value.
8438 ///
8439 /// Applications can examine the value using [CryptoKeyVersionState::value] or
8440 /// [CryptoKeyVersionState::name].
8441 UnknownValue(crypto_key_version_state::UnknownValue),
8442 }
8443
8444 #[doc(hidden)]
8445 pub mod crypto_key_version_state {
8446 #[allow(unused_imports)]
8447 use super::*;
8448 #[derive(Clone, Debug, PartialEq)]
8449 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8450 }
8451
8452 impl CryptoKeyVersionState {
8453 /// Gets the enum value.
8454 ///
8455 /// Returns `None` if the enum contains an unknown value deserialized from
8456 /// the string representation of enums.
8457 pub fn value(&self) -> std::option::Option<i32> {
8458 match self {
8459 Self::Unspecified => std::option::Option::Some(0),
8460 Self::PendingGeneration => std::option::Option::Some(5),
8461 Self::Enabled => std::option::Option::Some(1),
8462 Self::Disabled => std::option::Option::Some(2),
8463 Self::Destroyed => std::option::Option::Some(3),
8464 Self::DestroyScheduled => std::option::Option::Some(4),
8465 Self::PendingImport => std::option::Option::Some(6),
8466 Self::ImportFailed => std::option::Option::Some(7),
8467 Self::GenerationFailed => std::option::Option::Some(8),
8468 Self::PendingExternalDestruction => std::option::Option::Some(9),
8469 Self::ExternalDestructionFailed => std::option::Option::Some(10),
8470 Self::UnknownValue(u) => u.0.value(),
8471 }
8472 }
8473
8474 /// Gets the enum value as a string.
8475 ///
8476 /// Returns `None` if the enum contains an unknown value deserialized from
8477 /// the integer representation of enums.
8478 pub fn name(&self) -> std::option::Option<&str> {
8479 match self {
8480 Self::Unspecified => {
8481 std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
8482 }
8483 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
8484 Self::Enabled => std::option::Option::Some("ENABLED"),
8485 Self::Disabled => std::option::Option::Some("DISABLED"),
8486 Self::Destroyed => std::option::Option::Some("DESTROYED"),
8487 Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
8488 Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
8489 Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
8490 Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
8491 Self::PendingExternalDestruction => {
8492 std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
8493 }
8494 Self::ExternalDestructionFailed => {
8495 std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
8496 }
8497 Self::UnknownValue(u) => u.0.name(),
8498 }
8499 }
8500 }
8501
8502 impl std::default::Default for CryptoKeyVersionState {
8503 fn default() -> Self {
8504 use std::convert::From;
8505 Self::from(0)
8506 }
8507 }
8508
8509 impl std::fmt::Display for CryptoKeyVersionState {
8510 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8511 wkt::internal::display_enum(f, self.name(), self.value())
8512 }
8513 }
8514
8515 impl std::convert::From<i32> for CryptoKeyVersionState {
8516 fn from(value: i32) -> Self {
8517 match value {
8518 0 => Self::Unspecified,
8519 1 => Self::Enabled,
8520 2 => Self::Disabled,
8521 3 => Self::Destroyed,
8522 4 => Self::DestroyScheduled,
8523 5 => Self::PendingGeneration,
8524 6 => Self::PendingImport,
8525 7 => Self::ImportFailed,
8526 8 => Self::GenerationFailed,
8527 9 => Self::PendingExternalDestruction,
8528 10 => Self::ExternalDestructionFailed,
8529 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8530 wkt::internal::UnknownEnumValue::Integer(value),
8531 )),
8532 }
8533 }
8534 }
8535
8536 impl std::convert::From<&str> for CryptoKeyVersionState {
8537 fn from(value: &str) -> Self {
8538 use std::string::ToString;
8539 match value {
8540 "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
8541 "PENDING_GENERATION" => Self::PendingGeneration,
8542 "ENABLED" => Self::Enabled,
8543 "DISABLED" => Self::Disabled,
8544 "DESTROYED" => Self::Destroyed,
8545 "DESTROY_SCHEDULED" => Self::DestroyScheduled,
8546 "PENDING_IMPORT" => Self::PendingImport,
8547 "IMPORT_FAILED" => Self::ImportFailed,
8548 "GENERATION_FAILED" => Self::GenerationFailed,
8549 "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
8550 "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
8551 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8552 wkt::internal::UnknownEnumValue::String(value.to_string()),
8553 )),
8554 }
8555 }
8556 }
8557
8558 impl serde::ser::Serialize for CryptoKeyVersionState {
8559 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8560 where
8561 S: serde::Serializer,
8562 {
8563 match self {
8564 Self::Unspecified => serializer.serialize_i32(0),
8565 Self::PendingGeneration => serializer.serialize_i32(5),
8566 Self::Enabled => serializer.serialize_i32(1),
8567 Self::Disabled => serializer.serialize_i32(2),
8568 Self::Destroyed => serializer.serialize_i32(3),
8569 Self::DestroyScheduled => serializer.serialize_i32(4),
8570 Self::PendingImport => serializer.serialize_i32(6),
8571 Self::ImportFailed => serializer.serialize_i32(7),
8572 Self::GenerationFailed => serializer.serialize_i32(8),
8573 Self::PendingExternalDestruction => serializer.serialize_i32(9),
8574 Self::ExternalDestructionFailed => serializer.serialize_i32(10),
8575 Self::UnknownValue(u) => u.0.serialize(serializer),
8576 }
8577 }
8578 }
8579
8580 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
8581 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8582 where
8583 D: serde::Deserializer<'de>,
8584 {
8585 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
8586 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
8587 ))
8588 }
8589 }
8590
8591 /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
8592 /// Controls the level of detail returned for
8593 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
8594 /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
8595 /// and
8596 /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
8597 ///
8598 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8599 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
8600 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
8601 ///
8602 /// # Working with unknown values
8603 ///
8604 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8605 /// additional enum variants at any time. Adding new variants is not considered
8606 /// a breaking change. Applications should write their code in anticipation of:
8607 ///
8608 /// - New values appearing in future releases of the client library, **and**
8609 /// - New values received dynamically, without application changes.
8610 ///
8611 /// Please consult the [Working with enums] section in the user guide for some
8612 /// guidelines.
8613 ///
8614 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8615 #[derive(Clone, Debug, PartialEq)]
8616 #[non_exhaustive]
8617 pub enum CryptoKeyVersionView {
8618 /// Default view for each
8619 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
8620 /// include the
8621 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
8622 ///
8623 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8624 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8625 Unspecified,
8626 /// Provides all fields in each
8627 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
8628 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
8629 ///
8630 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8631 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8632 Full,
8633 /// If set, the enum was initialized with an unknown value.
8634 ///
8635 /// Applications can examine the value using [CryptoKeyVersionView::value] or
8636 /// [CryptoKeyVersionView::name].
8637 UnknownValue(crypto_key_version_view::UnknownValue),
8638 }
8639
8640 #[doc(hidden)]
8641 pub mod crypto_key_version_view {
8642 #[allow(unused_imports)]
8643 use super::*;
8644 #[derive(Clone, Debug, PartialEq)]
8645 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8646 }
8647
8648 impl CryptoKeyVersionView {
8649 /// Gets the enum value.
8650 ///
8651 /// Returns `None` if the enum contains an unknown value deserialized from
8652 /// the string representation of enums.
8653 pub fn value(&self) -> std::option::Option<i32> {
8654 match self {
8655 Self::Unspecified => std::option::Option::Some(0),
8656 Self::Full => std::option::Option::Some(1),
8657 Self::UnknownValue(u) => u.0.value(),
8658 }
8659 }
8660
8661 /// Gets the enum value as a string.
8662 ///
8663 /// Returns `None` if the enum contains an unknown value deserialized from
8664 /// the integer representation of enums.
8665 pub fn name(&self) -> std::option::Option<&str> {
8666 match self {
8667 Self::Unspecified => {
8668 std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
8669 }
8670 Self::Full => std::option::Option::Some("FULL"),
8671 Self::UnknownValue(u) => u.0.name(),
8672 }
8673 }
8674 }
8675
8676 impl std::default::Default for CryptoKeyVersionView {
8677 fn default() -> Self {
8678 use std::convert::From;
8679 Self::from(0)
8680 }
8681 }
8682
8683 impl std::fmt::Display for CryptoKeyVersionView {
8684 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8685 wkt::internal::display_enum(f, self.name(), self.value())
8686 }
8687 }
8688
8689 impl std::convert::From<i32> for CryptoKeyVersionView {
8690 fn from(value: i32) -> Self {
8691 match value {
8692 0 => Self::Unspecified,
8693 1 => Self::Full,
8694 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8695 wkt::internal::UnknownEnumValue::Integer(value),
8696 )),
8697 }
8698 }
8699 }
8700
8701 impl std::convert::From<&str> for CryptoKeyVersionView {
8702 fn from(value: &str) -> Self {
8703 use std::string::ToString;
8704 match value {
8705 "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
8706 "FULL" => Self::Full,
8707 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8708 wkt::internal::UnknownEnumValue::String(value.to_string()),
8709 )),
8710 }
8711 }
8712 }
8713
8714 impl serde::ser::Serialize for CryptoKeyVersionView {
8715 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8716 where
8717 S: serde::Serializer,
8718 {
8719 match self {
8720 Self::Unspecified => serializer.serialize_i32(0),
8721 Self::Full => serializer.serialize_i32(1),
8722 Self::UnknownValue(u) => u.0.serialize(serializer),
8723 }
8724 }
8725 }
8726
8727 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
8728 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8729 where
8730 D: serde::Deserializer<'de>,
8731 {
8732 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
8733 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
8734 ))
8735 }
8736 }
8737}
8738
8739/// Data with integrity verification field.
8740#[derive(Clone, Default, PartialEq)]
8741#[non_exhaustive]
8742pub struct ChecksummedData {
8743 /// Raw Data.
8744 pub data: ::bytes::Bytes,
8745
8746 /// Integrity verification field. A CRC32C
8747 /// checksum of the returned
8748 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
8749 /// integrity check of
8750 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
8751 /// performed by computing the CRC32C checksum of
8752 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
8753 /// comparing your results to this field. Discard the response in case of
8754 /// non-matching checksum values, and perform a limited number of retries. A
8755 /// persistent mismatch may indicate an issue in your computation of the CRC32C
8756 /// checksum. Note: This field is defined as int64 for reasons of compatibility
8757 /// across different languages. However, it is a non-negative integer, which
8758 /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
8759 /// languages that support this type.
8760 ///
8761 /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
8762 pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
8763
8764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8765}
8766
8767impl ChecksummedData {
8768 pub fn new() -> Self {
8769 std::default::Default::default()
8770 }
8771
8772 /// Sets the value of [data][crate::model::ChecksummedData::data].
8773 ///
8774 /// # Example
8775 /// ```ignore,no_run
8776 /// # use google_cloud_kms_v1::model::ChecksummedData;
8777 /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
8778 /// ```
8779 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8780 self.data = v.into();
8781 self
8782 }
8783
8784 /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
8785 ///
8786 /// # Example
8787 /// ```ignore,no_run
8788 /// # use google_cloud_kms_v1::model::ChecksummedData;
8789 /// use wkt::Int64Value;
8790 /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
8791 /// ```
8792 pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
8793 where
8794 T: std::convert::Into<wkt::Int64Value>,
8795 {
8796 self.crc32c_checksum = std::option::Option::Some(v.into());
8797 self
8798 }
8799
8800 /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
8801 ///
8802 /// # Example
8803 /// ```ignore,no_run
8804 /// # use google_cloud_kms_v1::model::ChecksummedData;
8805 /// use wkt::Int64Value;
8806 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
8807 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
8808 /// ```
8809 pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
8810 where
8811 T: std::convert::Into<wkt::Int64Value>,
8812 {
8813 self.crc32c_checksum = v.map(|x| x.into());
8814 self
8815 }
8816}
8817
8818impl wkt::message::Message for ChecksummedData {
8819 fn typename() -> &'static str {
8820 "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
8821 }
8822}
8823
8824/// The public keys for a given
8825/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
8826/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
8827///
8828/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8829/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
8830#[derive(Clone, Default, PartialEq)]
8831#[non_exhaustive]
8832pub struct PublicKey {
8833 /// The public key, encoded in PEM format. For more information, see the
8834 /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
8835 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
8836 /// [Textual Encoding of Subject Public Key Info]
8837 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
8838 pub pem: std::string::String,
8839
8840 /// The
8841 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
8842 /// associated with this key.
8843 ///
8844 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
8845 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
8846
8847 /// Integrity verification field. A CRC32C checksum of the returned
8848 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
8849 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
8850 /// computing the CRC32C checksum of
8851 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
8852 /// results to this field. Discard the response in case of non-matching
8853 /// checksum values, and perform a limited number of retries. A persistent
8854 /// mismatch may indicate an issue in your computation of the CRC32C checksum.
8855 /// Note: This field is defined as int64 for reasons of compatibility across
8856 /// different languages. However, it is a non-negative integer, which will
8857 /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
8858 /// languages that support this type.
8859 ///
8860 /// NOTE: This field is in Beta.
8861 ///
8862 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
8863 pub pem_crc32c: std::option::Option<wkt::Int64Value>,
8864
8865 /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
8866 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
8867 /// Provided here for verification.
8868 ///
8869 /// NOTE: This field is in Beta.
8870 ///
8871 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8872 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
8873 pub name: std::string::String,
8874
8875 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
8876 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
8877 ///
8878 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8879 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
8880 pub protection_level: crate::model::ProtectionLevel,
8881
8882 /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
8883 /// customer through the
8884 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
8885 /// field.
8886 ///
8887 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
8888 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
8889 pub public_key_format: crate::model::public_key::PublicKeyFormat,
8890
8891 /// This field contains the public key (with integrity verification), formatted
8892 /// according to the
8893 /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
8894 ///
8895 /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
8896 pub public_key: std::option::Option<crate::model::ChecksummedData>,
8897
8898 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8899}
8900
8901impl PublicKey {
8902 pub fn new() -> Self {
8903 std::default::Default::default()
8904 }
8905
8906 /// Sets the value of [pem][crate::model::PublicKey::pem].
8907 ///
8908 /// # Example
8909 /// ```ignore,no_run
8910 /// # use google_cloud_kms_v1::model::PublicKey;
8911 /// let x = PublicKey::new().set_pem("example");
8912 /// ```
8913 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8914 self.pem = v.into();
8915 self
8916 }
8917
8918 /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
8919 ///
8920 /// # Example
8921 /// ```ignore,no_run
8922 /// # use google_cloud_kms_v1::model::PublicKey;
8923 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
8924 /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
8925 /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
8926 /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
8927 /// ```
8928 pub fn set_algorithm<
8929 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
8930 >(
8931 mut self,
8932 v: T,
8933 ) -> Self {
8934 self.algorithm = v.into();
8935 self
8936 }
8937
8938 /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
8939 ///
8940 /// # Example
8941 /// ```ignore,no_run
8942 /// # use google_cloud_kms_v1::model::PublicKey;
8943 /// use wkt::Int64Value;
8944 /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
8945 /// ```
8946 pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
8947 where
8948 T: std::convert::Into<wkt::Int64Value>,
8949 {
8950 self.pem_crc32c = std::option::Option::Some(v.into());
8951 self
8952 }
8953
8954 /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
8955 ///
8956 /// # Example
8957 /// ```ignore,no_run
8958 /// # use google_cloud_kms_v1::model::PublicKey;
8959 /// use wkt::Int64Value;
8960 /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
8961 /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
8962 /// ```
8963 pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
8964 where
8965 T: std::convert::Into<wkt::Int64Value>,
8966 {
8967 self.pem_crc32c = v.map(|x| x.into());
8968 self
8969 }
8970
8971 /// Sets the value of [name][crate::model::PublicKey::name].
8972 ///
8973 /// # Example
8974 /// ```ignore,no_run
8975 /// # use google_cloud_kms_v1::model::PublicKey;
8976 /// let x = PublicKey::new().set_name("example");
8977 /// ```
8978 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8979 self.name = v.into();
8980 self
8981 }
8982
8983 /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
8984 ///
8985 /// # Example
8986 /// ```ignore,no_run
8987 /// # use google_cloud_kms_v1::model::PublicKey;
8988 /// use google_cloud_kms_v1::model::ProtectionLevel;
8989 /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
8990 /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
8991 /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
8992 /// ```
8993 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
8994 mut self,
8995 v: T,
8996 ) -> Self {
8997 self.protection_level = v.into();
8998 self
8999 }
9000
9001 /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
9002 ///
9003 /// # Example
9004 /// ```ignore,no_run
9005 /// # use google_cloud_kms_v1::model::PublicKey;
9006 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9007 /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9008 /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9009 /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9010 /// ```
9011 pub fn set_public_key_format<
9012 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9013 >(
9014 mut self,
9015 v: T,
9016 ) -> Self {
9017 self.public_key_format = v.into();
9018 self
9019 }
9020
9021 /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9022 ///
9023 /// # Example
9024 /// ```ignore,no_run
9025 /// # use google_cloud_kms_v1::model::PublicKey;
9026 /// use google_cloud_kms_v1::model::ChecksummedData;
9027 /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9028 /// ```
9029 pub fn set_public_key<T>(mut self, v: T) -> Self
9030 where
9031 T: std::convert::Into<crate::model::ChecksummedData>,
9032 {
9033 self.public_key = std::option::Option::Some(v.into());
9034 self
9035 }
9036
9037 /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9038 ///
9039 /// # Example
9040 /// ```ignore,no_run
9041 /// # use google_cloud_kms_v1::model::PublicKey;
9042 /// use google_cloud_kms_v1::model::ChecksummedData;
9043 /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9044 /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9045 /// ```
9046 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9047 where
9048 T: std::convert::Into<crate::model::ChecksummedData>,
9049 {
9050 self.public_key = v.map(|x| x.into());
9051 self
9052 }
9053}
9054
9055impl wkt::message::Message for PublicKey {
9056 fn typename() -> &'static str {
9057 "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9058 }
9059}
9060
9061/// Defines additional types related to [PublicKey].
9062pub mod public_key {
9063 #[allow(unused_imports)]
9064 use super::*;
9065
9066 /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9067 ///
9068 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9069 ///
9070 /// # Working with unknown values
9071 ///
9072 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9073 /// additional enum variants at any time. Adding new variants is not considered
9074 /// a breaking change. Applications should write their code in anticipation of:
9075 ///
9076 /// - New values appearing in future releases of the client library, **and**
9077 /// - New values received dynamically, without application changes.
9078 ///
9079 /// Please consult the [Working with enums] section in the user guide for some
9080 /// guidelines.
9081 ///
9082 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9083 #[derive(Clone, Debug, PartialEq)]
9084 #[non_exhaustive]
9085 pub enum PublicKeyFormat {
9086 /// If the
9087 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9088 /// field is not specified:
9089 ///
9090 /// - For PQC algorithms, an error will be returned.
9091 /// - For non-PQC algorithms, the default format is PEM, and the field
9092 /// [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9093 ///
9094 /// Otherwise, the public key will be exported through the
9095 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9096 /// requested format.
9097 ///
9098 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9099 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9100 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9101 Unspecified,
9102 /// The returned public key will be encoded in PEM format.
9103 /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9104 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9105 /// and [Textual Encoding of Subject Public Key Info]
9106 /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9107 Pem,
9108 /// The returned public key will be encoded in DER format (the
9109 /// PrivateKeyInfo structure from RFC 5208).
9110 Der,
9111 /// This is supported only for PQC algorithms.
9112 /// The key material is returned in the format defined by NIST PQC
9113 /// standards (FIPS 203, FIPS 204, and FIPS 205).
9114 NistPqc,
9115 /// The returned public key is in raw bytes format defined in its standard
9116 /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9117 XwingRawBytes,
9118 /// If set, the enum was initialized with an unknown value.
9119 ///
9120 /// Applications can examine the value using [PublicKeyFormat::value] or
9121 /// [PublicKeyFormat::name].
9122 UnknownValue(public_key_format::UnknownValue),
9123 }
9124
9125 #[doc(hidden)]
9126 pub mod public_key_format {
9127 #[allow(unused_imports)]
9128 use super::*;
9129 #[derive(Clone, Debug, PartialEq)]
9130 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9131 }
9132
9133 impl PublicKeyFormat {
9134 /// Gets the enum value.
9135 ///
9136 /// Returns `None` if the enum contains an unknown value deserialized from
9137 /// the string representation of enums.
9138 pub fn value(&self) -> std::option::Option<i32> {
9139 match self {
9140 Self::Unspecified => std::option::Option::Some(0),
9141 Self::Pem => std::option::Option::Some(1),
9142 Self::Der => std::option::Option::Some(2),
9143 Self::NistPqc => std::option::Option::Some(3),
9144 Self::XwingRawBytes => std::option::Option::Some(4),
9145 Self::UnknownValue(u) => u.0.value(),
9146 }
9147 }
9148
9149 /// Gets the enum value as a string.
9150 ///
9151 /// Returns `None` if the enum contains an unknown value deserialized from
9152 /// the integer representation of enums.
9153 pub fn name(&self) -> std::option::Option<&str> {
9154 match self {
9155 Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9156 Self::Pem => std::option::Option::Some("PEM"),
9157 Self::Der => std::option::Option::Some("DER"),
9158 Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9159 Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9160 Self::UnknownValue(u) => u.0.name(),
9161 }
9162 }
9163 }
9164
9165 impl std::default::Default for PublicKeyFormat {
9166 fn default() -> Self {
9167 use std::convert::From;
9168 Self::from(0)
9169 }
9170 }
9171
9172 impl std::fmt::Display for PublicKeyFormat {
9173 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9174 wkt::internal::display_enum(f, self.name(), self.value())
9175 }
9176 }
9177
9178 impl std::convert::From<i32> for PublicKeyFormat {
9179 fn from(value: i32) -> Self {
9180 match value {
9181 0 => Self::Unspecified,
9182 1 => Self::Pem,
9183 2 => Self::Der,
9184 3 => Self::NistPqc,
9185 4 => Self::XwingRawBytes,
9186 _ => Self::UnknownValue(public_key_format::UnknownValue(
9187 wkt::internal::UnknownEnumValue::Integer(value),
9188 )),
9189 }
9190 }
9191 }
9192
9193 impl std::convert::From<&str> for PublicKeyFormat {
9194 fn from(value: &str) -> Self {
9195 use std::string::ToString;
9196 match value {
9197 "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9198 "PEM" => Self::Pem,
9199 "DER" => Self::Der,
9200 "NIST_PQC" => Self::NistPqc,
9201 "XWING_RAW_BYTES" => Self::XwingRawBytes,
9202 _ => Self::UnknownValue(public_key_format::UnknownValue(
9203 wkt::internal::UnknownEnumValue::String(value.to_string()),
9204 )),
9205 }
9206 }
9207 }
9208
9209 impl serde::ser::Serialize for PublicKeyFormat {
9210 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9211 where
9212 S: serde::Serializer,
9213 {
9214 match self {
9215 Self::Unspecified => serializer.serialize_i32(0),
9216 Self::Pem => serializer.serialize_i32(1),
9217 Self::Der => serializer.serialize_i32(2),
9218 Self::NistPqc => serializer.serialize_i32(3),
9219 Self::XwingRawBytes => serializer.serialize_i32(4),
9220 Self::UnknownValue(u) => u.0.serialize(serializer),
9221 }
9222 }
9223 }
9224
9225 impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9226 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9227 where
9228 D: serde::Deserializer<'de>,
9229 {
9230 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9231 ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9232 ))
9233 }
9234 }
9235}
9236
9237/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9238/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9239/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9240/// key material, generated outside of Cloud KMS.
9241///
9242/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9243/// generate a "wrapping key", which is a public/private key pair. You use the
9244/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9245/// protect it during the import process. The nature of the wrapping key depends
9246/// on the choice of
9247/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9248/// wrapping key generation is complete, the
9249/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9250/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9251/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9252/// fetched public key can then be used to wrap your pre-existing key material.
9253///
9254/// Once the key material is wrapped, it can be imported into a new
9255/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9256/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9257/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9258/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9259/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9260/// uses the private key portion of the wrapping key to unwrap the key material.
9261/// Only Cloud KMS has access to the private key.
9262///
9263/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9264/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9265/// any key material that was wrapped with the
9266/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9267///
9268/// For more information, see
9269/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9270///
9271/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9272/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9273/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9274/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9275/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9276/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9277/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9278/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9279#[derive(Clone, Default, PartialEq)]
9280#[non_exhaustive]
9281pub struct ImportJob {
9282 /// Output only. The resource name for this
9283 /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9284 /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9285 ///
9286 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9287 pub name: std::string::String,
9288
9289 /// Required. Immutable. The wrapping method to be used for incoming key
9290 /// material.
9291 pub import_method: crate::model::import_job::ImportMethod,
9292
9293 /// Required. Immutable. The protection level of the
9294 /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9295 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9296 /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9297 /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9298 /// into.
9299 ///
9300 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9301 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9302 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9303 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9304 pub protection_level: crate::model::ProtectionLevel,
9305
9306 /// Output only. The time at which this
9307 /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9308 ///
9309 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9310 pub create_time: std::option::Option<wkt::Timestamp>,
9311
9312 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9313 /// material was generated.
9314 ///
9315 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9316 pub generate_time: std::option::Option<wkt::Timestamp>,
9317
9318 /// Output only. The time at which this
9319 /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9320 /// can no longer be used to import key material.
9321 ///
9322 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9323 pub expire_time: std::option::Option<wkt::Timestamp>,
9324
9325 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9326 /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9327 /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9328 ///
9329 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9330 /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9331 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9332 pub expire_event_time: std::option::Option<wkt::Timestamp>,
9333
9334 /// Output only. The current state of the
9335 /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9336 ///
9337 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9338 pub state: crate::model::import_job::ImportJobState,
9339
9340 /// Output only. The public key with which to wrap key material prior to
9341 /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9342 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9343 ///
9344 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9345 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9346 pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9347
9348 /// Output only. Statement that was generated and signed by the key creator
9349 /// (for example, an HSM) at key creation time. Use this statement to verify
9350 /// attributes of the key as stored on the HSM, independently of Google.
9351 /// Only present if the chosen
9352 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9353 /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9354 ///
9355 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9356 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9357 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9358
9359 /// Immutable. The resource name of the backend environment where the key
9360 /// material for the wrapping key resides and where all related cryptographic
9361 /// operations are performed. Currently, this field is only populated for keys
9362 /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9363 /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9364 /// in the future.
9365 /// Supported resources:
9366 ///
9367 /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9368 ///
9369 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9370 pub crypto_key_backend: std::string::String,
9371
9372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9373}
9374
9375impl ImportJob {
9376 pub fn new() -> Self {
9377 std::default::Default::default()
9378 }
9379
9380 /// Sets the value of [name][crate::model::ImportJob::name].
9381 ///
9382 /// # Example
9383 /// ```ignore,no_run
9384 /// # use google_cloud_kms_v1::model::ImportJob;
9385 /// let x = ImportJob::new().set_name("example");
9386 /// ```
9387 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9388 self.name = v.into();
9389 self
9390 }
9391
9392 /// Sets the value of [import_method][crate::model::ImportJob::import_method].
9393 ///
9394 /// # Example
9395 /// ```ignore,no_run
9396 /// # use google_cloud_kms_v1::model::ImportJob;
9397 /// use google_cloud_kms_v1::model::import_job::ImportMethod;
9398 /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
9399 /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
9400 /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
9401 /// ```
9402 pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
9403 mut self,
9404 v: T,
9405 ) -> Self {
9406 self.import_method = v.into();
9407 self
9408 }
9409
9410 /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
9411 ///
9412 /// # Example
9413 /// ```ignore,no_run
9414 /// # use google_cloud_kms_v1::model::ImportJob;
9415 /// use google_cloud_kms_v1::model::ProtectionLevel;
9416 /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
9417 /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
9418 /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
9419 /// ```
9420 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9421 mut self,
9422 v: T,
9423 ) -> Self {
9424 self.protection_level = v.into();
9425 self
9426 }
9427
9428 /// Sets the value of [create_time][crate::model::ImportJob::create_time].
9429 ///
9430 /// # Example
9431 /// ```ignore,no_run
9432 /// # use google_cloud_kms_v1::model::ImportJob;
9433 /// use wkt::Timestamp;
9434 /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
9435 /// ```
9436 pub fn set_create_time<T>(mut self, v: T) -> Self
9437 where
9438 T: std::convert::Into<wkt::Timestamp>,
9439 {
9440 self.create_time = std::option::Option::Some(v.into());
9441 self
9442 }
9443
9444 /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
9445 ///
9446 /// # Example
9447 /// ```ignore,no_run
9448 /// # use google_cloud_kms_v1::model::ImportJob;
9449 /// use wkt::Timestamp;
9450 /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9451 /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
9452 /// ```
9453 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9454 where
9455 T: std::convert::Into<wkt::Timestamp>,
9456 {
9457 self.create_time = v.map(|x| x.into());
9458 self
9459 }
9460
9461 /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
9462 ///
9463 /// # Example
9464 /// ```ignore,no_run
9465 /// # use google_cloud_kms_v1::model::ImportJob;
9466 /// use wkt::Timestamp;
9467 /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
9468 /// ```
9469 pub fn set_generate_time<T>(mut self, v: T) -> Self
9470 where
9471 T: std::convert::Into<wkt::Timestamp>,
9472 {
9473 self.generate_time = std::option::Option::Some(v.into());
9474 self
9475 }
9476
9477 /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
9478 ///
9479 /// # Example
9480 /// ```ignore,no_run
9481 /// # use google_cloud_kms_v1::model::ImportJob;
9482 /// use wkt::Timestamp;
9483 /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
9484 /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
9485 /// ```
9486 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
9487 where
9488 T: std::convert::Into<wkt::Timestamp>,
9489 {
9490 self.generate_time = v.map(|x| x.into());
9491 self
9492 }
9493
9494 /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
9495 ///
9496 /// # Example
9497 /// ```ignore,no_run
9498 /// # use google_cloud_kms_v1::model::ImportJob;
9499 /// use wkt::Timestamp;
9500 /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
9501 /// ```
9502 pub fn set_expire_time<T>(mut self, v: T) -> Self
9503 where
9504 T: std::convert::Into<wkt::Timestamp>,
9505 {
9506 self.expire_time = std::option::Option::Some(v.into());
9507 self
9508 }
9509
9510 /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
9511 ///
9512 /// # Example
9513 /// ```ignore,no_run
9514 /// # use google_cloud_kms_v1::model::ImportJob;
9515 /// use wkt::Timestamp;
9516 /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9517 /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
9518 /// ```
9519 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9520 where
9521 T: std::convert::Into<wkt::Timestamp>,
9522 {
9523 self.expire_time = v.map(|x| x.into());
9524 self
9525 }
9526
9527 /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9528 ///
9529 /// # Example
9530 /// ```ignore,no_run
9531 /// # use google_cloud_kms_v1::model::ImportJob;
9532 /// use wkt::Timestamp;
9533 /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
9534 /// ```
9535 pub fn set_expire_event_time<T>(mut self, v: T) -> Self
9536 where
9537 T: std::convert::Into<wkt::Timestamp>,
9538 {
9539 self.expire_event_time = std::option::Option::Some(v.into());
9540 self
9541 }
9542
9543 /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9544 ///
9545 /// # Example
9546 /// ```ignore,no_run
9547 /// # use google_cloud_kms_v1::model::ImportJob;
9548 /// use wkt::Timestamp;
9549 /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
9550 /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
9551 /// ```
9552 pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
9553 where
9554 T: std::convert::Into<wkt::Timestamp>,
9555 {
9556 self.expire_event_time = v.map(|x| x.into());
9557 self
9558 }
9559
9560 /// Sets the value of [state][crate::model::ImportJob::state].
9561 ///
9562 /// # Example
9563 /// ```ignore,no_run
9564 /// # use google_cloud_kms_v1::model::ImportJob;
9565 /// use google_cloud_kms_v1::model::import_job::ImportJobState;
9566 /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
9567 /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
9568 /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
9569 /// ```
9570 pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
9571 mut self,
9572 v: T,
9573 ) -> Self {
9574 self.state = v.into();
9575 self
9576 }
9577
9578 /// Sets the value of [public_key][crate::model::ImportJob::public_key].
9579 ///
9580 /// # Example
9581 /// ```ignore,no_run
9582 /// # use google_cloud_kms_v1::model::ImportJob;
9583 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9584 /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
9585 /// ```
9586 pub fn set_public_key<T>(mut self, v: T) -> Self
9587 where
9588 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9589 {
9590 self.public_key = std::option::Option::Some(v.into());
9591 self
9592 }
9593
9594 /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
9595 ///
9596 /// # Example
9597 /// ```ignore,no_run
9598 /// # use google_cloud_kms_v1::model::ImportJob;
9599 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9600 /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
9601 /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
9602 /// ```
9603 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9604 where
9605 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9606 {
9607 self.public_key = v.map(|x| x.into());
9608 self
9609 }
9610
9611 /// Sets the value of [attestation][crate::model::ImportJob::attestation].
9612 ///
9613 /// # Example
9614 /// ```ignore,no_run
9615 /// # use google_cloud_kms_v1::model::ImportJob;
9616 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9617 /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
9618 /// ```
9619 pub fn set_attestation<T>(mut self, v: T) -> Self
9620 where
9621 T: std::convert::Into<crate::model::KeyOperationAttestation>,
9622 {
9623 self.attestation = std::option::Option::Some(v.into());
9624 self
9625 }
9626
9627 /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
9628 ///
9629 /// # Example
9630 /// ```ignore,no_run
9631 /// # use google_cloud_kms_v1::model::ImportJob;
9632 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9633 /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
9634 /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
9635 /// ```
9636 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
9637 where
9638 T: std::convert::Into<crate::model::KeyOperationAttestation>,
9639 {
9640 self.attestation = v.map(|x| x.into());
9641 self
9642 }
9643
9644 /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
9645 ///
9646 /// # Example
9647 /// ```ignore,no_run
9648 /// # use google_cloud_kms_v1::model::ImportJob;
9649 /// let x = ImportJob::new().set_crypto_key_backend("example");
9650 /// ```
9651 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
9652 mut self,
9653 v: T,
9654 ) -> Self {
9655 self.crypto_key_backend = v.into();
9656 self
9657 }
9658}
9659
9660impl wkt::message::Message for ImportJob {
9661 fn typename() -> &'static str {
9662 "type.googleapis.com/google.cloud.kms.v1.ImportJob"
9663 }
9664}
9665
9666/// Defines additional types related to [ImportJob].
9667pub mod import_job {
9668 #[allow(unused_imports)]
9669 use super::*;
9670
9671 /// The public key component of the wrapping key. For details of the type of
9672 /// key this public key corresponds to, see the
9673 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
9674 ///
9675 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9676 #[derive(Clone, Default, PartialEq)]
9677 #[non_exhaustive]
9678 pub struct WrappingPublicKey {
9679 /// The public key, encoded in PEM format. For more information, see the [RFC
9680 /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
9681 /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9682 /// [Textual Encoding of Subject Public Key Info]
9683 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9684 pub pem: std::string::String,
9685
9686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9687 }
9688
9689 impl WrappingPublicKey {
9690 pub fn new() -> Self {
9691 std::default::Default::default()
9692 }
9693
9694 /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
9695 ///
9696 /// # Example
9697 /// ```ignore,no_run
9698 /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9699 /// let x = WrappingPublicKey::new().set_pem("example");
9700 /// ```
9701 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9702 self.pem = v.into();
9703 self
9704 }
9705 }
9706
9707 impl wkt::message::Message for WrappingPublicKey {
9708 fn typename() -> &'static str {
9709 "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
9710 }
9711 }
9712
9713 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
9714 /// key wrapping method chosen for this
9715 /// [ImportJob][google.cloud.kms.v1.ImportJob].
9716 ///
9717 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9718 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9719 ///
9720 /// # Working with unknown values
9721 ///
9722 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9723 /// additional enum variants at any time. Adding new variants is not considered
9724 /// a breaking change. Applications should write their code in anticipation of:
9725 ///
9726 /// - New values appearing in future releases of the client library, **and**
9727 /// - New values received dynamically, without application changes.
9728 ///
9729 /// Please consult the [Working with enums] section in the user guide for some
9730 /// guidelines.
9731 ///
9732 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9733 #[derive(Clone, Debug, PartialEq)]
9734 #[non_exhaustive]
9735 pub enum ImportMethod {
9736 /// Not specified.
9737 Unspecified,
9738 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9739 /// scheme defined in the PKCS #11 standard. In summary, this involves
9740 /// wrapping the raw key with an ephemeral AES key, and wrapping the
9741 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
9742 /// [RSA AES key wrap
9743 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9744 RsaOaep3072Sha1Aes256,
9745 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9746 /// scheme defined in the PKCS #11 standard. In summary, this involves
9747 /// wrapping the raw key with an ephemeral AES key, and wrapping the
9748 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
9749 /// [RSA AES key wrap
9750 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9751 RsaOaep4096Sha1Aes256,
9752 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9753 /// scheme defined in the PKCS #11 standard. In summary, this involves
9754 /// wrapping the raw key with an ephemeral AES key, and wrapping the
9755 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
9756 /// [RSA AES key wrap
9757 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9758 RsaOaep3072Sha256Aes256,
9759 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9760 /// scheme defined in the PKCS #11 standard. In summary, this involves
9761 /// wrapping the raw key with an ephemeral AES key, and wrapping the
9762 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
9763 /// [RSA AES key wrap
9764 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
9765 RsaOaep4096Sha256Aes256,
9766 /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
9767 /// key material to be imported is wrapped directly with the RSA key. Due
9768 /// to technical limitations of RSA wrapping, this method cannot be used to
9769 /// wrap RSA keys for import.
9770 RsaOaep3072Sha256,
9771 /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
9772 /// key material to be imported is wrapped directly with the RSA key. Due
9773 /// to technical limitations of RSA wrapping, this method cannot be used to
9774 /// wrap RSA keys for import.
9775 RsaOaep4096Sha256,
9776 /// If set, the enum was initialized with an unknown value.
9777 ///
9778 /// Applications can examine the value using [ImportMethod::value] or
9779 /// [ImportMethod::name].
9780 UnknownValue(import_method::UnknownValue),
9781 }
9782
9783 #[doc(hidden)]
9784 pub mod import_method {
9785 #[allow(unused_imports)]
9786 use super::*;
9787 #[derive(Clone, Debug, PartialEq)]
9788 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9789 }
9790
9791 impl ImportMethod {
9792 /// Gets the enum value.
9793 ///
9794 /// Returns `None` if the enum contains an unknown value deserialized from
9795 /// the string representation of enums.
9796 pub fn value(&self) -> std::option::Option<i32> {
9797 match self {
9798 Self::Unspecified => std::option::Option::Some(0),
9799 Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
9800 Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
9801 Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
9802 Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
9803 Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
9804 Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
9805 Self::UnknownValue(u) => u.0.value(),
9806 }
9807 }
9808
9809 /// Gets the enum value as a string.
9810 ///
9811 /// Returns `None` if the enum contains an unknown value deserialized from
9812 /// the integer representation of enums.
9813 pub fn name(&self) -> std::option::Option<&str> {
9814 match self {
9815 Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
9816 Self::RsaOaep3072Sha1Aes256 => {
9817 std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
9818 }
9819 Self::RsaOaep4096Sha1Aes256 => {
9820 std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
9821 }
9822 Self::RsaOaep3072Sha256Aes256 => {
9823 std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
9824 }
9825 Self::RsaOaep4096Sha256Aes256 => {
9826 std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
9827 }
9828 Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
9829 Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
9830 Self::UnknownValue(u) => u.0.name(),
9831 }
9832 }
9833 }
9834
9835 impl std::default::Default for ImportMethod {
9836 fn default() -> Self {
9837 use std::convert::From;
9838 Self::from(0)
9839 }
9840 }
9841
9842 impl std::fmt::Display for ImportMethod {
9843 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9844 wkt::internal::display_enum(f, self.name(), self.value())
9845 }
9846 }
9847
9848 impl std::convert::From<i32> for ImportMethod {
9849 fn from(value: i32) -> Self {
9850 match value {
9851 0 => Self::Unspecified,
9852 1 => Self::RsaOaep3072Sha1Aes256,
9853 2 => Self::RsaOaep4096Sha1Aes256,
9854 3 => Self::RsaOaep3072Sha256Aes256,
9855 4 => Self::RsaOaep4096Sha256Aes256,
9856 5 => Self::RsaOaep3072Sha256,
9857 6 => Self::RsaOaep4096Sha256,
9858 _ => Self::UnknownValue(import_method::UnknownValue(
9859 wkt::internal::UnknownEnumValue::Integer(value),
9860 )),
9861 }
9862 }
9863 }
9864
9865 impl std::convert::From<&str> for ImportMethod {
9866 fn from(value: &str) -> Self {
9867 use std::string::ToString;
9868 match value {
9869 "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
9870 "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
9871 "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
9872 "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
9873 "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
9874 "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
9875 "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
9876 _ => Self::UnknownValue(import_method::UnknownValue(
9877 wkt::internal::UnknownEnumValue::String(value.to_string()),
9878 )),
9879 }
9880 }
9881 }
9882
9883 impl serde::ser::Serialize for ImportMethod {
9884 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9885 where
9886 S: serde::Serializer,
9887 {
9888 match self {
9889 Self::Unspecified => serializer.serialize_i32(0),
9890 Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
9891 Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
9892 Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
9893 Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
9894 Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
9895 Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
9896 Self::UnknownValue(u) => u.0.serialize(serializer),
9897 }
9898 }
9899 }
9900
9901 impl<'de> serde::de::Deserialize<'de> for ImportMethod {
9902 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9903 where
9904 D: serde::Deserializer<'de>,
9905 {
9906 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
9907 ".google.cloud.kms.v1.ImportJob.ImportMethod",
9908 ))
9909 }
9910 }
9911
9912 /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
9913 /// it can be used.
9914 ///
9915 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9916 ///
9917 /// # Working with unknown values
9918 ///
9919 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9920 /// additional enum variants at any time. Adding new variants is not considered
9921 /// a breaking change. Applications should write their code in anticipation of:
9922 ///
9923 /// - New values appearing in future releases of the client library, **and**
9924 /// - New values received dynamically, without application changes.
9925 ///
9926 /// Please consult the [Working with enums] section in the user guide for some
9927 /// guidelines.
9928 ///
9929 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9930 #[derive(Clone, Debug, PartialEq)]
9931 #[non_exhaustive]
9932 pub enum ImportJobState {
9933 /// Not specified.
9934 Unspecified,
9935 /// The wrapping key for this job is still being generated. It may not be
9936 /// used. Cloud KMS will automatically mark this job as
9937 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
9938 /// the wrapping key is generated.
9939 ///
9940 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9941 PendingGeneration,
9942 /// This job may be used in
9943 /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
9944 /// and
9945 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
9946 /// requests.
9947 ///
9948 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
9949 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
9950 Active,
9951 /// This job can no longer be used and may not leave this state once entered.
9952 Expired,
9953 /// If set, the enum was initialized with an unknown value.
9954 ///
9955 /// Applications can examine the value using [ImportJobState::value] or
9956 /// [ImportJobState::name].
9957 UnknownValue(import_job_state::UnknownValue),
9958 }
9959
9960 #[doc(hidden)]
9961 pub mod import_job_state {
9962 #[allow(unused_imports)]
9963 use super::*;
9964 #[derive(Clone, Debug, PartialEq)]
9965 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9966 }
9967
9968 impl ImportJobState {
9969 /// Gets the enum value.
9970 ///
9971 /// Returns `None` if the enum contains an unknown value deserialized from
9972 /// the string representation of enums.
9973 pub fn value(&self) -> std::option::Option<i32> {
9974 match self {
9975 Self::Unspecified => std::option::Option::Some(0),
9976 Self::PendingGeneration => std::option::Option::Some(1),
9977 Self::Active => std::option::Option::Some(2),
9978 Self::Expired => std::option::Option::Some(3),
9979 Self::UnknownValue(u) => u.0.value(),
9980 }
9981 }
9982
9983 /// Gets the enum value as a string.
9984 ///
9985 /// Returns `None` if the enum contains an unknown value deserialized from
9986 /// the integer representation of enums.
9987 pub fn name(&self) -> std::option::Option<&str> {
9988 match self {
9989 Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
9990 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
9991 Self::Active => std::option::Option::Some("ACTIVE"),
9992 Self::Expired => std::option::Option::Some("EXPIRED"),
9993 Self::UnknownValue(u) => u.0.name(),
9994 }
9995 }
9996 }
9997
9998 impl std::default::Default for ImportJobState {
9999 fn default() -> Self {
10000 use std::convert::From;
10001 Self::from(0)
10002 }
10003 }
10004
10005 impl std::fmt::Display for ImportJobState {
10006 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10007 wkt::internal::display_enum(f, self.name(), self.value())
10008 }
10009 }
10010
10011 impl std::convert::From<i32> for ImportJobState {
10012 fn from(value: i32) -> Self {
10013 match value {
10014 0 => Self::Unspecified,
10015 1 => Self::PendingGeneration,
10016 2 => Self::Active,
10017 3 => Self::Expired,
10018 _ => Self::UnknownValue(import_job_state::UnknownValue(
10019 wkt::internal::UnknownEnumValue::Integer(value),
10020 )),
10021 }
10022 }
10023 }
10024
10025 impl std::convert::From<&str> for ImportJobState {
10026 fn from(value: &str) -> Self {
10027 use std::string::ToString;
10028 match value {
10029 "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10030 "PENDING_GENERATION" => Self::PendingGeneration,
10031 "ACTIVE" => Self::Active,
10032 "EXPIRED" => Self::Expired,
10033 _ => Self::UnknownValue(import_job_state::UnknownValue(
10034 wkt::internal::UnknownEnumValue::String(value.to_string()),
10035 )),
10036 }
10037 }
10038 }
10039
10040 impl serde::ser::Serialize for ImportJobState {
10041 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10042 where
10043 S: serde::Serializer,
10044 {
10045 match self {
10046 Self::Unspecified => serializer.serialize_i32(0),
10047 Self::PendingGeneration => serializer.serialize_i32(1),
10048 Self::Active => serializer.serialize_i32(2),
10049 Self::Expired => serializer.serialize_i32(3),
10050 Self::UnknownValue(u) => u.0.serialize(serializer),
10051 }
10052 }
10053 }
10054
10055 impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10056 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10057 where
10058 D: serde::Deserializer<'de>,
10059 {
10060 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10061 ".google.cloud.kms.v1.ImportJob.ImportJobState",
10062 ))
10063 }
10064 }
10065}
10066
10067/// ExternalProtectionLevelOptions stores a group of additional fields for
10068/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10069/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10070/// protection level and
10071/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10072/// levels.
10073///
10074/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10075/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10076/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10077#[derive(Clone, Default, PartialEq)]
10078#[non_exhaustive]
10079pub struct ExternalProtectionLevelOptions {
10080 /// The URI for an external resource that this
10081 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10082 ///
10083 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10084 pub external_key_uri: std::string::String,
10085
10086 /// The path to the external key material on the EKM when using
10087 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10088 /// this field instead of external_key_uri when using an
10089 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10090 ///
10091 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10092 pub ekm_connection_key_path: std::string::String,
10093
10094 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10095}
10096
10097impl ExternalProtectionLevelOptions {
10098 pub fn new() -> Self {
10099 std::default::Default::default()
10100 }
10101
10102 /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10103 ///
10104 /// # Example
10105 /// ```ignore,no_run
10106 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10107 /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10108 /// ```
10109 pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10110 mut self,
10111 v: T,
10112 ) -> Self {
10113 self.external_key_uri = v.into();
10114 self
10115 }
10116
10117 /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10118 ///
10119 /// # Example
10120 /// ```ignore,no_run
10121 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10122 /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10123 /// ```
10124 pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10125 mut self,
10126 v: T,
10127 ) -> Self {
10128 self.ekm_connection_key_path = v.into();
10129 self
10130 }
10131}
10132
10133impl wkt::message::Message for ExternalProtectionLevelOptions {
10134 fn typename() -> &'static str {
10135 "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10136 }
10137}
10138
10139/// A
10140/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10141/// specifies zero or more allowed
10142/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10143/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey].
10144///
10145/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10146/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10147/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10148#[derive(Clone, Default, PartialEq)]
10149#[non_exhaustive]
10150pub struct KeyAccessJustificationsPolicy {
10151 /// The list of allowed reasons for access to a
10152 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Zero allowed access reasons
10153 /// means all encrypt, decrypt, and sign operations for the
10154 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with this policy will
10155 /// fail.
10156 ///
10157 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10158 pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10159
10160 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10161}
10162
10163impl KeyAccessJustificationsPolicy {
10164 pub fn new() -> Self {
10165 std::default::Default::default()
10166 }
10167
10168 /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10169 ///
10170 /// # Example
10171 /// ```ignore,no_run
10172 /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10173 /// use google_cloud_kms_v1::model::AccessReason;
10174 /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10175 /// AccessReason::CustomerInitiatedSupport,
10176 /// AccessReason::GoogleInitiatedService,
10177 /// AccessReason::ThirdPartyDataRequest,
10178 /// ]);
10179 /// ```
10180 pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10181 where
10182 T: std::iter::IntoIterator<Item = V>,
10183 V: std::convert::Into<crate::model::AccessReason>,
10184 {
10185 use std::iter::Iterator;
10186 self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10187 self
10188 }
10189}
10190
10191impl wkt::message::Message for KeyAccessJustificationsPolicy {
10192 fn typename() -> &'static str {
10193 "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10194 }
10195}
10196
10197/// A RetiredResource resource represents the record of a deleted
10198/// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Its purpose is to provide
10199/// visibility into retained user data and to prevent reuse of these names for
10200/// new [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10201///
10202/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10203#[derive(Clone, Default, PartialEq)]
10204#[non_exhaustive]
10205pub struct RetiredResource {
10206 /// Output only. Identifier. The resource name for this
10207 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] in the format
10208 /// `projects/*/locations/*/retiredResources/*`.
10209 ///
10210 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10211 pub name: std::string::String,
10212
10213 /// Output only. The full resource name of the original
10214 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] that was deleted in the format
10215 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10216 ///
10217 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10218 pub original_resource: std::string::String,
10219
10220 /// Output only. The resource type of the original deleted resource.
10221 pub resource_type: std::string::String,
10222
10223 /// Output only. The time at which the original resource was deleted and this
10224 /// RetiredResource record was created.
10225 pub delete_time: std::option::Option<wkt::Timestamp>,
10226
10227 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10228}
10229
10230impl RetiredResource {
10231 pub fn new() -> Self {
10232 std::default::Default::default()
10233 }
10234
10235 /// Sets the value of [name][crate::model::RetiredResource::name].
10236 ///
10237 /// # Example
10238 /// ```ignore,no_run
10239 /// # use google_cloud_kms_v1::model::RetiredResource;
10240 /// let x = RetiredResource::new().set_name("example");
10241 /// ```
10242 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10243 self.name = v.into();
10244 self
10245 }
10246
10247 /// Sets the value of [original_resource][crate::model::RetiredResource::original_resource].
10248 ///
10249 /// # Example
10250 /// ```ignore,no_run
10251 /// # use google_cloud_kms_v1::model::RetiredResource;
10252 /// let x = RetiredResource::new().set_original_resource("example");
10253 /// ```
10254 pub fn set_original_resource<T: std::convert::Into<std::string::String>>(
10255 mut self,
10256 v: T,
10257 ) -> Self {
10258 self.original_resource = v.into();
10259 self
10260 }
10261
10262 /// Sets the value of [resource_type][crate::model::RetiredResource::resource_type].
10263 ///
10264 /// # Example
10265 /// ```ignore,no_run
10266 /// # use google_cloud_kms_v1::model::RetiredResource;
10267 /// let x = RetiredResource::new().set_resource_type("example");
10268 /// ```
10269 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10270 self.resource_type = v.into();
10271 self
10272 }
10273
10274 /// Sets the value of [delete_time][crate::model::RetiredResource::delete_time].
10275 ///
10276 /// # Example
10277 /// ```ignore,no_run
10278 /// # use google_cloud_kms_v1::model::RetiredResource;
10279 /// use wkt::Timestamp;
10280 /// let x = RetiredResource::new().set_delete_time(Timestamp::default()/* use setters */);
10281 /// ```
10282 pub fn set_delete_time<T>(mut self, v: T) -> Self
10283 where
10284 T: std::convert::Into<wkt::Timestamp>,
10285 {
10286 self.delete_time = std::option::Option::Some(v.into());
10287 self
10288 }
10289
10290 /// Sets or clears the value of [delete_time][crate::model::RetiredResource::delete_time].
10291 ///
10292 /// # Example
10293 /// ```ignore,no_run
10294 /// # use google_cloud_kms_v1::model::RetiredResource;
10295 /// use wkt::Timestamp;
10296 /// let x = RetiredResource::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
10297 /// let x = RetiredResource::new().set_or_clear_delete_time(None::<Timestamp>);
10298 /// ```
10299 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
10300 where
10301 T: std::convert::Into<wkt::Timestamp>,
10302 {
10303 self.delete_time = v.map(|x| x.into());
10304 self
10305 }
10306}
10307
10308impl wkt::message::Message for RetiredResource {
10309 fn typename() -> &'static str {
10310 "type.googleapis.com/google.cloud.kms.v1.RetiredResource"
10311 }
10312}
10313
10314/// Request message for
10315/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10316///
10317/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10318#[derive(Clone, Default, PartialEq)]
10319#[non_exhaustive]
10320pub struct ListKeyRingsRequest {
10321 /// Required. The resource name of the location associated with the
10322 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
10323 /// `projects/*/locations/*`.
10324 ///
10325 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10326 pub parent: std::string::String,
10327
10328 /// Optional. Optional limit on the number of
10329 /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
10330 /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
10331 /// including the
10332 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
10333 /// in a subsequent request. If unspecified, the server will pick an
10334 /// appropriate default.
10335 ///
10336 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10337 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10338 pub page_size: i32,
10339
10340 /// Optional. Optional pagination token, returned earlier via
10341 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
10342 ///
10343 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10344 pub page_token: std::string::String,
10345
10346 /// Optional. Only include resources that match the filter in the response. For
10347 /// more information, see
10348 /// [Sorting and filtering list
10349 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10350 pub filter: std::string::String,
10351
10352 /// Optional. Specify how the results should be sorted. If not specified, the
10353 /// results will be sorted in the default order. For more information, see
10354 /// [Sorting and filtering list
10355 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10356 pub order_by: std::string::String,
10357
10358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10359}
10360
10361impl ListKeyRingsRequest {
10362 pub fn new() -> Self {
10363 std::default::Default::default()
10364 }
10365
10366 /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
10367 ///
10368 /// # Example
10369 /// ```ignore,no_run
10370 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10371 /// let x = ListKeyRingsRequest::new().set_parent("example");
10372 /// ```
10373 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10374 self.parent = v.into();
10375 self
10376 }
10377
10378 /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
10379 ///
10380 /// # Example
10381 /// ```ignore,no_run
10382 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10383 /// let x = ListKeyRingsRequest::new().set_page_size(42);
10384 /// ```
10385 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10386 self.page_size = v.into();
10387 self
10388 }
10389
10390 /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
10391 ///
10392 /// # Example
10393 /// ```ignore,no_run
10394 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10395 /// let x = ListKeyRingsRequest::new().set_page_token("example");
10396 /// ```
10397 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10398 self.page_token = v.into();
10399 self
10400 }
10401
10402 /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
10403 ///
10404 /// # Example
10405 /// ```ignore,no_run
10406 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10407 /// let x = ListKeyRingsRequest::new().set_filter("example");
10408 /// ```
10409 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10410 self.filter = v.into();
10411 self
10412 }
10413
10414 /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
10415 ///
10416 /// # Example
10417 /// ```ignore,no_run
10418 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10419 /// let x = ListKeyRingsRequest::new().set_order_by("example");
10420 /// ```
10421 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10422 self.order_by = v.into();
10423 self
10424 }
10425}
10426
10427impl wkt::message::Message for ListKeyRingsRequest {
10428 fn typename() -> &'static str {
10429 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
10430 }
10431}
10432
10433/// Request message for
10434/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10435///
10436/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10437#[derive(Clone, Default, PartialEq)]
10438#[non_exhaustive]
10439pub struct ListCryptoKeysRequest {
10440 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10441 /// to list, in the format `projects/*/locations/*/keyRings/*`.
10442 ///
10443 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10444 pub parent: std::string::String,
10445
10446 /// Optional. Optional limit on the number of
10447 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
10448 /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
10449 /// obtained by including the
10450 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
10451 /// in a subsequent request. If unspecified, the server will pick an
10452 /// appropriate default.
10453 ///
10454 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10455 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10456 pub page_size: i32,
10457
10458 /// Optional. Optional pagination token, returned earlier via
10459 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
10460 ///
10461 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10462 pub page_token: std::string::String,
10463
10464 /// The fields of the primary version to include in the response.
10465 pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
10466
10467 /// Optional. Only include resources that match the filter in the response. For
10468 /// more information, see
10469 /// [Sorting and filtering list
10470 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10471 pub filter: std::string::String,
10472
10473 /// Optional. Specify how the results should be sorted. If not specified, the
10474 /// results will be sorted in the default order. For more information, see
10475 /// [Sorting and filtering list
10476 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10477 pub order_by: std::string::String,
10478
10479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10480}
10481
10482impl ListCryptoKeysRequest {
10483 pub fn new() -> Self {
10484 std::default::Default::default()
10485 }
10486
10487 /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
10488 ///
10489 /// # Example
10490 /// ```ignore,no_run
10491 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10492 /// let x = ListCryptoKeysRequest::new().set_parent("example");
10493 /// ```
10494 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10495 self.parent = v.into();
10496 self
10497 }
10498
10499 /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
10500 ///
10501 /// # Example
10502 /// ```ignore,no_run
10503 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10504 /// let x = ListCryptoKeysRequest::new().set_page_size(42);
10505 /// ```
10506 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10507 self.page_size = v.into();
10508 self
10509 }
10510
10511 /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
10512 ///
10513 /// # Example
10514 /// ```ignore,no_run
10515 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10516 /// let x = ListCryptoKeysRequest::new().set_page_token("example");
10517 /// ```
10518 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10519 self.page_token = v.into();
10520 self
10521 }
10522
10523 /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
10524 ///
10525 /// # Example
10526 /// ```ignore,no_run
10527 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10528 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10529 /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
10530 /// ```
10531 pub fn set_version_view<
10532 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10533 >(
10534 mut self,
10535 v: T,
10536 ) -> Self {
10537 self.version_view = v.into();
10538 self
10539 }
10540
10541 /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
10542 ///
10543 /// # Example
10544 /// ```ignore,no_run
10545 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10546 /// let x = ListCryptoKeysRequest::new().set_filter("example");
10547 /// ```
10548 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10549 self.filter = v.into();
10550 self
10551 }
10552
10553 /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
10554 ///
10555 /// # Example
10556 /// ```ignore,no_run
10557 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10558 /// let x = ListCryptoKeysRequest::new().set_order_by("example");
10559 /// ```
10560 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10561 self.order_by = v.into();
10562 self
10563 }
10564}
10565
10566impl wkt::message::Message for ListCryptoKeysRequest {
10567 fn typename() -> &'static str {
10568 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
10569 }
10570}
10571
10572/// Request message for
10573/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
10574///
10575/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
10576#[derive(Clone, Default, PartialEq)]
10577#[non_exhaustive]
10578pub struct ListCryptoKeyVersionsRequest {
10579 /// Required. The resource name of the
10580 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
10581 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10582 ///
10583 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10584 pub parent: std::string::String,
10585
10586 /// Optional. Optional limit on the number of
10587 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
10588 /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
10589 /// can subsequently be obtained by including the
10590 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
10591 /// in a subsequent request. If unspecified, the server will pick an
10592 /// appropriate default.
10593 ///
10594 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10595 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10596 pub page_size: i32,
10597
10598 /// Optional. Optional pagination token, returned earlier via
10599 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
10600 ///
10601 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10602 pub page_token: std::string::String,
10603
10604 /// The fields to include in the response.
10605 pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
10606
10607 /// Optional. Only include resources that match the filter in the response. For
10608 /// more information, see
10609 /// [Sorting and filtering list
10610 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10611 pub filter: std::string::String,
10612
10613 /// Optional. Specify how the results should be sorted. If not specified, the
10614 /// results will be sorted in the default order. For more information, see
10615 /// [Sorting and filtering list
10616 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10617 pub order_by: std::string::String,
10618
10619 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10620}
10621
10622impl ListCryptoKeyVersionsRequest {
10623 pub fn new() -> Self {
10624 std::default::Default::default()
10625 }
10626
10627 /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
10628 ///
10629 /// # Example
10630 /// ```ignore,no_run
10631 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10632 /// let x = ListCryptoKeyVersionsRequest::new().set_parent("example");
10633 /// ```
10634 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10635 self.parent = v.into();
10636 self
10637 }
10638
10639 /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
10640 ///
10641 /// # Example
10642 /// ```ignore,no_run
10643 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10644 /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
10645 /// ```
10646 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10647 self.page_size = v.into();
10648 self
10649 }
10650
10651 /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
10652 ///
10653 /// # Example
10654 /// ```ignore,no_run
10655 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10656 /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
10657 /// ```
10658 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10659 self.page_token = v.into();
10660 self
10661 }
10662
10663 /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
10664 ///
10665 /// # Example
10666 /// ```ignore,no_run
10667 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10668 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10669 /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
10670 /// ```
10671 pub fn set_view<
10672 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10673 >(
10674 mut self,
10675 v: T,
10676 ) -> Self {
10677 self.view = v.into();
10678 self
10679 }
10680
10681 /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
10682 ///
10683 /// # Example
10684 /// ```ignore,no_run
10685 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10686 /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
10687 /// ```
10688 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10689 self.filter = v.into();
10690 self
10691 }
10692
10693 /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
10694 ///
10695 /// # Example
10696 /// ```ignore,no_run
10697 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10698 /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
10699 /// ```
10700 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10701 self.order_by = v.into();
10702 self
10703 }
10704}
10705
10706impl wkt::message::Message for ListCryptoKeyVersionsRequest {
10707 fn typename() -> &'static str {
10708 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
10709 }
10710}
10711
10712/// Request message for
10713/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
10714///
10715/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
10716#[derive(Clone, Default, PartialEq)]
10717#[non_exhaustive]
10718pub struct ListImportJobsRequest {
10719 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10720 /// to list, in the format `projects/*/locations/*/keyRings/*`.
10721 ///
10722 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10723 pub parent: std::string::String,
10724
10725 /// Optional. Optional limit on the number of
10726 /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
10727 /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
10728 /// obtained by including the
10729 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
10730 /// in a subsequent request. If unspecified, the server will pick an
10731 /// appropriate default.
10732 ///
10733 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10734 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10735 pub page_size: i32,
10736
10737 /// Optional. Optional pagination token, returned earlier via
10738 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
10739 ///
10740 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10741 pub page_token: std::string::String,
10742
10743 /// Optional. Only include resources that match the filter in the response. For
10744 /// more information, see
10745 /// [Sorting and filtering list
10746 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10747 pub filter: std::string::String,
10748
10749 /// Optional. Specify how the results should be sorted. If not specified, the
10750 /// results will be sorted in the default order. For more information, see
10751 /// [Sorting and filtering list
10752 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10753 pub order_by: std::string::String,
10754
10755 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10756}
10757
10758impl ListImportJobsRequest {
10759 pub fn new() -> Self {
10760 std::default::Default::default()
10761 }
10762
10763 /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
10764 ///
10765 /// # Example
10766 /// ```ignore,no_run
10767 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10768 /// let x = ListImportJobsRequest::new().set_parent("example");
10769 /// ```
10770 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10771 self.parent = v.into();
10772 self
10773 }
10774
10775 /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
10776 ///
10777 /// # Example
10778 /// ```ignore,no_run
10779 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10780 /// let x = ListImportJobsRequest::new().set_page_size(42);
10781 /// ```
10782 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10783 self.page_size = v.into();
10784 self
10785 }
10786
10787 /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
10788 ///
10789 /// # Example
10790 /// ```ignore,no_run
10791 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10792 /// let x = ListImportJobsRequest::new().set_page_token("example");
10793 /// ```
10794 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10795 self.page_token = v.into();
10796 self
10797 }
10798
10799 /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
10800 ///
10801 /// # Example
10802 /// ```ignore,no_run
10803 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10804 /// let x = ListImportJobsRequest::new().set_filter("example");
10805 /// ```
10806 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10807 self.filter = v.into();
10808 self
10809 }
10810
10811 /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
10812 ///
10813 /// # Example
10814 /// ```ignore,no_run
10815 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
10816 /// let x = ListImportJobsRequest::new().set_order_by("example");
10817 /// ```
10818 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10819 self.order_by = v.into();
10820 self
10821 }
10822}
10823
10824impl wkt::message::Message for ListImportJobsRequest {
10825 fn typename() -> &'static str {
10826 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
10827 }
10828}
10829
10830/// Request message for
10831/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
10832///
10833/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
10834#[derive(Clone, Default, PartialEq)]
10835#[non_exhaustive]
10836pub struct ListRetiredResourcesRequest {
10837 /// Required. The project-specific location holding the
10838 /// [RetiredResources][google.cloud.kms.v1.RetiredResource], in the format
10839 /// `projects/*/locations/*`.
10840 ///
10841 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10842 pub parent: std::string::String,
10843
10844 /// Optional. Optional limit on the number of
10845 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] to be included in
10846 /// the response. Further
10847 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] can subsequently be
10848 /// obtained by including the
10849 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]
10850 /// in a subsequent request. If unspecified, the server will pick an
10851 /// appropriate default.
10852 ///
10853 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
10854 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10855 pub page_size: i32,
10856
10857 /// Optional. Optional pagination token, returned earlier via
10858 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token].
10859 ///
10860 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
10861 pub page_token: std::string::String,
10862
10863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10864}
10865
10866impl ListRetiredResourcesRequest {
10867 pub fn new() -> Self {
10868 std::default::Default::default()
10869 }
10870
10871 /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
10872 ///
10873 /// # Example
10874 /// ```ignore,no_run
10875 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
10876 /// let x = ListRetiredResourcesRequest::new().set_parent("example");
10877 /// ```
10878 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10879 self.parent = v.into();
10880 self
10881 }
10882
10883 /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
10884 ///
10885 /// # Example
10886 /// ```ignore,no_run
10887 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
10888 /// let x = ListRetiredResourcesRequest::new().set_page_size(42);
10889 /// ```
10890 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10891 self.page_size = v.into();
10892 self
10893 }
10894
10895 /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
10896 ///
10897 /// # Example
10898 /// ```ignore,no_run
10899 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
10900 /// let x = ListRetiredResourcesRequest::new().set_page_token("example");
10901 /// ```
10902 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10903 self.page_token = v.into();
10904 self
10905 }
10906}
10907
10908impl wkt::message::Message for ListRetiredResourcesRequest {
10909 fn typename() -> &'static str {
10910 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesRequest"
10911 }
10912}
10913
10914/// Response message for
10915/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10916///
10917/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10918#[derive(Clone, Default, PartialEq)]
10919#[non_exhaustive]
10920pub struct ListKeyRingsResponse {
10921 /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
10922 ///
10923 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10924 pub key_rings: std::vec::Vec<crate::model::KeyRing>,
10925
10926 /// A token to retrieve next page of results. Pass this value in
10927 /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
10928 /// to retrieve the next page of results.
10929 ///
10930 /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
10931 pub next_page_token: std::string::String,
10932
10933 /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
10934 /// the query.
10935 ///
10936 /// This field is not populated if
10937 /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
10938 /// is applied.
10939 ///
10940 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10941 /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
10942 pub total_size: i32,
10943
10944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10945}
10946
10947impl ListKeyRingsResponse {
10948 pub fn new() -> Self {
10949 std::default::Default::default()
10950 }
10951
10952 /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
10953 ///
10954 /// # Example
10955 /// ```ignore,no_run
10956 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
10957 /// use google_cloud_kms_v1::model::KeyRing;
10958 /// let x = ListKeyRingsResponse::new()
10959 /// .set_key_rings([
10960 /// KeyRing::default()/* use setters */,
10961 /// KeyRing::default()/* use (different) setters */,
10962 /// ]);
10963 /// ```
10964 pub fn set_key_rings<T, V>(mut self, v: T) -> Self
10965 where
10966 T: std::iter::IntoIterator<Item = V>,
10967 V: std::convert::Into<crate::model::KeyRing>,
10968 {
10969 use std::iter::Iterator;
10970 self.key_rings = v.into_iter().map(|i| i.into()).collect();
10971 self
10972 }
10973
10974 /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
10975 ///
10976 /// # Example
10977 /// ```ignore,no_run
10978 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
10979 /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
10980 /// ```
10981 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10982 self.next_page_token = v.into();
10983 self
10984 }
10985
10986 /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
10987 ///
10988 /// # Example
10989 /// ```ignore,no_run
10990 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
10991 /// let x = ListKeyRingsResponse::new().set_total_size(42);
10992 /// ```
10993 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10994 self.total_size = v.into();
10995 self
10996 }
10997}
10998
10999impl wkt::message::Message for ListKeyRingsResponse {
11000 fn typename() -> &'static str {
11001 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
11002 }
11003}
11004
11005#[doc(hidden)]
11006impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
11007 type PageItem = crate::model::KeyRing;
11008
11009 fn items(self) -> std::vec::Vec<Self::PageItem> {
11010 self.key_rings
11011 }
11012
11013 fn next_page_token(&self) -> std::string::String {
11014 use std::clone::Clone;
11015 self.next_page_token.clone()
11016 }
11017}
11018
11019/// Response message for
11020/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11021///
11022/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11023#[derive(Clone, Default, PartialEq)]
11024#[non_exhaustive]
11025pub struct ListCryptoKeysResponse {
11026 /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11027 ///
11028 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11029 pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
11030
11031 /// A token to retrieve next page of results. Pass this value in
11032 /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
11033 /// to retrieve the next page of results.
11034 ///
11035 /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
11036 pub next_page_token: std::string::String,
11037
11038 /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
11039 /// matched the query.
11040 ///
11041 /// This field is not populated if
11042 /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
11043 /// is applied.
11044 ///
11045 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11046 /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
11047 pub total_size: i32,
11048
11049 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11050}
11051
11052impl ListCryptoKeysResponse {
11053 pub fn new() -> Self {
11054 std::default::Default::default()
11055 }
11056
11057 /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
11058 ///
11059 /// # Example
11060 /// ```ignore,no_run
11061 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11062 /// use google_cloud_kms_v1::model::CryptoKey;
11063 /// let x = ListCryptoKeysResponse::new()
11064 /// .set_crypto_keys([
11065 /// CryptoKey::default()/* use setters */,
11066 /// CryptoKey::default()/* use (different) setters */,
11067 /// ]);
11068 /// ```
11069 pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
11070 where
11071 T: std::iter::IntoIterator<Item = V>,
11072 V: std::convert::Into<crate::model::CryptoKey>,
11073 {
11074 use std::iter::Iterator;
11075 self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
11076 self
11077 }
11078
11079 /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
11080 ///
11081 /// # Example
11082 /// ```ignore,no_run
11083 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11084 /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
11085 /// ```
11086 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11087 self.next_page_token = v.into();
11088 self
11089 }
11090
11091 /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
11092 ///
11093 /// # Example
11094 /// ```ignore,no_run
11095 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11096 /// let x = ListCryptoKeysResponse::new().set_total_size(42);
11097 /// ```
11098 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11099 self.total_size = v.into();
11100 self
11101 }
11102}
11103
11104impl wkt::message::Message for ListCryptoKeysResponse {
11105 fn typename() -> &'static str {
11106 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
11107 }
11108}
11109
11110#[doc(hidden)]
11111impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
11112 type PageItem = crate::model::CryptoKey;
11113
11114 fn items(self) -> std::vec::Vec<Self::PageItem> {
11115 self.crypto_keys
11116 }
11117
11118 fn next_page_token(&self) -> std::string::String {
11119 use std::clone::Clone;
11120 self.next_page_token.clone()
11121 }
11122}
11123
11124/// Response message for
11125/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11126///
11127/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11128#[derive(Clone, Default, PartialEq)]
11129#[non_exhaustive]
11130pub struct ListCryptoKeyVersionsResponse {
11131 /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11132 ///
11133 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11134 pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
11135
11136 /// A token to retrieve next page of results. Pass this value in
11137 /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
11138 /// to retrieve the next page of results.
11139 ///
11140 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
11141 pub next_page_token: std::string::String,
11142
11143 /// The total number of
11144 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
11145 /// query.
11146 ///
11147 /// This field is not populated if
11148 /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
11149 /// is applied.
11150 ///
11151 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11152 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
11153 pub total_size: i32,
11154
11155 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11156}
11157
11158impl ListCryptoKeyVersionsResponse {
11159 pub fn new() -> Self {
11160 std::default::Default::default()
11161 }
11162
11163 /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
11164 ///
11165 /// # Example
11166 /// ```ignore,no_run
11167 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11168 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11169 /// let x = ListCryptoKeyVersionsResponse::new()
11170 /// .set_crypto_key_versions([
11171 /// CryptoKeyVersion::default()/* use setters */,
11172 /// CryptoKeyVersion::default()/* use (different) setters */,
11173 /// ]);
11174 /// ```
11175 pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
11176 where
11177 T: std::iter::IntoIterator<Item = V>,
11178 V: std::convert::Into<crate::model::CryptoKeyVersion>,
11179 {
11180 use std::iter::Iterator;
11181 self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
11182 self
11183 }
11184
11185 /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
11186 ///
11187 /// # Example
11188 /// ```ignore,no_run
11189 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11190 /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
11191 /// ```
11192 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11193 self.next_page_token = v.into();
11194 self
11195 }
11196
11197 /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
11198 ///
11199 /// # Example
11200 /// ```ignore,no_run
11201 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11202 /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
11203 /// ```
11204 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11205 self.total_size = v.into();
11206 self
11207 }
11208}
11209
11210impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11211 fn typename() -> &'static str {
11212 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11213 }
11214}
11215
11216#[doc(hidden)]
11217impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11218 type PageItem = crate::model::CryptoKeyVersion;
11219
11220 fn items(self) -> std::vec::Vec<Self::PageItem> {
11221 self.crypto_key_versions
11222 }
11223
11224 fn next_page_token(&self) -> std::string::String {
11225 use std::clone::Clone;
11226 self.next_page_token.clone()
11227 }
11228}
11229
11230/// Response message for
11231/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11232///
11233/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11234#[derive(Clone, Default, PartialEq)]
11235#[non_exhaustive]
11236pub struct ListImportJobsResponse {
11237 /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11238 ///
11239 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11240 pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
11241
11242 /// A token to retrieve next page of results. Pass this value in
11243 /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
11244 /// to retrieve the next page of results.
11245 ///
11246 /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
11247 pub next_page_token: std::string::String,
11248
11249 /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
11250 /// matched the query.
11251 ///
11252 /// This field is not populated if
11253 /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
11254 /// is applied.
11255 ///
11256 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11257 /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
11258 pub total_size: i32,
11259
11260 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11261}
11262
11263impl ListImportJobsResponse {
11264 pub fn new() -> Self {
11265 std::default::Default::default()
11266 }
11267
11268 /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
11269 ///
11270 /// # Example
11271 /// ```ignore,no_run
11272 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11273 /// use google_cloud_kms_v1::model::ImportJob;
11274 /// let x = ListImportJobsResponse::new()
11275 /// .set_import_jobs([
11276 /// ImportJob::default()/* use setters */,
11277 /// ImportJob::default()/* use (different) setters */,
11278 /// ]);
11279 /// ```
11280 pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
11281 where
11282 T: std::iter::IntoIterator<Item = V>,
11283 V: std::convert::Into<crate::model::ImportJob>,
11284 {
11285 use std::iter::Iterator;
11286 self.import_jobs = v.into_iter().map(|i| i.into()).collect();
11287 self
11288 }
11289
11290 /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
11291 ///
11292 /// # Example
11293 /// ```ignore,no_run
11294 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11295 /// let x = ListImportJobsResponse::new().set_next_page_token("example");
11296 /// ```
11297 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11298 self.next_page_token = v.into();
11299 self
11300 }
11301
11302 /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
11303 ///
11304 /// # Example
11305 /// ```ignore,no_run
11306 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11307 /// let x = ListImportJobsResponse::new().set_total_size(42);
11308 /// ```
11309 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11310 self.total_size = v.into();
11311 self
11312 }
11313}
11314
11315impl wkt::message::Message for ListImportJobsResponse {
11316 fn typename() -> &'static str {
11317 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
11318 }
11319}
11320
11321#[doc(hidden)]
11322impl google_cloud_gax::paginator::internal::PageableResponse for ListImportJobsResponse {
11323 type PageItem = crate::model::ImportJob;
11324
11325 fn items(self) -> std::vec::Vec<Self::PageItem> {
11326 self.import_jobs
11327 }
11328
11329 fn next_page_token(&self) -> std::string::String {
11330 use std::clone::Clone;
11331 self.next_page_token.clone()
11332 }
11333}
11334
11335/// Response message for
11336/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11337///
11338/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11339#[derive(Clone, Default, PartialEq)]
11340#[non_exhaustive]
11341pub struct ListRetiredResourcesResponse {
11342 /// The list of [RetiredResources][google.cloud.kms.v1.RetiredResource].
11343 ///
11344 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11345 pub retired_resources: std::vec::Vec<crate::model::RetiredResource>,
11346
11347 /// A token to retrieve the next page of results. Pass this value in
11348 /// [ListRetiredResourcesRequest.page_token][google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]
11349 /// to retrieve the next page of results.
11350 ///
11351 /// [google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]: crate::model::ListRetiredResourcesRequest::page_token
11352 pub next_page_token: std::string::String,
11353
11354 /// The total number of [RetiredResources][google.cloud.kms.v1.RetiredResource]
11355 /// that matched the query.
11356 ///
11357 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11358 pub total_size: i64,
11359
11360 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11361}
11362
11363impl ListRetiredResourcesResponse {
11364 pub fn new() -> Self {
11365 std::default::Default::default()
11366 }
11367
11368 /// Sets the value of [retired_resources][crate::model::ListRetiredResourcesResponse::retired_resources].
11369 ///
11370 /// # Example
11371 /// ```ignore,no_run
11372 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11373 /// use google_cloud_kms_v1::model::RetiredResource;
11374 /// let x = ListRetiredResourcesResponse::new()
11375 /// .set_retired_resources([
11376 /// RetiredResource::default()/* use setters */,
11377 /// RetiredResource::default()/* use (different) setters */,
11378 /// ]);
11379 /// ```
11380 pub fn set_retired_resources<T, V>(mut self, v: T) -> Self
11381 where
11382 T: std::iter::IntoIterator<Item = V>,
11383 V: std::convert::Into<crate::model::RetiredResource>,
11384 {
11385 use std::iter::Iterator;
11386 self.retired_resources = v.into_iter().map(|i| i.into()).collect();
11387 self
11388 }
11389
11390 /// Sets the value of [next_page_token][crate::model::ListRetiredResourcesResponse::next_page_token].
11391 ///
11392 /// # Example
11393 /// ```ignore,no_run
11394 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11395 /// let x = ListRetiredResourcesResponse::new().set_next_page_token("example");
11396 /// ```
11397 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11398 self.next_page_token = v.into();
11399 self
11400 }
11401
11402 /// Sets the value of [total_size][crate::model::ListRetiredResourcesResponse::total_size].
11403 ///
11404 /// # Example
11405 /// ```ignore,no_run
11406 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11407 /// let x = ListRetiredResourcesResponse::new().set_total_size(42);
11408 /// ```
11409 pub fn set_total_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11410 self.total_size = v.into();
11411 self
11412 }
11413}
11414
11415impl wkt::message::Message for ListRetiredResourcesResponse {
11416 fn typename() -> &'static str {
11417 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesResponse"
11418 }
11419}
11420
11421#[doc(hidden)]
11422impl google_cloud_gax::paginator::internal::PageableResponse for ListRetiredResourcesResponse {
11423 type PageItem = crate::model::RetiredResource;
11424
11425 fn items(self) -> std::vec::Vec<Self::PageItem> {
11426 self.retired_resources
11427 }
11428
11429 fn next_page_token(&self) -> std::string::String {
11430 use std::clone::Clone;
11431 self.next_page_token.clone()
11432 }
11433}
11434
11435/// Request message for
11436/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
11437///
11438/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
11439#[derive(Clone, Default, PartialEq)]
11440#[non_exhaustive]
11441pub struct GetKeyRingRequest {
11442 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
11443 /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
11444 ///
11445 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11446 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11447 pub name: std::string::String,
11448
11449 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11450}
11451
11452impl GetKeyRingRequest {
11453 pub fn new() -> Self {
11454 std::default::Default::default()
11455 }
11456
11457 /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
11458 ///
11459 /// # Example
11460 /// ```ignore,no_run
11461 /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
11462 /// let x = GetKeyRingRequest::new().set_name("example");
11463 /// ```
11464 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11465 self.name = v.into();
11466 self
11467 }
11468}
11469
11470impl wkt::message::Message for GetKeyRingRequest {
11471 fn typename() -> &'static str {
11472 "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
11473 }
11474}
11475
11476/// Request message for
11477/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
11478///
11479/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
11480#[derive(Clone, Default, PartialEq)]
11481#[non_exhaustive]
11482pub struct GetCryptoKeyRequest {
11483 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11484 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
11485 ///
11486 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11487 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11488 pub name: std::string::String,
11489
11490 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11491}
11492
11493impl GetCryptoKeyRequest {
11494 pub fn new() -> Self {
11495 std::default::Default::default()
11496 }
11497
11498 /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
11499 ///
11500 /// # Example
11501 /// ```ignore,no_run
11502 /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
11503 /// let x = GetCryptoKeyRequest::new().set_name("example");
11504 /// ```
11505 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11506 self.name = v.into();
11507 self
11508 }
11509}
11510
11511impl wkt::message::Message for GetCryptoKeyRequest {
11512 fn typename() -> &'static str {
11513 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
11514 }
11515}
11516
11517/// Request message for
11518/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
11519///
11520/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
11521#[derive(Clone, Default, PartialEq)]
11522#[non_exhaustive]
11523pub struct GetCryptoKeyVersionRequest {
11524 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11525 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
11526 ///
11527 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11528 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11529 pub name: std::string::String,
11530
11531 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11532}
11533
11534impl GetCryptoKeyVersionRequest {
11535 pub fn new() -> Self {
11536 std::default::Default::default()
11537 }
11538
11539 /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
11540 ///
11541 /// # Example
11542 /// ```ignore,no_run
11543 /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
11544 /// let x = GetCryptoKeyVersionRequest::new().set_name("example");
11545 /// ```
11546 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11547 self.name = v.into();
11548 self
11549 }
11550}
11551
11552impl wkt::message::Message for GetCryptoKeyVersionRequest {
11553 fn typename() -> &'static str {
11554 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
11555 }
11556}
11557
11558/// Request message for
11559/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
11560///
11561/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
11562#[derive(Clone, Default, PartialEq)]
11563#[non_exhaustive]
11564pub struct GetPublicKeyRequest {
11565 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11566 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
11567 ///
11568 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11569 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11570 pub name: std::string::String,
11571
11572 /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
11573 /// by the user. This field is required for PQC algorithms. If specified, the
11574 /// public key will be exported through the
11575 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
11576 /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
11577 /// field will be populated for non-PQC algorithms, and an error will be
11578 /// returned for PQC algorithms.
11579 ///
11580 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
11581 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
11582 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
11583 pub public_key_format: crate::model::public_key::PublicKeyFormat,
11584
11585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11586}
11587
11588impl GetPublicKeyRequest {
11589 pub fn new() -> Self {
11590 std::default::Default::default()
11591 }
11592
11593 /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
11594 ///
11595 /// # Example
11596 /// ```ignore,no_run
11597 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11598 /// let x = GetPublicKeyRequest::new().set_name("example");
11599 /// ```
11600 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11601 self.name = v.into();
11602 self
11603 }
11604
11605 /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
11606 ///
11607 /// # Example
11608 /// ```ignore,no_run
11609 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11610 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
11611 /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
11612 /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
11613 /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
11614 /// ```
11615 pub fn set_public_key_format<
11616 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
11617 >(
11618 mut self,
11619 v: T,
11620 ) -> Self {
11621 self.public_key_format = v.into();
11622 self
11623 }
11624}
11625
11626impl wkt::message::Message for GetPublicKeyRequest {
11627 fn typename() -> &'static str {
11628 "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
11629 }
11630}
11631
11632/// Request message for
11633/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
11634///
11635/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
11636#[derive(Clone, Default, PartialEq)]
11637#[non_exhaustive]
11638pub struct GetImportJobRequest {
11639 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
11640 /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
11641 ///
11642 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11643 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
11644 pub name: std::string::String,
11645
11646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11647}
11648
11649impl GetImportJobRequest {
11650 pub fn new() -> Self {
11651 std::default::Default::default()
11652 }
11653
11654 /// Sets the value of [name][crate::model::GetImportJobRequest::name].
11655 ///
11656 /// # Example
11657 /// ```ignore,no_run
11658 /// # use google_cloud_kms_v1::model::GetImportJobRequest;
11659 /// let x = GetImportJobRequest::new().set_name("example");
11660 /// ```
11661 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11662 self.name = v.into();
11663 self
11664 }
11665}
11666
11667impl wkt::message::Message for GetImportJobRequest {
11668 fn typename() -> &'static str {
11669 "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
11670 }
11671}
11672
11673/// Request message for
11674/// [KeyManagementService.GetRetiredResource][google.cloud.kms.v1.KeyManagementService.GetRetiredResource].
11675///
11676/// [google.cloud.kms.v1.KeyManagementService.GetRetiredResource]: crate::client::KeyManagementService::get_retired_resource
11677#[derive(Clone, Default, PartialEq)]
11678#[non_exhaustive]
11679pub struct GetRetiredResourceRequest {
11680 /// Required. The [name][google.cloud.kms.v1.RetiredResource.name] of the
11681 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] to get.
11682 ///
11683 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11684 /// [google.cloud.kms.v1.RetiredResource.name]: crate::model::RetiredResource::name
11685 pub name: std::string::String,
11686
11687 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11688}
11689
11690impl GetRetiredResourceRequest {
11691 pub fn new() -> Self {
11692 std::default::Default::default()
11693 }
11694
11695 /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
11696 ///
11697 /// # Example
11698 /// ```ignore,no_run
11699 /// # use google_cloud_kms_v1::model::GetRetiredResourceRequest;
11700 /// let x = GetRetiredResourceRequest::new().set_name("example");
11701 /// ```
11702 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11703 self.name = v.into();
11704 self
11705 }
11706}
11707
11708impl wkt::message::Message for GetRetiredResourceRequest {
11709 fn typename() -> &'static str {
11710 "type.googleapis.com/google.cloud.kms.v1.GetRetiredResourceRequest"
11711 }
11712}
11713
11714/// Request message for
11715/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
11716///
11717/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
11718#[derive(Clone, Default, PartialEq)]
11719#[non_exhaustive]
11720pub struct CreateKeyRingRequest {
11721 /// Required. The resource name of the location associated with the
11722 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
11723 /// `projects/*/locations/*`.
11724 ///
11725 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11726 pub parent: std::string::String,
11727
11728 /// Required. It must be unique within a location and match the regular
11729 /// expression `[a-zA-Z0-9_-]{1,63}`
11730 pub key_ring_id: std::string::String,
11731
11732 /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
11733 /// values.
11734 ///
11735 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11736 pub key_ring: std::option::Option<crate::model::KeyRing>,
11737
11738 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11739}
11740
11741impl CreateKeyRingRequest {
11742 pub fn new() -> Self {
11743 std::default::Default::default()
11744 }
11745
11746 /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
11747 ///
11748 /// # Example
11749 /// ```ignore,no_run
11750 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11751 /// let x = CreateKeyRingRequest::new().set_parent("example");
11752 /// ```
11753 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11754 self.parent = v.into();
11755 self
11756 }
11757
11758 /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
11759 ///
11760 /// # Example
11761 /// ```ignore,no_run
11762 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11763 /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
11764 /// ```
11765 pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11766 self.key_ring_id = v.into();
11767 self
11768 }
11769
11770 /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
11771 ///
11772 /// # Example
11773 /// ```ignore,no_run
11774 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11775 /// use google_cloud_kms_v1::model::KeyRing;
11776 /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
11777 /// ```
11778 pub fn set_key_ring<T>(mut self, v: T) -> Self
11779 where
11780 T: std::convert::Into<crate::model::KeyRing>,
11781 {
11782 self.key_ring = std::option::Option::Some(v.into());
11783 self
11784 }
11785
11786 /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
11787 ///
11788 /// # Example
11789 /// ```ignore,no_run
11790 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
11791 /// use google_cloud_kms_v1::model::KeyRing;
11792 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
11793 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
11794 /// ```
11795 pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
11796 where
11797 T: std::convert::Into<crate::model::KeyRing>,
11798 {
11799 self.key_ring = v.map(|x| x.into());
11800 self
11801 }
11802}
11803
11804impl wkt::message::Message for CreateKeyRingRequest {
11805 fn typename() -> &'static str {
11806 "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
11807 }
11808}
11809
11810/// Request message for
11811/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
11812///
11813/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
11814#[derive(Clone, Default, PartialEq)]
11815#[non_exhaustive]
11816pub struct CreateCryptoKeyRequest {
11817 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
11818 /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11819 ///
11820 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11821 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11822 pub parent: std::string::String,
11823
11824 /// Required. It must be unique within a KeyRing and match the regular
11825 /// expression `[a-zA-Z0-9_-]{1,63}`
11826 pub crypto_key_id: std::string::String,
11827
11828 /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
11829 /// values.
11830 ///
11831 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11832 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
11833
11834 /// If set to true, the request will create a
11835 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
11836 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
11837 /// manually call
11838 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
11839 /// or
11840 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
11841 /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
11842 ///
11843 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11844 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11845 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
11846 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
11847 pub skip_initial_version_creation: bool,
11848
11849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11850}
11851
11852impl CreateCryptoKeyRequest {
11853 pub fn new() -> Self {
11854 std::default::Default::default()
11855 }
11856
11857 /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
11858 ///
11859 /// # Example
11860 /// ```ignore,no_run
11861 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11862 /// let x = CreateCryptoKeyRequest::new().set_parent("example");
11863 /// ```
11864 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11865 self.parent = v.into();
11866 self
11867 }
11868
11869 /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
11870 ///
11871 /// # Example
11872 /// ```ignore,no_run
11873 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11874 /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
11875 /// ```
11876 pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11877 self.crypto_key_id = v.into();
11878 self
11879 }
11880
11881 /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
11882 ///
11883 /// # Example
11884 /// ```ignore,no_run
11885 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11886 /// use google_cloud_kms_v1::model::CryptoKey;
11887 /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
11888 /// ```
11889 pub fn set_crypto_key<T>(mut self, v: T) -> Self
11890 where
11891 T: std::convert::Into<crate::model::CryptoKey>,
11892 {
11893 self.crypto_key = std::option::Option::Some(v.into());
11894 self
11895 }
11896
11897 /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
11898 ///
11899 /// # Example
11900 /// ```ignore,no_run
11901 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11902 /// use google_cloud_kms_v1::model::CryptoKey;
11903 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
11904 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
11905 /// ```
11906 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
11907 where
11908 T: std::convert::Into<crate::model::CryptoKey>,
11909 {
11910 self.crypto_key = v.map(|x| x.into());
11911 self
11912 }
11913
11914 /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
11915 ///
11916 /// # Example
11917 /// ```ignore,no_run
11918 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
11919 /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
11920 /// ```
11921 pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11922 self.skip_initial_version_creation = v.into();
11923 self
11924 }
11925}
11926
11927impl wkt::message::Message for CreateCryptoKeyRequest {
11928 fn typename() -> &'static str {
11929 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
11930 }
11931}
11932
11933/// Request message for
11934/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
11935///
11936/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
11937#[derive(Clone, Default, PartialEq)]
11938#[non_exhaustive]
11939pub struct CreateCryptoKeyVersionRequest {
11940 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11941 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
11942 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11943 ///
11944 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11945 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11946 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11947 pub parent: std::string::String,
11948
11949 /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
11950 /// initial field values.
11951 ///
11952 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11953 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
11954
11955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11956}
11957
11958impl CreateCryptoKeyVersionRequest {
11959 pub fn new() -> Self {
11960 std::default::Default::default()
11961 }
11962
11963 /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
11964 ///
11965 /// # Example
11966 /// ```ignore,no_run
11967 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
11968 /// let x = CreateCryptoKeyVersionRequest::new().set_parent("example");
11969 /// ```
11970 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11971 self.parent = v.into();
11972 self
11973 }
11974
11975 /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
11976 ///
11977 /// # Example
11978 /// ```ignore,no_run
11979 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
11980 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11981 /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
11982 /// ```
11983 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
11984 where
11985 T: std::convert::Into<crate::model::CryptoKeyVersion>,
11986 {
11987 self.crypto_key_version = std::option::Option::Some(v.into());
11988 self
11989 }
11990
11991 /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
11992 ///
11993 /// # Example
11994 /// ```ignore,no_run
11995 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
11996 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11997 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
11998 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
11999 /// ```
12000 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12001 where
12002 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12003 {
12004 self.crypto_key_version = v.map(|x| x.into());
12005 self
12006 }
12007}
12008
12009impl wkt::message::Message for CreateCryptoKeyVersionRequest {
12010 fn typename() -> &'static str {
12011 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
12012 }
12013}
12014
12015/// Request message for
12016/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey].
12017///
12018/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
12019#[derive(Clone, Default, PartialEq)]
12020#[non_exhaustive]
12021pub struct DeleteCryptoKeyRequest {
12022 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12023 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to delete.
12024 ///
12025 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12026 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12027 pub name: std::string::String,
12028
12029 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12030}
12031
12032impl DeleteCryptoKeyRequest {
12033 pub fn new() -> Self {
12034 std::default::Default::default()
12035 }
12036
12037 /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
12038 ///
12039 /// # Example
12040 /// ```ignore,no_run
12041 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyRequest;
12042 /// let x = DeleteCryptoKeyRequest::new().set_name("example");
12043 /// ```
12044 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12045 self.name = v.into();
12046 self
12047 }
12048}
12049
12050impl wkt::message::Message for DeleteCryptoKeyRequest {
12051 fn typename() -> &'static str {
12052 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyRequest"
12053 }
12054}
12055
12056/// Request message for
12057/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion].
12058///
12059/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
12060#[derive(Clone, Default, PartialEq)]
12061#[non_exhaustive]
12062pub struct DeleteCryptoKeyVersionRequest {
12063 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12064 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to delete.
12065 ///
12066 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12067 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12068 pub name: std::string::String,
12069
12070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12071}
12072
12073impl DeleteCryptoKeyVersionRequest {
12074 pub fn new() -> Self {
12075 std::default::Default::default()
12076 }
12077
12078 /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
12079 ///
12080 /// # Example
12081 /// ```ignore,no_run
12082 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyVersionRequest;
12083 /// let x = DeleteCryptoKeyVersionRequest::new().set_name("example");
12084 /// ```
12085 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12086 self.name = v.into();
12087 self
12088 }
12089}
12090
12091impl wkt::message::Message for DeleteCryptoKeyVersionRequest {
12092 fn typename() -> &'static str {
12093 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionRequest"
12094 }
12095}
12096
12097/// Request message for
12098/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
12099///
12100/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12101#[derive(Clone, Default, PartialEq)]
12102#[non_exhaustive]
12103pub struct ImportCryptoKeyVersionRequest {
12104 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12105 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
12106 ///
12107 /// The create permission is only required on this key when creating a new
12108 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
12109 ///
12110 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12111 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12112 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12113 pub parent: std::string::String,
12114
12115 /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
12116 /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
12117 /// target for an import operation. If this field is not present, a new
12118 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
12119 /// supplied key material is created.
12120 ///
12121 /// If this field is present, the supplied key material is imported into
12122 /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
12123 /// import into an existing
12124 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
12125 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
12126 /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
12127 /// have been previously created via
12128 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
12129 /// and be in
12130 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
12131 /// or
12132 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
12133 /// state. The key material and algorithm must match the previous
12134 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
12135 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
12136 /// key material.
12137 ///
12138 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12139 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
12140 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
12141 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12142 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
12143 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12144 pub crypto_key_version: std::string::String,
12145
12146 /// Required. The
12147 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
12148 /// of the key being imported. This does not need to match the
12149 /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
12150 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
12151 ///
12152 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12153 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
12154 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
12155 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
12156
12157 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12158 /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
12159 /// material.
12160 ///
12161 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12162 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12163 pub import_job: std::string::String,
12164
12165 /// Optional. The wrapped key material to import.
12166 ///
12167 /// Before wrapping, key material must be formatted. If importing symmetric key
12168 /// material, the expected key material format is plain bytes. If importing
12169 /// asymmetric key material, the expected key material format is PKCS#8-encoded
12170 /// DER (the PrivateKeyInfo structure from RFC 5208).
12171 ///
12172 /// When wrapping with import methods
12173 /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
12174 /// or
12175 /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
12176 /// or
12177 /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
12178 /// or
12179 /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
12180 ///
12181 /// this field must contain the concatenation of:
12182 ///
12183 /// This format is the same as the format produced by PKCS#11 mechanism
12184 /// CKM_RSA_AES_KEY_WRAP.
12185 ///
12186 /// When wrapping with import methods
12187 /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
12188 /// or
12189 /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
12190 ///
12191 /// this field must contain the formatted key to be imported, wrapped with the
12192 /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
12193 /// with SHA-256, MGF1 with SHA-256, and an empty label.
12194 ///
12195 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
12196 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
12197 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
12198 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
12199 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
12200 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
12201 /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
12202 pub wrapped_key: ::bytes::Bytes,
12203
12204 /// This field is legacy. Use the field
12205 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12206 /// instead.
12207 ///
12208 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12209 pub wrapped_key_material:
12210 std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
12211
12212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12213}
12214
12215impl ImportCryptoKeyVersionRequest {
12216 pub fn new() -> Self {
12217 std::default::Default::default()
12218 }
12219
12220 /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
12221 ///
12222 /// # Example
12223 /// ```ignore,no_run
12224 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12225 /// let x = ImportCryptoKeyVersionRequest::new().set_parent("example");
12226 /// ```
12227 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12228 self.parent = v.into();
12229 self
12230 }
12231
12232 /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
12233 ///
12234 /// # Example
12235 /// ```ignore,no_run
12236 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12237 /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version("example");
12238 /// ```
12239 pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
12240 mut self,
12241 v: T,
12242 ) -> Self {
12243 self.crypto_key_version = v.into();
12244 self
12245 }
12246
12247 /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
12248 ///
12249 /// # Example
12250 /// ```ignore,no_run
12251 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12252 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
12253 /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
12254 /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
12255 /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
12256 /// ```
12257 pub fn set_algorithm<
12258 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
12259 >(
12260 mut self,
12261 v: T,
12262 ) -> Self {
12263 self.algorithm = v.into();
12264 self
12265 }
12266
12267 /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
12268 ///
12269 /// # Example
12270 /// ```ignore,no_run
12271 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12272 /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
12273 /// ```
12274 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12275 self.import_job = v.into();
12276 self
12277 }
12278
12279 /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
12280 ///
12281 /// # Example
12282 /// ```ignore,no_run
12283 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12284 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
12285 /// ```
12286 pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12287 self.wrapped_key = v.into();
12288 self
12289 }
12290
12291 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
12292 ///
12293 /// Note that all the setters affecting `wrapped_key_material` are mutually
12294 /// exclusive.
12295 ///
12296 /// # Example
12297 /// ```ignore,no_run
12298 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12299 /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
12300 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
12301 /// ```
12302 pub fn set_wrapped_key_material<
12303 T: std::convert::Into<
12304 std::option::Option<
12305 crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
12306 >,
12307 >,
12308 >(
12309 mut self,
12310 v: T,
12311 ) -> Self {
12312 self.wrapped_key_material = v.into();
12313 self
12314 }
12315
12316 /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12317 /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
12318 /// holds a different branch.
12319 pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
12320 #[allow(unreachable_patterns)]
12321 self.wrapped_key_material.as_ref().and_then(|v| match v {
12322 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
12323 _ => std::option::Option::None,
12324 })
12325 }
12326
12327 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12328 /// to hold a `RsaAesWrappedKey`.
12329 ///
12330 /// Note that all the setters affecting `wrapped_key_material` are
12331 /// mutually exclusive.
12332 ///
12333 /// # Example
12334 /// ```ignore,no_run
12335 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12336 /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
12337 /// assert!(x.rsa_aes_wrapped_key().is_some());
12338 /// ```
12339 pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12340 self.wrapped_key_material = std::option::Option::Some(
12341 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
12342 v.into(),
12343 ),
12344 );
12345 self
12346 }
12347}
12348
12349impl wkt::message::Message for ImportCryptoKeyVersionRequest {
12350 fn typename() -> &'static str {
12351 "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
12352 }
12353}
12354
12355/// Defines additional types related to [ImportCryptoKeyVersionRequest].
12356pub mod import_crypto_key_version_request {
12357 #[allow(unused_imports)]
12358 use super::*;
12359
12360 /// This field is legacy. Use the field
12361 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12362 /// instead.
12363 ///
12364 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12365 #[derive(Clone, Debug, PartialEq)]
12366 #[non_exhaustive]
12367 pub enum WrappedKeyMaterial {
12368 /// Optional. This field has the same meaning as
12369 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
12370 /// Prefer to use that field in new work. Either that field or this field
12371 /// (but not both) must be specified.
12372 ///
12373 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12374 RsaAesWrappedKey(::bytes::Bytes),
12375 }
12376}
12377
12378/// Request message for
12379/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
12380///
12381/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
12382#[derive(Clone, Default, PartialEq)]
12383#[non_exhaustive]
12384pub struct CreateImportJobRequest {
12385 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
12386 /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
12387 /// [ImportJobs][google.cloud.kms.v1.ImportJob].
12388 ///
12389 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12390 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12391 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12392 pub parent: std::string::String,
12393
12394 /// Required. It must be unique within a KeyRing and match the regular
12395 /// expression `[a-zA-Z0-9_-]{1,63}`
12396 pub import_job_id: std::string::String,
12397
12398 /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
12399 /// values.
12400 ///
12401 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12402 pub import_job: std::option::Option<crate::model::ImportJob>,
12403
12404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12405}
12406
12407impl CreateImportJobRequest {
12408 pub fn new() -> Self {
12409 std::default::Default::default()
12410 }
12411
12412 /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
12413 ///
12414 /// # Example
12415 /// ```ignore,no_run
12416 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12417 /// let x = CreateImportJobRequest::new().set_parent("example");
12418 /// ```
12419 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12420 self.parent = v.into();
12421 self
12422 }
12423
12424 /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
12425 ///
12426 /// # Example
12427 /// ```ignore,no_run
12428 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12429 /// let x = CreateImportJobRequest::new().set_import_job_id("example");
12430 /// ```
12431 pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12432 self.import_job_id = v.into();
12433 self
12434 }
12435
12436 /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12437 ///
12438 /// # Example
12439 /// ```ignore,no_run
12440 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12441 /// use google_cloud_kms_v1::model::ImportJob;
12442 /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
12443 /// ```
12444 pub fn set_import_job<T>(mut self, v: T) -> Self
12445 where
12446 T: std::convert::Into<crate::model::ImportJob>,
12447 {
12448 self.import_job = std::option::Option::Some(v.into());
12449 self
12450 }
12451
12452 /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12453 ///
12454 /// # Example
12455 /// ```ignore,no_run
12456 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12457 /// use google_cloud_kms_v1::model::ImportJob;
12458 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
12459 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
12460 /// ```
12461 pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
12462 where
12463 T: std::convert::Into<crate::model::ImportJob>,
12464 {
12465 self.import_job = v.map(|x| x.into());
12466 self
12467 }
12468}
12469
12470impl wkt::message::Message for CreateImportJobRequest {
12471 fn typename() -> &'static str {
12472 "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
12473 }
12474}
12475
12476/// Request message for
12477/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
12478///
12479/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
12480#[derive(Clone, Default, PartialEq)]
12481#[non_exhaustive]
12482pub struct UpdateCryptoKeyRequest {
12483 /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
12484 ///
12485 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12486 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12487
12488 /// Required. List of fields to be updated in this request.
12489 pub update_mask: std::option::Option<wkt::FieldMask>,
12490
12491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12492}
12493
12494impl UpdateCryptoKeyRequest {
12495 pub fn new() -> Self {
12496 std::default::Default::default()
12497 }
12498
12499 /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12500 ///
12501 /// # Example
12502 /// ```ignore,no_run
12503 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12504 /// use google_cloud_kms_v1::model::CryptoKey;
12505 /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12506 /// ```
12507 pub fn set_crypto_key<T>(mut self, v: T) -> Self
12508 where
12509 T: std::convert::Into<crate::model::CryptoKey>,
12510 {
12511 self.crypto_key = std::option::Option::Some(v.into());
12512 self
12513 }
12514
12515 /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12516 ///
12517 /// # Example
12518 /// ```ignore,no_run
12519 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12520 /// use google_cloud_kms_v1::model::CryptoKey;
12521 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12522 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12523 /// ```
12524 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12525 where
12526 T: std::convert::Into<crate::model::CryptoKey>,
12527 {
12528 self.crypto_key = v.map(|x| x.into());
12529 self
12530 }
12531
12532 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12533 ///
12534 /// # Example
12535 /// ```ignore,no_run
12536 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12537 /// use wkt::FieldMask;
12538 /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12539 /// ```
12540 pub fn set_update_mask<T>(mut self, v: T) -> Self
12541 where
12542 T: std::convert::Into<wkt::FieldMask>,
12543 {
12544 self.update_mask = std::option::Option::Some(v.into());
12545 self
12546 }
12547
12548 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12549 ///
12550 /// # Example
12551 /// ```ignore,no_run
12552 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12553 /// use wkt::FieldMask;
12554 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12555 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12556 /// ```
12557 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12558 where
12559 T: std::convert::Into<wkt::FieldMask>,
12560 {
12561 self.update_mask = v.map(|x| x.into());
12562 self
12563 }
12564}
12565
12566impl wkt::message::Message for UpdateCryptoKeyRequest {
12567 fn typename() -> &'static str {
12568 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
12569 }
12570}
12571
12572/// Request message for
12573/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
12574///
12575/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
12576#[derive(Clone, Default, PartialEq)]
12577#[non_exhaustive]
12578pub struct UpdateCryptoKeyVersionRequest {
12579 /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12580 /// updated values.
12581 ///
12582 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12583 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12584
12585 /// Required. List of fields to be updated in this request.
12586 pub update_mask: std::option::Option<wkt::FieldMask>,
12587
12588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12589}
12590
12591impl UpdateCryptoKeyVersionRequest {
12592 pub fn new() -> Self {
12593 std::default::Default::default()
12594 }
12595
12596 /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12597 ///
12598 /// # Example
12599 /// ```ignore,no_run
12600 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12601 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12602 /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12603 /// ```
12604 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12605 where
12606 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12607 {
12608 self.crypto_key_version = std::option::Option::Some(v.into());
12609 self
12610 }
12611
12612 /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12613 ///
12614 /// # Example
12615 /// ```ignore,no_run
12616 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12617 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12618 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12619 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12620 /// ```
12621 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12622 where
12623 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12624 {
12625 self.crypto_key_version = v.map(|x| x.into());
12626 self
12627 }
12628
12629 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12630 ///
12631 /// # Example
12632 /// ```ignore,no_run
12633 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12634 /// use wkt::FieldMask;
12635 /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12636 /// ```
12637 pub fn set_update_mask<T>(mut self, v: T) -> Self
12638 where
12639 T: std::convert::Into<wkt::FieldMask>,
12640 {
12641 self.update_mask = std::option::Option::Some(v.into());
12642 self
12643 }
12644
12645 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12646 ///
12647 /// # Example
12648 /// ```ignore,no_run
12649 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12650 /// use wkt::FieldMask;
12651 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12652 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12653 /// ```
12654 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12655 where
12656 T: std::convert::Into<wkt::FieldMask>,
12657 {
12658 self.update_mask = v.map(|x| x.into());
12659 self
12660 }
12661}
12662
12663impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
12664 fn typename() -> &'static str {
12665 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
12666 }
12667}
12668
12669/// Request message for
12670/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
12671///
12672/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
12673#[derive(Clone, Default, PartialEq)]
12674#[non_exhaustive]
12675pub struct UpdateCryptoKeyPrimaryVersionRequest {
12676 /// Required. The resource name of the
12677 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
12678 ///
12679 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12680 pub name: std::string::String,
12681
12682 /// Required. The id of the child
12683 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
12684 ///
12685 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12686 pub crypto_key_version_id: std::string::String,
12687
12688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12689}
12690
12691impl UpdateCryptoKeyPrimaryVersionRequest {
12692 pub fn new() -> Self {
12693 std::default::Default::default()
12694 }
12695
12696 /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
12697 ///
12698 /// # Example
12699 /// ```ignore,no_run
12700 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12701 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name("example");
12702 /// ```
12703 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12704 self.name = v.into();
12705 self
12706 }
12707
12708 /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
12709 ///
12710 /// # Example
12711 /// ```ignore,no_run
12712 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12713 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
12714 /// ```
12715 pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
12716 mut self,
12717 v: T,
12718 ) -> Self {
12719 self.crypto_key_version_id = v.into();
12720 self
12721 }
12722}
12723
12724impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
12725 fn typename() -> &'static str {
12726 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
12727 }
12728}
12729
12730/// Request message for
12731/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
12732///
12733/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
12734#[derive(Clone, Default, PartialEq)]
12735#[non_exhaustive]
12736pub struct DestroyCryptoKeyVersionRequest {
12737 /// Required. The resource name of the
12738 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
12739 ///
12740 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12741 pub name: std::string::String,
12742
12743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12744}
12745
12746impl DestroyCryptoKeyVersionRequest {
12747 pub fn new() -> Self {
12748 std::default::Default::default()
12749 }
12750
12751 /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
12752 ///
12753 /// # Example
12754 /// ```ignore,no_run
12755 /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
12756 /// let x = DestroyCryptoKeyVersionRequest::new().set_name("example");
12757 /// ```
12758 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12759 self.name = v.into();
12760 self
12761 }
12762}
12763
12764impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
12765 fn typename() -> &'static str {
12766 "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
12767 }
12768}
12769
12770/// Request message for
12771/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
12772///
12773/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
12774#[derive(Clone, Default, PartialEq)]
12775#[non_exhaustive]
12776pub struct RestoreCryptoKeyVersionRequest {
12777 /// Required. The resource name of the
12778 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
12779 ///
12780 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12781 pub name: std::string::String,
12782
12783 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12784}
12785
12786impl RestoreCryptoKeyVersionRequest {
12787 pub fn new() -> Self {
12788 std::default::Default::default()
12789 }
12790
12791 /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
12792 ///
12793 /// # Example
12794 /// ```ignore,no_run
12795 /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
12796 /// let x = RestoreCryptoKeyVersionRequest::new().set_name("example");
12797 /// ```
12798 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12799 self.name = v.into();
12800 self
12801 }
12802}
12803
12804impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
12805 fn typename() -> &'static str {
12806 "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
12807 }
12808}
12809
12810/// Request message for
12811/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
12812///
12813/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
12814#[derive(Clone, Default, PartialEq)]
12815#[non_exhaustive]
12816pub struct EncryptRequest {
12817 /// Required. The resource name of the
12818 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
12819 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
12820 /// encryption.
12821 ///
12822 /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
12823 /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
12824 ///
12825 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12826 /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
12827 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12828 pub name: std::string::String,
12829
12830 /// Required. The data to encrypt. Must be no larger than 64KiB.
12831 ///
12832 /// The maximum size depends on the key version's
12833 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
12834 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
12835 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
12836 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
12837 /// plaintext must be no larger than 64KiB. For
12838 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
12839 /// the plaintext and additional_authenticated_data fields must be no larger
12840 /// than 8KiB.
12841 ///
12842 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12843 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
12844 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
12845 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
12846 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
12847 pub plaintext: ::bytes::Bytes,
12848
12849 /// Optional. Optional data that, if specified, must also be provided during
12850 /// decryption through
12851 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
12852 ///
12853 /// The maximum size depends on the key version's
12854 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
12855 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
12856 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
12857 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
12858 /// AAD must be no larger than 64KiB. For
12859 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
12860 /// the plaintext and additional_authenticated_data fields must be no larger
12861 /// than 8KiB.
12862 ///
12863 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
12864 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
12865 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
12866 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
12867 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
12868 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
12869 pub additional_authenticated_data: ::bytes::Bytes,
12870
12871 /// Optional. An optional CRC32C checksum of the
12872 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
12873 /// If specified,
12874 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12875 /// verify the integrity of the received
12876 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
12877 /// using this checksum.
12878 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12879 /// report an error if the checksum verification fails. If you receive a
12880 /// checksum error, your client should verify that
12881 /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
12882 /// is equal to
12883 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
12884 /// and if so, perform a limited number of retries. A persistent mismatch may
12885 /// indicate an issue in your computation of the CRC32C checksum. Note: This
12886 /// field is defined as int64 for reasons of compatibility across different
12887 /// languages. However, it is a non-negative integer, which will never exceed
12888 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
12889 /// this type.
12890 ///
12891 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
12892 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
12893 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12894 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
12895
12896 /// Optional. An optional CRC32C checksum of the
12897 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
12898 /// If specified,
12899 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12900 /// verify the integrity of the received
12901 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
12902 /// using this checksum.
12903 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
12904 /// report an error if the checksum verification fails. If you receive a
12905 /// checksum error, your client should verify that
12906 /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
12907 /// is equal to
12908 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
12909 /// and if so, perform a limited number of retries. A persistent mismatch may
12910 /// indicate an issue in your computation of the CRC32C checksum. Note: This
12911 /// field is defined as int64 for reasons of compatibility across different
12912 /// languages. However, it is a non-negative integer, which will never exceed
12913 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
12914 /// this type.
12915 ///
12916 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
12917 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
12918 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
12919 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
12920
12921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12922}
12923
12924impl EncryptRequest {
12925 pub fn new() -> Self {
12926 std::default::Default::default()
12927 }
12928
12929 /// Sets the value of [name][crate::model::EncryptRequest::name].
12930 ///
12931 /// # Example
12932 /// ```ignore,no_run
12933 /// # use google_cloud_kms_v1::model::EncryptRequest;
12934 /// let x = EncryptRequest::new().set_name("example");
12935 /// ```
12936 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12937 self.name = v.into();
12938 self
12939 }
12940
12941 /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
12942 ///
12943 /// # Example
12944 /// ```ignore,no_run
12945 /// # use google_cloud_kms_v1::model::EncryptRequest;
12946 /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
12947 /// ```
12948 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12949 self.plaintext = v.into();
12950 self
12951 }
12952
12953 /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
12954 ///
12955 /// # Example
12956 /// ```ignore,no_run
12957 /// # use google_cloud_kms_v1::model::EncryptRequest;
12958 /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
12959 /// ```
12960 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
12961 mut self,
12962 v: T,
12963 ) -> Self {
12964 self.additional_authenticated_data = v.into();
12965 self
12966 }
12967
12968 /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
12969 ///
12970 /// # Example
12971 /// ```ignore,no_run
12972 /// # use google_cloud_kms_v1::model::EncryptRequest;
12973 /// use wkt::Int64Value;
12974 /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
12975 /// ```
12976 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
12977 where
12978 T: std::convert::Into<wkt::Int64Value>,
12979 {
12980 self.plaintext_crc32c = std::option::Option::Some(v.into());
12981 self
12982 }
12983
12984 /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
12985 ///
12986 /// # Example
12987 /// ```ignore,no_run
12988 /// # use google_cloud_kms_v1::model::EncryptRequest;
12989 /// use wkt::Int64Value;
12990 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
12991 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
12992 /// ```
12993 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
12994 where
12995 T: std::convert::Into<wkt::Int64Value>,
12996 {
12997 self.plaintext_crc32c = v.map(|x| x.into());
12998 self
12999 }
13000
13001 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13002 ///
13003 /// # Example
13004 /// ```ignore,no_run
13005 /// # use google_cloud_kms_v1::model::EncryptRequest;
13006 /// use wkt::Int64Value;
13007 /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13008 /// ```
13009 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13010 where
13011 T: std::convert::Into<wkt::Int64Value>,
13012 {
13013 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13014 self
13015 }
13016
13017 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13018 ///
13019 /// # Example
13020 /// ```ignore,no_run
13021 /// # use google_cloud_kms_v1::model::EncryptRequest;
13022 /// use wkt::Int64Value;
13023 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13024 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13025 /// ```
13026 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13027 mut self,
13028 v: std::option::Option<T>,
13029 ) -> Self
13030 where
13031 T: std::convert::Into<wkt::Int64Value>,
13032 {
13033 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13034 self
13035 }
13036}
13037
13038impl wkt::message::Message for EncryptRequest {
13039 fn typename() -> &'static str {
13040 "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
13041 }
13042}
13043
13044/// Request message for
13045/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
13046///
13047/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
13048#[derive(Clone, Default, PartialEq)]
13049#[non_exhaustive]
13050pub struct DecryptRequest {
13051 /// Required. The resource name of the
13052 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
13053 /// server will choose the appropriate version.
13054 ///
13055 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13056 pub name: std::string::String,
13057
13058 /// Required. The encrypted data originally returned in
13059 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
13060 ///
13061 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
13062 pub ciphertext: ::bytes::Bytes,
13063
13064 /// Optional. Optional data that must match the data originally supplied in
13065 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13066 ///
13067 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13068 pub additional_authenticated_data: ::bytes::Bytes,
13069
13070 /// Optional. An optional CRC32C checksum of the
13071 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
13072 /// If specified,
13073 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13074 /// verify the integrity of the received
13075 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
13076 /// using this checksum.
13077 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13078 /// report an error if the checksum verification fails. If you receive a
13079 /// checksum error, your client should verify that
13080 /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
13081 /// is equal to
13082 /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
13083 /// and if so, perform a limited number of retries. A persistent mismatch may
13084 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13085 /// field is defined as int64 for reasons of compatibility across different
13086 /// languages. However, it is a non-negative integer, which will never exceed
13087 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13088 /// this type.
13089 ///
13090 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
13091 /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
13092 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13093 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13094
13095 /// Optional. An optional CRC32C checksum of the
13096 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13097 /// If specified,
13098 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13099 /// verify the integrity of the received
13100 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
13101 /// using this checksum.
13102 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13103 /// report an error if the checksum verification fails. If you receive a
13104 /// checksum error, your client should verify that
13105 /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
13106 /// is equal to
13107 /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
13108 /// and if so, perform a limited number of retries. A persistent mismatch may
13109 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13110 /// field is defined as int64 for reasons of compatibility across different
13111 /// languages. However, it is a non-negative integer, which will never exceed
13112 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13113 /// this type.
13114 ///
13115 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13116 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
13117 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13118 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13119
13120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13121}
13122
13123impl DecryptRequest {
13124 pub fn new() -> Self {
13125 std::default::Default::default()
13126 }
13127
13128 /// Sets the value of [name][crate::model::DecryptRequest::name].
13129 ///
13130 /// # Example
13131 /// ```ignore,no_run
13132 /// # use google_cloud_kms_v1::model::DecryptRequest;
13133 /// let x = DecryptRequest::new().set_name("example");
13134 /// ```
13135 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13136 self.name = v.into();
13137 self
13138 }
13139
13140 /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
13141 ///
13142 /// # Example
13143 /// ```ignore,no_run
13144 /// # use google_cloud_kms_v1::model::DecryptRequest;
13145 /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13146 /// ```
13147 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13148 self.ciphertext = v.into();
13149 self
13150 }
13151
13152 /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
13153 ///
13154 /// # Example
13155 /// ```ignore,no_run
13156 /// # use google_cloud_kms_v1::model::DecryptRequest;
13157 /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13158 /// ```
13159 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13160 mut self,
13161 v: T,
13162 ) -> Self {
13163 self.additional_authenticated_data = v.into();
13164 self
13165 }
13166
13167 /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13168 ///
13169 /// # Example
13170 /// ```ignore,no_run
13171 /// # use google_cloud_kms_v1::model::DecryptRequest;
13172 /// use wkt::Int64Value;
13173 /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13174 /// ```
13175 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13176 where
13177 T: std::convert::Into<wkt::Int64Value>,
13178 {
13179 self.ciphertext_crc32c = std::option::Option::Some(v.into());
13180 self
13181 }
13182
13183 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13184 ///
13185 /// # Example
13186 /// ```ignore,no_run
13187 /// # use google_cloud_kms_v1::model::DecryptRequest;
13188 /// use wkt::Int64Value;
13189 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13190 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13191 /// ```
13192 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13193 where
13194 T: std::convert::Into<wkt::Int64Value>,
13195 {
13196 self.ciphertext_crc32c = v.map(|x| x.into());
13197 self
13198 }
13199
13200 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13201 ///
13202 /// # Example
13203 /// ```ignore,no_run
13204 /// # use google_cloud_kms_v1::model::DecryptRequest;
13205 /// use wkt::Int64Value;
13206 /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13207 /// ```
13208 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13209 where
13210 T: std::convert::Into<wkt::Int64Value>,
13211 {
13212 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13213 self
13214 }
13215
13216 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13217 ///
13218 /// # Example
13219 /// ```ignore,no_run
13220 /// # use google_cloud_kms_v1::model::DecryptRequest;
13221 /// use wkt::Int64Value;
13222 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13223 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13224 /// ```
13225 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13226 mut self,
13227 v: std::option::Option<T>,
13228 ) -> Self
13229 where
13230 T: std::convert::Into<wkt::Int64Value>,
13231 {
13232 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13233 self
13234 }
13235}
13236
13237impl wkt::message::Message for DecryptRequest {
13238 fn typename() -> &'static str {
13239 "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
13240 }
13241}
13242
13243/// Request message for
13244/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
13245///
13246/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
13247#[derive(Clone, Default, PartialEq)]
13248#[non_exhaustive]
13249pub struct RawEncryptRequest {
13250 /// Required. The resource name of the
13251 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13252 /// encryption.
13253 ///
13254 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13255 pub name: std::string::String,
13256
13257 /// Required. The data to encrypt. Must be no larger than 64KiB.
13258 ///
13259 /// The maximum size depends on the key version's
13260 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13261 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13262 /// plaintext must be no larger than 64KiB. For
13263 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13264 /// the plaintext and additional_authenticated_data fields must be no larger
13265 /// than 8KiB.
13266 ///
13267 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13268 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13269 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13270 pub plaintext: ::bytes::Bytes,
13271
13272 /// Optional. Optional data that, if specified, must also be provided during
13273 /// decryption through
13274 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13275 ///
13276 /// This field may only be used in conjunction with an
13277 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
13278 /// additional authenticated data (for example, AES-GCM).
13279 ///
13280 /// The maximum size depends on the key version's
13281 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13282 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13283 /// plaintext must be no larger than 64KiB. For
13284 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13285 /// the plaintext and additional_authenticated_data fields must be no larger
13286 /// than 8KiB.
13287 ///
13288 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13289 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13290 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13291 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13292 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13293 pub additional_authenticated_data: ::bytes::Bytes,
13294
13295 /// Optional. An optional CRC32C checksum of the
13296 /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
13297 /// If specified,
13298 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13299 /// verify the integrity of the received plaintext using this checksum.
13300 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13301 /// report an error if the checksum verification fails. If you receive a
13302 /// checksum error, your client should verify that CRC32C(plaintext) is equal
13303 /// to plaintext_crc32c, and if so, perform a limited number of retries. A
13304 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13305 /// checksum. Note: This field is defined as int64 for reasons of compatibility
13306 /// across different languages. However, it is a non-negative integer, which
13307 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13308 /// languages that support this type.
13309 ///
13310 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13311 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
13312 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13313
13314 /// Optional. An optional CRC32C checksum of the
13315 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13316 /// If specified,
13317 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13318 /// verify the integrity of the received additional_authenticated_data using
13319 /// this checksum.
13320 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13321 /// report an error if the checksum verification fails. If you receive a
13322 /// checksum error, your client should verify that
13323 /// CRC32C(additional_authenticated_data) is equal to
13324 /// additional_authenticated_data_crc32c, and if so, perform
13325 /// a limited number of retries. A persistent mismatch may indicate an issue in
13326 /// your computation of the CRC32C checksum.
13327 /// Note: This field is defined as int64 for reasons of compatibility across
13328 /// different languages. However, it is a non-negative integer, which will
13329 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13330 /// that support this type.
13331 ///
13332 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13333 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13334 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13335
13336 /// Optional. A customer-supplied initialization vector that will be used for
13337 /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
13338 /// generated. It will be returned in
13339 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13340 ///
13341 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13342 pub initialization_vector: ::bytes::Bytes,
13343
13344 /// Optional. An optional CRC32C checksum of the
13345 /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
13346 /// If specified,
13347 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13348 /// verify the integrity of the received initialization_vector using this
13349 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13350 /// will report an error if the checksum verification fails. If you receive a
13351 /// checksum error, your client should verify that
13352 /// CRC32C(initialization_vector) is equal to
13353 /// initialization_vector_crc32c, and if so, perform
13354 /// a limited number of retries. A persistent mismatch may indicate an issue in
13355 /// your computation of the CRC32C checksum.
13356 /// Note: This field is defined as int64 for reasons of compatibility across
13357 /// different languages. However, it is a non-negative integer, which will
13358 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13359 /// that support this type.
13360 ///
13361 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13362 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
13363 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13364
13365 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13366}
13367
13368impl RawEncryptRequest {
13369 pub fn new() -> Self {
13370 std::default::Default::default()
13371 }
13372
13373 /// Sets the value of [name][crate::model::RawEncryptRequest::name].
13374 ///
13375 /// # Example
13376 /// ```ignore,no_run
13377 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13378 /// let x = RawEncryptRequest::new().set_name("example");
13379 /// ```
13380 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13381 self.name = v.into();
13382 self
13383 }
13384
13385 /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
13386 ///
13387 /// # Example
13388 /// ```ignore,no_run
13389 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13390 /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13391 /// ```
13392 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13393 self.plaintext = v.into();
13394 self
13395 }
13396
13397 /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
13398 ///
13399 /// # Example
13400 /// ```ignore,no_run
13401 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13402 /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13403 /// ```
13404 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13405 mut self,
13406 v: T,
13407 ) -> Self {
13408 self.additional_authenticated_data = v.into();
13409 self
13410 }
13411
13412 /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13413 ///
13414 /// # Example
13415 /// ```ignore,no_run
13416 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13417 /// use wkt::Int64Value;
13418 /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13419 /// ```
13420 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13421 where
13422 T: std::convert::Into<wkt::Int64Value>,
13423 {
13424 self.plaintext_crc32c = std::option::Option::Some(v.into());
13425 self
13426 }
13427
13428 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13429 ///
13430 /// # Example
13431 /// ```ignore,no_run
13432 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13433 /// use wkt::Int64Value;
13434 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13435 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13436 /// ```
13437 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13438 where
13439 T: std::convert::Into<wkt::Int64Value>,
13440 {
13441 self.plaintext_crc32c = v.map(|x| x.into());
13442 self
13443 }
13444
13445 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13446 ///
13447 /// # Example
13448 /// ```ignore,no_run
13449 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13450 /// use wkt::Int64Value;
13451 /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13452 /// ```
13453 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13454 where
13455 T: std::convert::Into<wkt::Int64Value>,
13456 {
13457 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13458 self
13459 }
13460
13461 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13462 ///
13463 /// # Example
13464 /// ```ignore,no_run
13465 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13466 /// use wkt::Int64Value;
13467 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13468 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13469 /// ```
13470 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13471 mut self,
13472 v: std::option::Option<T>,
13473 ) -> Self
13474 where
13475 T: std::convert::Into<wkt::Int64Value>,
13476 {
13477 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13478 self
13479 }
13480
13481 /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
13482 ///
13483 /// # Example
13484 /// ```ignore,no_run
13485 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13486 /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13487 /// ```
13488 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13489 mut self,
13490 v: T,
13491 ) -> Self {
13492 self.initialization_vector = v.into();
13493 self
13494 }
13495
13496 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13497 ///
13498 /// # Example
13499 /// ```ignore,no_run
13500 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13501 /// use wkt::Int64Value;
13502 /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
13503 /// ```
13504 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
13505 where
13506 T: std::convert::Into<wkt::Int64Value>,
13507 {
13508 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
13509 self
13510 }
13511
13512 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13513 ///
13514 /// # Example
13515 /// ```ignore,no_run
13516 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13517 /// use wkt::Int64Value;
13518 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
13519 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
13520 /// ```
13521 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13522 where
13523 T: std::convert::Into<wkt::Int64Value>,
13524 {
13525 self.initialization_vector_crc32c = v.map(|x| x.into());
13526 self
13527 }
13528}
13529
13530impl wkt::message::Message for RawEncryptRequest {
13531 fn typename() -> &'static str {
13532 "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
13533 }
13534}
13535
13536/// Request message for
13537/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
13538///
13539/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
13540#[derive(Clone, Default, PartialEq)]
13541#[non_exhaustive]
13542pub struct RawDecryptRequest {
13543 /// Required. The resource name of the
13544 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13545 /// decryption.
13546 ///
13547 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13548 pub name: std::string::String,
13549
13550 /// Required. The encrypted data originally returned in
13551 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
13552 ///
13553 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
13554 pub ciphertext: ::bytes::Bytes,
13555
13556 /// Optional. Optional data that must match the data originally supplied in
13557 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13558 ///
13559 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13560 pub additional_authenticated_data: ::bytes::Bytes,
13561
13562 /// Required. The initialization vector (IV) used during encryption, which must
13563 /// match the data originally provided in
13564 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13565 ///
13566 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13567 pub initialization_vector: ::bytes::Bytes,
13568
13569 /// The length of the authentication tag that is appended to the end of
13570 /// the ciphertext. If unspecified (0), the default value for the key's
13571 /// algorithm will be used (for AES-GCM, the default value is 16).
13572 pub tag_length: i32,
13573
13574 /// Optional. An optional CRC32C checksum of the
13575 /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
13576 /// If specified,
13577 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13578 /// verify the integrity of the received ciphertext using this checksum.
13579 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13580 /// report an error if the checksum verification fails. If you receive a
13581 /// checksum error, your client should verify that CRC32C(ciphertext) is equal
13582 /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
13583 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13584 /// checksum. Note: This field is defined as int64 for reasons of compatibility
13585 /// across different languages. However, it is a non-negative integer, which
13586 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13587 /// languages that support this type.
13588 ///
13589 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13590 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
13591 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13592
13593 /// Optional. An optional CRC32C checksum of the
13594 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13595 /// If specified,
13596 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13597 /// verify the integrity of the received additional_authenticated_data using
13598 /// this checksum.
13599 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13600 /// report an error if the checksum verification fails. If you receive a
13601 /// checksum error, your client should verify that
13602 /// CRC32C(additional_authenticated_data) is equal to
13603 /// additional_authenticated_data_crc32c, and if so, perform
13604 /// a limited number of retries. A persistent mismatch may indicate an issue in
13605 /// your computation of the CRC32C checksum.
13606 /// Note: This field is defined as int64 for reasons of compatibility across
13607 /// different languages. However, it is a non-negative integer, which will
13608 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13609 /// that support this type.
13610 ///
13611 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13612 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13613 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13614
13615 /// Optional. An optional CRC32C checksum of the
13616 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
13617 /// If specified,
13618 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13619 /// verify the integrity of the received initialization_vector using this
13620 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13621 /// will report an error if the checksum verification fails. If you receive a
13622 /// checksum error, your client should verify that
13623 /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
13624 /// if so, perform a limited number of retries. A persistent mismatch may
13625 /// indicate an issue in your computation of the CRC32C checksum.
13626 /// Note: This field is defined as int64 for reasons of compatibility across
13627 /// different languages. However, it is a non-negative integer, which will
13628 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13629 /// that support this type.
13630 ///
13631 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13632 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
13633 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13634
13635 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13636}
13637
13638impl RawDecryptRequest {
13639 pub fn new() -> Self {
13640 std::default::Default::default()
13641 }
13642
13643 /// Sets the value of [name][crate::model::RawDecryptRequest::name].
13644 ///
13645 /// # Example
13646 /// ```ignore,no_run
13647 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13648 /// let x = RawDecryptRequest::new().set_name("example");
13649 /// ```
13650 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13651 self.name = v.into();
13652 self
13653 }
13654
13655 /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
13656 ///
13657 /// # Example
13658 /// ```ignore,no_run
13659 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13660 /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13661 /// ```
13662 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13663 self.ciphertext = v.into();
13664 self
13665 }
13666
13667 /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
13668 ///
13669 /// # Example
13670 /// ```ignore,no_run
13671 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13672 /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13673 /// ```
13674 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13675 mut self,
13676 v: T,
13677 ) -> Self {
13678 self.additional_authenticated_data = v.into();
13679 self
13680 }
13681
13682 /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
13683 ///
13684 /// # Example
13685 /// ```ignore,no_run
13686 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13687 /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13688 /// ```
13689 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13690 mut self,
13691 v: T,
13692 ) -> Self {
13693 self.initialization_vector = v.into();
13694 self
13695 }
13696
13697 /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
13698 ///
13699 /// # Example
13700 /// ```ignore,no_run
13701 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13702 /// let x = RawDecryptRequest::new().set_tag_length(42);
13703 /// ```
13704 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13705 self.tag_length = v.into();
13706 self
13707 }
13708
13709 /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13710 ///
13711 /// # Example
13712 /// ```ignore,no_run
13713 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13714 /// use wkt::Int64Value;
13715 /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13716 /// ```
13717 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13718 where
13719 T: std::convert::Into<wkt::Int64Value>,
13720 {
13721 self.ciphertext_crc32c = std::option::Option::Some(v.into());
13722 self
13723 }
13724
13725 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13726 ///
13727 /// # Example
13728 /// ```ignore,no_run
13729 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13730 /// use wkt::Int64Value;
13731 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13732 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13733 /// ```
13734 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13735 where
13736 T: std::convert::Into<wkt::Int64Value>,
13737 {
13738 self.ciphertext_crc32c = v.map(|x| x.into());
13739 self
13740 }
13741
13742 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
13743 ///
13744 /// # Example
13745 /// ```ignore,no_run
13746 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13747 /// use wkt::Int64Value;
13748 /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13749 /// ```
13750 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13751 where
13752 T: std::convert::Into<wkt::Int64Value>,
13753 {
13754 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13755 self
13756 }
13757
13758 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
13759 ///
13760 /// # Example
13761 /// ```ignore,no_run
13762 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13763 /// use wkt::Int64Value;
13764 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13765 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13766 /// ```
13767 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13768 mut self,
13769 v: std::option::Option<T>,
13770 ) -> Self
13771 where
13772 T: std::convert::Into<wkt::Int64Value>,
13773 {
13774 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13775 self
13776 }
13777
13778 /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
13779 ///
13780 /// # Example
13781 /// ```ignore,no_run
13782 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13783 /// use wkt::Int64Value;
13784 /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
13785 /// ```
13786 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
13787 where
13788 T: std::convert::Into<wkt::Int64Value>,
13789 {
13790 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
13791 self
13792 }
13793
13794 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
13795 ///
13796 /// # Example
13797 /// ```ignore,no_run
13798 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13799 /// use wkt::Int64Value;
13800 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
13801 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
13802 /// ```
13803 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13804 where
13805 T: std::convert::Into<wkt::Int64Value>,
13806 {
13807 self.initialization_vector_crc32c = v.map(|x| x.into());
13808 self
13809 }
13810}
13811
13812impl wkt::message::Message for RawDecryptRequest {
13813 fn typename() -> &'static str {
13814 "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
13815 }
13816}
13817
13818/// Request message for
13819/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
13820///
13821/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
13822#[derive(Clone, Default, PartialEq)]
13823#[non_exhaustive]
13824pub struct AsymmetricSignRequest {
13825 /// Required. The resource name of the
13826 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13827 /// signing.
13828 ///
13829 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13830 pub name: std::string::String,
13831
13832 /// Optional. The digest of the data to sign. The digest must be produced with
13833 /// the same digest algorithm as specified by the key version's
13834 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
13835 ///
13836 /// This field may not be supplied if
13837 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
13838 /// is supplied.
13839 ///
13840 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
13841 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13842 pub digest: std::option::Option<crate::model::Digest>,
13843
13844 /// Optional. An optional CRC32C checksum of the
13845 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
13846 /// If specified,
13847 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13848 /// verify the integrity of the received
13849 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
13850 /// using this checksum.
13851 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13852 /// report an error if the checksum verification fails. If you receive a
13853 /// checksum error, your client should verify that
13854 /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
13855 /// is equal to
13856 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
13857 /// and if so, perform a limited number of retries. A persistent mismatch may
13858 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13859 /// field is defined as int64 for reasons of compatibility across different
13860 /// languages. However, it is a non-negative integer, which will never exceed
13861 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13862 /// this type.
13863 ///
13864 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
13865 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
13866 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13867 pub digest_crc32c: std::option::Option<wkt::Int64Value>,
13868
13869 /// Optional. The data to sign.
13870 /// It can't be supplied if
13871 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
13872 /// is supplied.
13873 ///
13874 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
13875 pub data: ::bytes::Bytes,
13876
13877 /// Optional. An optional CRC32C checksum of the
13878 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
13879 /// If specified,
13880 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13881 /// verify the integrity of the received
13882 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
13883 /// using this checksum.
13884 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13885 /// report an error if the checksum verification fails. If you receive a
13886 /// checksum error, your client should verify that
13887 /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
13888 /// is equal to
13889 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
13890 /// and if so, perform a limited number of retries. A persistent mismatch may
13891 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13892 /// field is defined as int64 for reasons of compatibility across different
13893 /// languages. However, it is a non-negative integer, which will never exceed
13894 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13895 /// this type.
13896 ///
13897 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
13898 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
13899 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13900 pub data_crc32c: std::option::Option<wkt::Int64Value>,
13901
13902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13903}
13904
13905impl AsymmetricSignRequest {
13906 pub fn new() -> Self {
13907 std::default::Default::default()
13908 }
13909
13910 /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
13911 ///
13912 /// # Example
13913 /// ```ignore,no_run
13914 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13915 /// let x = AsymmetricSignRequest::new().set_name("example");
13916 /// ```
13917 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13918 self.name = v.into();
13919 self
13920 }
13921
13922 /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
13923 ///
13924 /// # Example
13925 /// ```ignore,no_run
13926 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13927 /// use google_cloud_kms_v1::model::Digest;
13928 /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
13929 /// ```
13930 pub fn set_digest<T>(mut self, v: T) -> Self
13931 where
13932 T: std::convert::Into<crate::model::Digest>,
13933 {
13934 self.digest = std::option::Option::Some(v.into());
13935 self
13936 }
13937
13938 /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
13939 ///
13940 /// # Example
13941 /// ```ignore,no_run
13942 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13943 /// use google_cloud_kms_v1::model::Digest;
13944 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
13945 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
13946 /// ```
13947 pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
13948 where
13949 T: std::convert::Into<crate::model::Digest>,
13950 {
13951 self.digest = v.map(|x| x.into());
13952 self
13953 }
13954
13955 /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
13956 ///
13957 /// # Example
13958 /// ```ignore,no_run
13959 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13960 /// use wkt::Int64Value;
13961 /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
13962 /// ```
13963 pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
13964 where
13965 T: std::convert::Into<wkt::Int64Value>,
13966 {
13967 self.digest_crc32c = std::option::Option::Some(v.into());
13968 self
13969 }
13970
13971 /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
13972 ///
13973 /// # Example
13974 /// ```ignore,no_run
13975 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13976 /// use wkt::Int64Value;
13977 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
13978 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
13979 /// ```
13980 pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13981 where
13982 T: std::convert::Into<wkt::Int64Value>,
13983 {
13984 self.digest_crc32c = v.map(|x| x.into());
13985 self
13986 }
13987
13988 /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
13989 ///
13990 /// # Example
13991 /// ```ignore,no_run
13992 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
13993 /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
13994 /// ```
13995 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13996 self.data = v.into();
13997 self
13998 }
13999
14000 /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14001 ///
14002 /// # Example
14003 /// ```ignore,no_run
14004 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14005 /// use wkt::Int64Value;
14006 /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14007 /// ```
14008 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14009 where
14010 T: std::convert::Into<wkt::Int64Value>,
14011 {
14012 self.data_crc32c = std::option::Option::Some(v.into());
14013 self
14014 }
14015
14016 /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14017 ///
14018 /// # Example
14019 /// ```ignore,no_run
14020 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14021 /// use wkt::Int64Value;
14022 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14023 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14024 /// ```
14025 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14026 where
14027 T: std::convert::Into<wkt::Int64Value>,
14028 {
14029 self.data_crc32c = v.map(|x| x.into());
14030 self
14031 }
14032}
14033
14034impl wkt::message::Message for AsymmetricSignRequest {
14035 fn typename() -> &'static str {
14036 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
14037 }
14038}
14039
14040/// Request message for
14041/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
14042///
14043/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
14044#[derive(Clone, Default, PartialEq)]
14045#[non_exhaustive]
14046pub struct AsymmetricDecryptRequest {
14047 /// Required. The resource name of the
14048 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14049 /// decryption.
14050 ///
14051 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14052 pub name: std::string::String,
14053
14054 /// Required. The data encrypted with the named
14055 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
14056 /// OAEP.
14057 ///
14058 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14059 pub ciphertext: ::bytes::Bytes,
14060
14061 /// Optional. An optional CRC32C checksum of the
14062 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
14063 /// If specified,
14064 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14065 /// verify the integrity of the received
14066 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
14067 /// using this checksum.
14068 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14069 /// report an error if the checksum verification fails. If you receive a
14070 /// checksum error, your client should verify that
14071 /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
14072 /// is equal to
14073 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
14074 /// and if so, perform a limited number of retries. A persistent mismatch may
14075 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14076 /// field is defined as int64 for reasons of compatibility across different
14077 /// languages. However, it is a non-negative integer, which will never exceed
14078 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14079 /// this type.
14080 ///
14081 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
14082 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
14083 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14084 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14085
14086 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14087}
14088
14089impl AsymmetricDecryptRequest {
14090 pub fn new() -> Self {
14091 std::default::Default::default()
14092 }
14093
14094 /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
14095 ///
14096 /// # Example
14097 /// ```ignore,no_run
14098 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14099 /// let x = AsymmetricDecryptRequest::new().set_name("example");
14100 /// ```
14101 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14102 self.name = v.into();
14103 self
14104 }
14105
14106 /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
14107 ///
14108 /// # Example
14109 /// ```ignore,no_run
14110 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14111 /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14112 /// ```
14113 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14114 self.ciphertext = v.into();
14115 self
14116 }
14117
14118 /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14119 ///
14120 /// # Example
14121 /// ```ignore,no_run
14122 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14123 /// use wkt::Int64Value;
14124 /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14125 /// ```
14126 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14127 where
14128 T: std::convert::Into<wkt::Int64Value>,
14129 {
14130 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14131 self
14132 }
14133
14134 /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14135 ///
14136 /// # Example
14137 /// ```ignore,no_run
14138 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14139 /// use wkt::Int64Value;
14140 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14141 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14142 /// ```
14143 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14144 where
14145 T: std::convert::Into<wkt::Int64Value>,
14146 {
14147 self.ciphertext_crc32c = v.map(|x| x.into());
14148 self
14149 }
14150}
14151
14152impl wkt::message::Message for AsymmetricDecryptRequest {
14153 fn typename() -> &'static str {
14154 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
14155 }
14156}
14157
14158/// Request message for
14159/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
14160///
14161/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
14162#[derive(Clone, Default, PartialEq)]
14163#[non_exhaustive]
14164pub struct MacSignRequest {
14165 /// Required. The resource name of the
14166 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14167 /// signing.
14168 ///
14169 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14170 pub name: std::string::String,
14171
14172 /// Required. The data to sign. The MAC tag is computed over this data field
14173 /// based on the specific algorithm.
14174 pub data: ::bytes::Bytes,
14175
14176 /// Optional. An optional CRC32C checksum of the
14177 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
14178 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14179 /// will verify the integrity of the received
14180 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
14181 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14182 /// will report an error if the checksum verification fails. If you receive a
14183 /// checksum error, your client should verify that
14184 /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
14185 /// equal to
14186 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
14187 /// and if so, perform a limited number of retries. A persistent mismatch may
14188 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14189 /// field is defined as int64 for reasons of compatibility across different
14190 /// languages. However, it is a non-negative integer, which will never exceed
14191 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14192 /// this type.
14193 ///
14194 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14195 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14196 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
14197 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14198
14199 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14200}
14201
14202impl MacSignRequest {
14203 pub fn new() -> Self {
14204 std::default::Default::default()
14205 }
14206
14207 /// Sets the value of [name][crate::model::MacSignRequest::name].
14208 ///
14209 /// # Example
14210 /// ```ignore,no_run
14211 /// # use google_cloud_kms_v1::model::MacSignRequest;
14212 /// let x = MacSignRequest::new().set_name("example");
14213 /// ```
14214 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14215 self.name = v.into();
14216 self
14217 }
14218
14219 /// Sets the value of [data][crate::model::MacSignRequest::data].
14220 ///
14221 /// # Example
14222 /// ```ignore,no_run
14223 /// # use google_cloud_kms_v1::model::MacSignRequest;
14224 /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14225 /// ```
14226 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14227 self.data = v.into();
14228 self
14229 }
14230
14231 /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14232 ///
14233 /// # Example
14234 /// ```ignore,no_run
14235 /// # use google_cloud_kms_v1::model::MacSignRequest;
14236 /// use wkt::Int64Value;
14237 /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14238 /// ```
14239 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14240 where
14241 T: std::convert::Into<wkt::Int64Value>,
14242 {
14243 self.data_crc32c = std::option::Option::Some(v.into());
14244 self
14245 }
14246
14247 /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14248 ///
14249 /// # Example
14250 /// ```ignore,no_run
14251 /// # use google_cloud_kms_v1::model::MacSignRequest;
14252 /// use wkt::Int64Value;
14253 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14254 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14255 /// ```
14256 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14257 where
14258 T: std::convert::Into<wkt::Int64Value>,
14259 {
14260 self.data_crc32c = v.map(|x| x.into());
14261 self
14262 }
14263}
14264
14265impl wkt::message::Message for MacSignRequest {
14266 fn typename() -> &'static str {
14267 "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
14268 }
14269}
14270
14271/// Request message for
14272/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
14273///
14274/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
14275#[derive(Clone, Default, PartialEq)]
14276#[non_exhaustive]
14277pub struct MacVerifyRequest {
14278 /// Required. The resource name of the
14279 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14280 /// verification.
14281 ///
14282 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14283 pub name: std::string::String,
14284
14285 /// Required. The data used previously as a
14286 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
14287 /// the MAC tag.
14288 ///
14289 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14290 pub data: ::bytes::Bytes,
14291
14292 /// Optional. An optional CRC32C checksum of the
14293 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
14294 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14295 /// will verify the integrity of the received
14296 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
14297 /// this checksum.
14298 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14299 /// report an error if the checksum verification fails. If you receive a
14300 /// checksum error, your client should verify that
14301 /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
14302 /// is equal to
14303 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
14304 /// and if so, perform a limited number of retries. A persistent mismatch may
14305 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14306 /// field is defined as int64 for reasons of compatibility across different
14307 /// languages. However, it is a non-negative integer, which will never exceed
14308 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14309 /// this type.
14310 ///
14311 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14312 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
14313 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
14314 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14315
14316 /// Required. The signature to verify.
14317 pub mac: ::bytes::Bytes,
14318
14319 /// Optional. An optional CRC32C checksum of the
14320 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
14321 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14322 /// will verify the integrity of the received
14323 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
14324 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14325 /// will report an error if the checksum verification fails. If you receive a
14326 /// checksum error, your client should verify that
14327 /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
14328 /// equal to
14329 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
14330 /// and if so, perform a limited number of retries. A persistent mismatch may
14331 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14332 /// field is defined as int64 for reasons of compatibility across different
14333 /// languages. However, it is a non-negative integer, which will never exceed
14334 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14335 /// this type.
14336 ///
14337 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14338 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
14339 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
14340 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
14341
14342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14343}
14344
14345impl MacVerifyRequest {
14346 pub fn new() -> Self {
14347 std::default::Default::default()
14348 }
14349
14350 /// Sets the value of [name][crate::model::MacVerifyRequest::name].
14351 ///
14352 /// # Example
14353 /// ```ignore,no_run
14354 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14355 /// let x = MacVerifyRequest::new().set_name("example");
14356 /// ```
14357 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14358 self.name = v.into();
14359 self
14360 }
14361
14362 /// Sets the value of [data][crate::model::MacVerifyRequest::data].
14363 ///
14364 /// # Example
14365 /// ```ignore,no_run
14366 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14367 /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14368 /// ```
14369 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14370 self.data = v.into();
14371 self
14372 }
14373
14374 /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14375 ///
14376 /// # Example
14377 /// ```ignore,no_run
14378 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14379 /// use wkt::Int64Value;
14380 /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14381 /// ```
14382 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14383 where
14384 T: std::convert::Into<wkt::Int64Value>,
14385 {
14386 self.data_crc32c = std::option::Option::Some(v.into());
14387 self
14388 }
14389
14390 /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14391 ///
14392 /// # Example
14393 /// ```ignore,no_run
14394 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14395 /// use wkt::Int64Value;
14396 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14397 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14398 /// ```
14399 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14400 where
14401 T: std::convert::Into<wkt::Int64Value>,
14402 {
14403 self.data_crc32c = v.map(|x| x.into());
14404 self
14405 }
14406
14407 /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
14408 ///
14409 /// # Example
14410 /// ```ignore,no_run
14411 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14412 /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
14413 /// ```
14414 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14415 self.mac = v.into();
14416 self
14417 }
14418
14419 /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14420 ///
14421 /// # Example
14422 /// ```ignore,no_run
14423 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14424 /// use wkt::Int64Value;
14425 /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
14426 /// ```
14427 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
14428 where
14429 T: std::convert::Into<wkt::Int64Value>,
14430 {
14431 self.mac_crc32c = std::option::Option::Some(v.into());
14432 self
14433 }
14434
14435 /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14436 ///
14437 /// # Example
14438 /// ```ignore,no_run
14439 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14440 /// use wkt::Int64Value;
14441 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
14442 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
14443 /// ```
14444 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14445 where
14446 T: std::convert::Into<wkt::Int64Value>,
14447 {
14448 self.mac_crc32c = v.map(|x| x.into());
14449 self
14450 }
14451}
14452
14453impl wkt::message::Message for MacVerifyRequest {
14454 fn typename() -> &'static str {
14455 "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
14456 }
14457}
14458
14459/// Request message for
14460/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
14461///
14462/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
14463#[derive(Clone, Default, PartialEq)]
14464#[non_exhaustive]
14465pub struct DecapsulateRequest {
14466 /// Required. The resource name of the
14467 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14468 /// decapsulation.
14469 ///
14470 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14471 pub name: std::string::String,
14472
14473 /// Required. The ciphertext produced from encapsulation with the
14474 /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
14475 /// key(s).
14476 ///
14477 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14478 pub ciphertext: ::bytes::Bytes,
14479
14480 /// Optional. A CRC32C checksum of the
14481 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
14482 /// If specified,
14483 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14484 /// verify the integrity of the received
14485 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
14486 /// using this checksum.
14487 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14488 /// report an error if the checksum verification fails. If you receive a
14489 /// checksum error, your client should verify that
14490 /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
14491 /// is equal to
14492 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
14493 /// and if so, perform a limited number of retries. A persistent mismatch may
14494 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14495 /// field is defined as int64 for reasons of compatibility across different
14496 /// languages. However, it is a non-negative integer, which will never exceed
14497 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14498 /// this type.
14499 ///
14500 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
14501 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
14502 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14503 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14504
14505 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14506}
14507
14508impl DecapsulateRequest {
14509 pub fn new() -> Self {
14510 std::default::Default::default()
14511 }
14512
14513 /// Sets the value of [name][crate::model::DecapsulateRequest::name].
14514 ///
14515 /// # Example
14516 /// ```ignore,no_run
14517 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14518 /// let x = DecapsulateRequest::new().set_name("example");
14519 /// ```
14520 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14521 self.name = v.into();
14522 self
14523 }
14524
14525 /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
14526 ///
14527 /// # Example
14528 /// ```ignore,no_run
14529 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14530 /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14531 /// ```
14532 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14533 self.ciphertext = v.into();
14534 self
14535 }
14536
14537 /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14538 ///
14539 /// # Example
14540 /// ```ignore,no_run
14541 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14542 /// use wkt::Int64Value;
14543 /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14544 /// ```
14545 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14546 where
14547 T: std::convert::Into<wkt::Int64Value>,
14548 {
14549 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14550 self
14551 }
14552
14553 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14554 ///
14555 /// # Example
14556 /// ```ignore,no_run
14557 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14558 /// use wkt::Int64Value;
14559 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14560 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14561 /// ```
14562 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14563 where
14564 T: std::convert::Into<wkt::Int64Value>,
14565 {
14566 self.ciphertext_crc32c = v.map(|x| x.into());
14567 self
14568 }
14569}
14570
14571impl wkt::message::Message for DecapsulateRequest {
14572 fn typename() -> &'static str {
14573 "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
14574 }
14575}
14576
14577/// Request message for
14578/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
14579///
14580/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
14581#[derive(Clone, Default, PartialEq)]
14582#[non_exhaustive]
14583pub struct GenerateRandomBytesRequest {
14584 /// The project-specific location in which to generate random bytes.
14585 /// For example, "projects/my-project/locations/us-central1".
14586 pub location: std::string::String,
14587
14588 /// The length in bytes of the amount of randomness to retrieve. Minimum 8
14589 /// bytes, maximum 1024 bytes.
14590 pub length_bytes: i32,
14591
14592 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
14593 /// generating the random data. Currently, only
14594 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
14595 /// supported.
14596 ///
14597 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14598 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14599 pub protection_level: crate::model::ProtectionLevel,
14600
14601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14602}
14603
14604impl GenerateRandomBytesRequest {
14605 pub fn new() -> Self {
14606 std::default::Default::default()
14607 }
14608
14609 /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
14610 ///
14611 /// # Example
14612 /// ```ignore,no_run
14613 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14614 /// let x = GenerateRandomBytesRequest::new().set_location("example");
14615 /// ```
14616 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14617 self.location = v.into();
14618 self
14619 }
14620
14621 /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
14622 ///
14623 /// # Example
14624 /// ```ignore,no_run
14625 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14626 /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
14627 /// ```
14628 pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14629 self.length_bytes = v.into();
14630 self
14631 }
14632
14633 /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
14634 ///
14635 /// # Example
14636 /// ```ignore,no_run
14637 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14638 /// use google_cloud_kms_v1::model::ProtectionLevel;
14639 /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
14640 /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
14641 /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
14642 /// ```
14643 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14644 mut self,
14645 v: T,
14646 ) -> Self {
14647 self.protection_level = v.into();
14648 self
14649 }
14650}
14651
14652impl wkt::message::Message for GenerateRandomBytesRequest {
14653 fn typename() -> &'static str {
14654 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
14655 }
14656}
14657
14658/// Response message for
14659/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
14660///
14661/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
14662#[derive(Clone, Default, PartialEq)]
14663#[non_exhaustive]
14664pub struct EncryptResponse {
14665 /// The resource name of the
14666 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14667 /// encryption. Check this field to verify that the intended resource was used
14668 /// for encryption.
14669 ///
14670 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14671 pub name: std::string::String,
14672
14673 /// The encrypted data.
14674 pub ciphertext: ::bytes::Bytes,
14675
14676 /// Integrity verification field. A CRC32C checksum of the returned
14677 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
14678 /// An integrity check of
14679 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14680 /// can be performed by computing the CRC32C checksum of
14681 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14682 /// and comparing your results to this field. Discard the response in case of
14683 /// non-matching checksum values, and perform a limited number of retries. A
14684 /// persistent mismatch may indicate an issue in your computation of the CRC32C
14685 /// checksum. Note: This field is defined as int64 for reasons of compatibility
14686 /// across different languages. However, it is a non-negative integer, which
14687 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14688 /// languages that support this type.
14689 ///
14690 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
14691 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14692
14693 /// Integrity verification field. A flag indicating whether
14694 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14695 /// was received by
14696 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14697 /// for the integrity verification of the
14698 /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
14699 /// this field indicates either that
14700 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14701 /// was left unset or that it was not delivered to
14702 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14703 /// set
14704 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14705 /// but this field is still false, discard the response and perform a limited
14706 /// number of retries.
14707 ///
14708 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
14709 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
14710 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14711 pub verified_plaintext_crc32c: bool,
14712
14713 /// Integrity verification field. A flag indicating whether
14714 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14715 /// was received by
14716 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14717 /// for the integrity verification of the
14718 /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
14719 /// false value of this field indicates either that
14720 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14721 /// was left unset or that it was not delivered to
14722 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14723 /// set
14724 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14725 /// but this field is still false, discard the response and perform a limited
14726 /// number of retries.
14727 ///
14728 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
14729 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
14730 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14731 pub verified_additional_authenticated_data_crc32c: bool,
14732
14733 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14734 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14735 /// encryption.
14736 ///
14737 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14738 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14739 pub protection_level: crate::model::ProtectionLevel,
14740
14741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14742}
14743
14744impl EncryptResponse {
14745 pub fn new() -> Self {
14746 std::default::Default::default()
14747 }
14748
14749 /// Sets the value of [name][crate::model::EncryptResponse::name].
14750 ///
14751 /// # Example
14752 /// ```ignore,no_run
14753 /// # use google_cloud_kms_v1::model::EncryptResponse;
14754 /// let x = EncryptResponse::new().set_name("example");
14755 /// ```
14756 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14757 self.name = v.into();
14758 self
14759 }
14760
14761 /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
14762 ///
14763 /// # Example
14764 /// ```ignore,no_run
14765 /// # use google_cloud_kms_v1::model::EncryptResponse;
14766 /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14767 /// ```
14768 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14769 self.ciphertext = v.into();
14770 self
14771 }
14772
14773 /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
14774 ///
14775 /// # Example
14776 /// ```ignore,no_run
14777 /// # use google_cloud_kms_v1::model::EncryptResponse;
14778 /// use wkt::Int64Value;
14779 /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14780 /// ```
14781 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14782 where
14783 T: std::convert::Into<wkt::Int64Value>,
14784 {
14785 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14786 self
14787 }
14788
14789 /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
14790 ///
14791 /// # Example
14792 /// ```ignore,no_run
14793 /// # use google_cloud_kms_v1::model::EncryptResponse;
14794 /// use wkt::Int64Value;
14795 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14796 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14797 /// ```
14798 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14799 where
14800 T: std::convert::Into<wkt::Int64Value>,
14801 {
14802 self.ciphertext_crc32c = v.map(|x| x.into());
14803 self
14804 }
14805
14806 /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
14807 ///
14808 /// # Example
14809 /// ```ignore,no_run
14810 /// # use google_cloud_kms_v1::model::EncryptResponse;
14811 /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
14812 /// ```
14813 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14814 self.verified_plaintext_crc32c = v.into();
14815 self
14816 }
14817
14818 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
14819 ///
14820 /// # Example
14821 /// ```ignore,no_run
14822 /// # use google_cloud_kms_v1::model::EncryptResponse;
14823 /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
14824 /// ```
14825 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
14826 mut self,
14827 v: T,
14828 ) -> Self {
14829 self.verified_additional_authenticated_data_crc32c = v.into();
14830 self
14831 }
14832
14833 /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
14834 ///
14835 /// # Example
14836 /// ```ignore,no_run
14837 /// # use google_cloud_kms_v1::model::EncryptResponse;
14838 /// use google_cloud_kms_v1::model::ProtectionLevel;
14839 /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
14840 /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
14841 /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
14842 /// ```
14843 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14844 mut self,
14845 v: T,
14846 ) -> Self {
14847 self.protection_level = v.into();
14848 self
14849 }
14850}
14851
14852impl wkt::message::Message for EncryptResponse {
14853 fn typename() -> &'static str {
14854 "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
14855 }
14856}
14857
14858/// Response message for
14859/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
14860///
14861/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
14862#[derive(Clone, Default, PartialEq)]
14863#[non_exhaustive]
14864pub struct DecryptResponse {
14865 /// The decrypted data originally supplied in
14866 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
14867 ///
14868 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
14869 pub plaintext: ::bytes::Bytes,
14870
14871 /// Integrity verification field. A CRC32C checksum of the returned
14872 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
14873 /// An integrity check of
14874 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
14875 /// can be performed by computing the CRC32C checksum of
14876 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
14877 /// and comparing your results to this field. Discard the response in case of
14878 /// non-matching checksum values, and perform a limited number of retries. A
14879 /// persistent mismatch may indicate an issue in your computation of the CRC32C
14880 /// checksum. Note: receiving this response message indicates that
14881 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
14882 /// successfully decrypt the
14883 /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
14884 /// field is defined as int64 for reasons of compatibility across different
14885 /// languages. However, it is a non-negative integer, which will never exceed
14886 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14887 /// this type.
14888 ///
14889 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
14890 /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
14891 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14892 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
14893
14894 /// Whether the Decryption was performed using the primary key version.
14895 pub used_primary: bool,
14896
14897 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14898 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14899 /// decryption.
14900 ///
14901 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14902 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14903 pub protection_level: crate::model::ProtectionLevel,
14904
14905 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14906}
14907
14908impl DecryptResponse {
14909 pub fn new() -> Self {
14910 std::default::Default::default()
14911 }
14912
14913 /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
14914 ///
14915 /// # Example
14916 /// ```ignore,no_run
14917 /// # use google_cloud_kms_v1::model::DecryptResponse;
14918 /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
14919 /// ```
14920 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14921 self.plaintext = v.into();
14922 self
14923 }
14924
14925 /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
14926 ///
14927 /// # Example
14928 /// ```ignore,no_run
14929 /// # use google_cloud_kms_v1::model::DecryptResponse;
14930 /// use wkt::Int64Value;
14931 /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
14932 /// ```
14933 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
14934 where
14935 T: std::convert::Into<wkt::Int64Value>,
14936 {
14937 self.plaintext_crc32c = std::option::Option::Some(v.into());
14938 self
14939 }
14940
14941 /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
14942 ///
14943 /// # Example
14944 /// ```ignore,no_run
14945 /// # use google_cloud_kms_v1::model::DecryptResponse;
14946 /// use wkt::Int64Value;
14947 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
14948 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
14949 /// ```
14950 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14951 where
14952 T: std::convert::Into<wkt::Int64Value>,
14953 {
14954 self.plaintext_crc32c = v.map(|x| x.into());
14955 self
14956 }
14957
14958 /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
14959 ///
14960 /// # Example
14961 /// ```ignore,no_run
14962 /// # use google_cloud_kms_v1::model::DecryptResponse;
14963 /// let x = DecryptResponse::new().set_used_primary(true);
14964 /// ```
14965 pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14966 self.used_primary = v.into();
14967 self
14968 }
14969
14970 /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
14971 ///
14972 /// # Example
14973 /// ```ignore,no_run
14974 /// # use google_cloud_kms_v1::model::DecryptResponse;
14975 /// use google_cloud_kms_v1::model::ProtectionLevel;
14976 /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
14977 /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
14978 /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
14979 /// ```
14980 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14981 mut self,
14982 v: T,
14983 ) -> Self {
14984 self.protection_level = v.into();
14985 self
14986 }
14987}
14988
14989impl wkt::message::Message for DecryptResponse {
14990 fn typename() -> &'static str {
14991 "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
14992 }
14993}
14994
14995/// Response message for
14996/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
14997///
14998/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
14999#[derive(Clone, Default, PartialEq)]
15000#[non_exhaustive]
15001pub struct RawEncryptResponse {
15002 /// The encrypted data. In the case of AES-GCM, the authentication tag
15003 /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
15004 /// bytes at the end of this field.
15005 ///
15006 /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
15007 pub ciphertext: ::bytes::Bytes,
15008
15009 /// The initialization vector (IV) generated by the service during
15010 /// encryption. This value must be stored and provided in
15011 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
15012 /// at decryption time.
15013 ///
15014 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
15015 pub initialization_vector: ::bytes::Bytes,
15016
15017 /// The length of the authentication tag that is appended to
15018 /// the end of the ciphertext.
15019 pub tag_length: i32,
15020
15021 /// Integrity verification field. A CRC32C checksum of the returned
15022 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
15023 /// An integrity check of ciphertext can be performed by computing the CRC32C
15024 /// checksum of ciphertext and comparing your results to this field. Discard
15025 /// the response in case of non-matching checksum values, and perform a limited
15026 /// number of retries. A persistent mismatch may indicate an issue in your
15027 /// computation of the CRC32C checksum. Note: This field is defined as int64
15028 /// for reasons of compatibility across different languages. However, it is a
15029 /// non-negative integer, which will never exceed 2^32-1, and can be safely
15030 /// downconverted to uint32 in languages that support this type.
15031 ///
15032 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
15033 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15034
15035 /// Integrity verification field. A CRC32C checksum of the returned
15036 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
15037 /// An integrity check of initialization_vector can be performed by computing
15038 /// the CRC32C checksum of initialization_vector and comparing your results to
15039 /// this field. Discard the response in case of non-matching checksum values,
15040 /// and perform a limited number of retries. A persistent mismatch may indicate
15041 /// an issue in your computation of the CRC32C checksum. Note: This field is
15042 /// defined as int64 for reasons of compatibility across different languages.
15043 /// However, it is a non-negative integer, which will never exceed 2^32-1, and
15044 /// can be safely downconverted to uint32 in languages that support this type.
15045 ///
15046 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
15047 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
15048
15049 /// Integrity verification field. A flag indicating whether
15050 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15051 /// was received by
15052 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15053 /// for the integrity verification of the plaintext. A false value of this
15054 /// field indicates either that
15055 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15056 /// was left unset or that it was not delivered to
15057 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15058 /// set
15059 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15060 /// but this field is still false, discard the response and perform a limited
15061 /// number of retries.
15062 ///
15063 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15064 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
15065 pub verified_plaintext_crc32c: bool,
15066
15067 /// Integrity verification field. A flag indicating whether
15068 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15069 /// was received by
15070 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15071 /// for the integrity verification of additional_authenticated_data. A false
15072 /// value of this field indicates either that //
15073 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15074 /// was left unset or that it was not delivered to
15075 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15076 /// set
15077 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15078 /// but this field is still false, discard the response and perform a limited
15079 /// number of retries.
15080 ///
15081 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15082 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
15083 pub verified_additional_authenticated_data_crc32c: bool,
15084
15085 /// Integrity verification field. A flag indicating whether
15086 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15087 /// was received by
15088 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15089 /// for the integrity verification of initialization_vector. A false value of
15090 /// this field indicates either that
15091 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15092 /// was left unset or that it was not delivered to
15093 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15094 /// set
15095 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15096 /// but this field is still false, discard the response and perform a limited
15097 /// number of retries.
15098 ///
15099 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15100 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
15101 pub verified_initialization_vector_crc32c: bool,
15102
15103 /// The resource name of the
15104 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15105 /// encryption. Check this field to verify that the intended resource was used
15106 /// for encryption.
15107 ///
15108 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15109 pub name: std::string::String,
15110
15111 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15112 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15113 /// encryption.
15114 ///
15115 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15116 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15117 pub protection_level: crate::model::ProtectionLevel,
15118
15119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15120}
15121
15122impl RawEncryptResponse {
15123 pub fn new() -> Self {
15124 std::default::Default::default()
15125 }
15126
15127 /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
15128 ///
15129 /// # Example
15130 /// ```ignore,no_run
15131 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15132 /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15133 /// ```
15134 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15135 self.ciphertext = v.into();
15136 self
15137 }
15138
15139 /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
15140 ///
15141 /// # Example
15142 /// ```ignore,no_run
15143 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15144 /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
15145 /// ```
15146 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
15147 mut self,
15148 v: T,
15149 ) -> Self {
15150 self.initialization_vector = v.into();
15151 self
15152 }
15153
15154 /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
15155 ///
15156 /// # Example
15157 /// ```ignore,no_run
15158 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15159 /// let x = RawEncryptResponse::new().set_tag_length(42);
15160 /// ```
15161 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15162 self.tag_length = v.into();
15163 self
15164 }
15165
15166 /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15167 ///
15168 /// # Example
15169 /// ```ignore,no_run
15170 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15171 /// use wkt::Int64Value;
15172 /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15173 /// ```
15174 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15175 where
15176 T: std::convert::Into<wkt::Int64Value>,
15177 {
15178 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15179 self
15180 }
15181
15182 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15183 ///
15184 /// # Example
15185 /// ```ignore,no_run
15186 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15187 /// use wkt::Int64Value;
15188 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15189 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15190 /// ```
15191 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15192 where
15193 T: std::convert::Into<wkt::Int64Value>,
15194 {
15195 self.ciphertext_crc32c = v.map(|x| x.into());
15196 self
15197 }
15198
15199 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15200 ///
15201 /// # Example
15202 /// ```ignore,no_run
15203 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15204 /// use wkt::Int64Value;
15205 /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
15206 /// ```
15207 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
15208 where
15209 T: std::convert::Into<wkt::Int64Value>,
15210 {
15211 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
15212 self
15213 }
15214
15215 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15216 ///
15217 /// # Example
15218 /// ```ignore,no_run
15219 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15220 /// use wkt::Int64Value;
15221 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
15222 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
15223 /// ```
15224 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15225 where
15226 T: std::convert::Into<wkt::Int64Value>,
15227 {
15228 self.initialization_vector_crc32c = v.map(|x| x.into());
15229 self
15230 }
15231
15232 /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
15233 ///
15234 /// # Example
15235 /// ```ignore,no_run
15236 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15237 /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
15238 /// ```
15239 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15240 self.verified_plaintext_crc32c = v.into();
15241 self
15242 }
15243
15244 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
15245 ///
15246 /// # Example
15247 /// ```ignore,no_run
15248 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15249 /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15250 /// ```
15251 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15252 mut self,
15253 v: T,
15254 ) -> Self {
15255 self.verified_additional_authenticated_data_crc32c = v.into();
15256 self
15257 }
15258
15259 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
15260 ///
15261 /// # Example
15262 /// ```ignore,no_run
15263 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15264 /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
15265 /// ```
15266 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15267 mut self,
15268 v: T,
15269 ) -> Self {
15270 self.verified_initialization_vector_crc32c = v.into();
15271 self
15272 }
15273
15274 /// Sets the value of [name][crate::model::RawEncryptResponse::name].
15275 ///
15276 /// # Example
15277 /// ```ignore,no_run
15278 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15279 /// let x = RawEncryptResponse::new().set_name("example");
15280 /// ```
15281 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15282 self.name = v.into();
15283 self
15284 }
15285
15286 /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
15287 ///
15288 /// # Example
15289 /// ```ignore,no_run
15290 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15291 /// use google_cloud_kms_v1::model::ProtectionLevel;
15292 /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15293 /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15294 /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
15295 /// ```
15296 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15297 mut self,
15298 v: T,
15299 ) -> Self {
15300 self.protection_level = v.into();
15301 self
15302 }
15303}
15304
15305impl wkt::message::Message for RawEncryptResponse {
15306 fn typename() -> &'static str {
15307 "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
15308 }
15309}
15310
15311/// Response message for
15312/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
15313///
15314/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
15315#[derive(Clone, Default, PartialEq)]
15316#[non_exhaustive]
15317pub struct RawDecryptResponse {
15318 /// The decrypted data.
15319 pub plaintext: ::bytes::Bytes,
15320
15321 /// Integrity verification field. A CRC32C checksum of the returned
15322 /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
15323 /// An integrity check of plaintext can be performed by computing the CRC32C
15324 /// checksum of plaintext and comparing your results to this field. Discard the
15325 /// response in case of non-matching checksum values, and perform a limited
15326 /// number of retries. A persistent mismatch may indicate an issue in your
15327 /// computation of the CRC32C checksum. Note: receiving this response message
15328 /// indicates that
15329 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15330 /// successfully decrypt the
15331 /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
15332 /// Note: This field is defined as int64 for reasons of compatibility across
15333 /// different languages. However, it is a non-negative integer, which will
15334 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
15335 /// that support this type.
15336 ///
15337 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15338 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
15339 /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
15340 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15341
15342 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15343 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15344 /// decryption.
15345 ///
15346 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15347 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15348 pub protection_level: crate::model::ProtectionLevel,
15349
15350 /// Integrity verification field. A flag indicating whether
15351 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15352 /// was received by
15353 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15354 /// for the integrity verification of the ciphertext. A false value of this
15355 /// field indicates either that
15356 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15357 /// was left unset or that it was not delivered to
15358 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15359 /// set
15360 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15361 /// but this field is still false, discard the response and perform a limited
15362 /// number of retries.
15363 ///
15364 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15365 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
15366 pub verified_ciphertext_crc32c: bool,
15367
15368 /// Integrity verification field. A flag indicating whether
15369 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15370 /// was received by
15371 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15372 /// for the integrity verification of additional_authenticated_data. A false
15373 /// value of this field indicates either that //
15374 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15375 /// was left unset or that it was not delivered to
15376 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15377 /// set
15378 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15379 /// but this field is still false, discard the response and perform a limited
15380 /// number of retries.
15381 ///
15382 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15383 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
15384 pub verified_additional_authenticated_data_crc32c: bool,
15385
15386 /// Integrity verification field. A flag indicating whether
15387 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15388 /// was received by
15389 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15390 /// for the integrity verification of initialization_vector. A false value of
15391 /// this field indicates either that
15392 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15393 /// was left unset or that it was not delivered to
15394 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15395 /// set
15396 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15397 /// but this field is still false, discard the response and perform a limited
15398 /// number of retries.
15399 ///
15400 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15401 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
15402 pub verified_initialization_vector_crc32c: bool,
15403
15404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15405}
15406
15407impl RawDecryptResponse {
15408 pub fn new() -> Self {
15409 std::default::Default::default()
15410 }
15411
15412 /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
15413 ///
15414 /// # Example
15415 /// ```ignore,no_run
15416 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15417 /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15418 /// ```
15419 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15420 self.plaintext = v.into();
15421 self
15422 }
15423
15424 /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15425 ///
15426 /// # Example
15427 /// ```ignore,no_run
15428 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15429 /// use wkt::Int64Value;
15430 /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15431 /// ```
15432 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15433 where
15434 T: std::convert::Into<wkt::Int64Value>,
15435 {
15436 self.plaintext_crc32c = std::option::Option::Some(v.into());
15437 self
15438 }
15439
15440 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15441 ///
15442 /// # Example
15443 /// ```ignore,no_run
15444 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15445 /// use wkt::Int64Value;
15446 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15447 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15448 /// ```
15449 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15450 where
15451 T: std::convert::Into<wkt::Int64Value>,
15452 {
15453 self.plaintext_crc32c = v.map(|x| x.into());
15454 self
15455 }
15456
15457 /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
15458 ///
15459 /// # Example
15460 /// ```ignore,no_run
15461 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15462 /// use google_cloud_kms_v1::model::ProtectionLevel;
15463 /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15464 /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15465 /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
15466 /// ```
15467 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15468 mut self,
15469 v: T,
15470 ) -> Self {
15471 self.protection_level = v.into();
15472 self
15473 }
15474
15475 /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
15476 ///
15477 /// # Example
15478 /// ```ignore,no_run
15479 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15480 /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
15481 /// ```
15482 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15483 self.verified_ciphertext_crc32c = v.into();
15484 self
15485 }
15486
15487 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
15488 ///
15489 /// # Example
15490 /// ```ignore,no_run
15491 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15492 /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15493 /// ```
15494 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15495 mut self,
15496 v: T,
15497 ) -> Self {
15498 self.verified_additional_authenticated_data_crc32c = v.into();
15499 self
15500 }
15501
15502 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
15503 ///
15504 /// # Example
15505 /// ```ignore,no_run
15506 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15507 /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
15508 /// ```
15509 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15510 mut self,
15511 v: T,
15512 ) -> Self {
15513 self.verified_initialization_vector_crc32c = v.into();
15514 self
15515 }
15516}
15517
15518impl wkt::message::Message for RawDecryptResponse {
15519 fn typename() -> &'static str {
15520 "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
15521 }
15522}
15523
15524/// Response message for
15525/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
15526///
15527/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
15528#[derive(Clone, Default, PartialEq)]
15529#[non_exhaustive]
15530pub struct AsymmetricSignResponse {
15531 /// The created signature.
15532 pub signature: ::bytes::Bytes,
15533
15534 /// Integrity verification field. A CRC32C checksum of the returned
15535 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
15536 /// An integrity check of
15537 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15538 /// can be performed by computing the CRC32C checksum of
15539 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15540 /// and comparing your results to this field. Discard the response in case of
15541 /// non-matching checksum values, and perform a limited number of retries. A
15542 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15543 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15544 /// across different languages. However, it is a non-negative integer, which
15545 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15546 /// languages that support this type.
15547 ///
15548 /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
15549 pub signature_crc32c: std::option::Option<wkt::Int64Value>,
15550
15551 /// Integrity verification field. A flag indicating whether
15552 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15553 /// was received by
15554 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15555 /// for the integrity verification of the
15556 /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
15557 /// of this field indicates either that
15558 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15559 /// was left unset or that it was not delivered to
15560 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15561 /// set
15562 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15563 /// but this field is still false, discard the response and perform a limited
15564 /// number of retries.
15565 ///
15566 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
15567 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
15568 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15569 pub verified_digest_crc32c: bool,
15570
15571 /// The resource name of the
15572 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15573 /// Check this field to verify that the intended resource was used for signing.
15574 ///
15575 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15576 pub name: std::string::String,
15577
15578 /// Integrity verification field. A flag indicating whether
15579 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15580 /// was received by
15581 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15582 /// for the integrity verification of the
15583 /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
15584 /// this field indicates either that
15585 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15586 /// was left unset or that it was not delivered to
15587 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15588 /// set
15589 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15590 /// but this field is still false, discard the response and perform a limited
15591 /// number of retries.
15592 ///
15593 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
15594 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
15595 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15596 pub verified_data_crc32c: bool,
15597
15598 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15599 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15600 ///
15601 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15602 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15603 pub protection_level: crate::model::ProtectionLevel,
15604
15605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15606}
15607
15608impl AsymmetricSignResponse {
15609 pub fn new() -> Self {
15610 std::default::Default::default()
15611 }
15612
15613 /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
15614 ///
15615 /// # Example
15616 /// ```ignore,no_run
15617 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15618 /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
15619 /// ```
15620 pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15621 self.signature = v.into();
15622 self
15623 }
15624
15625 /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15626 ///
15627 /// # Example
15628 /// ```ignore,no_run
15629 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15630 /// use wkt::Int64Value;
15631 /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
15632 /// ```
15633 pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
15634 where
15635 T: std::convert::Into<wkt::Int64Value>,
15636 {
15637 self.signature_crc32c = std::option::Option::Some(v.into());
15638 self
15639 }
15640
15641 /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15642 ///
15643 /// # Example
15644 /// ```ignore,no_run
15645 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15646 /// use wkt::Int64Value;
15647 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
15648 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
15649 /// ```
15650 pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15651 where
15652 T: std::convert::Into<wkt::Int64Value>,
15653 {
15654 self.signature_crc32c = v.map(|x| x.into());
15655 self
15656 }
15657
15658 /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
15659 ///
15660 /// # Example
15661 /// ```ignore,no_run
15662 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15663 /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
15664 /// ```
15665 pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15666 self.verified_digest_crc32c = v.into();
15667 self
15668 }
15669
15670 /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
15671 ///
15672 /// # Example
15673 /// ```ignore,no_run
15674 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15675 /// let x = AsymmetricSignResponse::new().set_name("example");
15676 /// ```
15677 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15678 self.name = v.into();
15679 self
15680 }
15681
15682 /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
15683 ///
15684 /// # Example
15685 /// ```ignore,no_run
15686 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15687 /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
15688 /// ```
15689 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15690 self.verified_data_crc32c = v.into();
15691 self
15692 }
15693
15694 /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
15695 ///
15696 /// # Example
15697 /// ```ignore,no_run
15698 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15699 /// use google_cloud_kms_v1::model::ProtectionLevel;
15700 /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
15701 /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
15702 /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
15703 /// ```
15704 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15705 mut self,
15706 v: T,
15707 ) -> Self {
15708 self.protection_level = v.into();
15709 self
15710 }
15711}
15712
15713impl wkt::message::Message for AsymmetricSignResponse {
15714 fn typename() -> &'static str {
15715 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
15716 }
15717}
15718
15719/// Response message for
15720/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
15721///
15722/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
15723#[derive(Clone, Default, PartialEq)]
15724#[non_exhaustive]
15725pub struct AsymmetricDecryptResponse {
15726 /// The decrypted data originally encrypted with the matching public key.
15727 pub plaintext: ::bytes::Bytes,
15728
15729 /// Integrity verification field. A CRC32C checksum of the returned
15730 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
15731 /// An integrity check of
15732 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15733 /// can be performed by computing the CRC32C checksum of
15734 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15735 /// and comparing your results to this field. Discard the response in case of
15736 /// non-matching checksum values, and perform a limited number of retries. A
15737 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15738 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15739 /// across different languages. However, it is a non-negative integer, which
15740 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15741 /// languages that support this type.
15742 ///
15743 /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
15744 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15745
15746 /// Integrity verification field. A flag indicating whether
15747 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
15748 /// was received by
15749 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15750 /// for the integrity verification of the
15751 /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
15752 /// false value of this field indicates either that
15753 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
15754 /// was left unset or that it was not delivered to
15755 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15756 /// set
15757 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
15758 /// but this field is still false, discard the response and perform a limited
15759 /// number of retries.
15760 ///
15761 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
15762 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
15763 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15764 pub verified_ciphertext_crc32c: bool,
15765
15766 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15767 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15768 /// decryption.
15769 ///
15770 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15771 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15772 pub protection_level: crate::model::ProtectionLevel,
15773
15774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15775}
15776
15777impl AsymmetricDecryptResponse {
15778 pub fn new() -> Self {
15779 std::default::Default::default()
15780 }
15781
15782 /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
15783 ///
15784 /// # Example
15785 /// ```ignore,no_run
15786 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15787 /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15788 /// ```
15789 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15790 self.plaintext = v.into();
15791 self
15792 }
15793
15794 /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
15795 ///
15796 /// # Example
15797 /// ```ignore,no_run
15798 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15799 /// use wkt::Int64Value;
15800 /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15801 /// ```
15802 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15803 where
15804 T: std::convert::Into<wkt::Int64Value>,
15805 {
15806 self.plaintext_crc32c = std::option::Option::Some(v.into());
15807 self
15808 }
15809
15810 /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
15811 ///
15812 /// # Example
15813 /// ```ignore,no_run
15814 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15815 /// use wkt::Int64Value;
15816 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15817 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15818 /// ```
15819 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15820 where
15821 T: std::convert::Into<wkt::Int64Value>,
15822 {
15823 self.plaintext_crc32c = v.map(|x| x.into());
15824 self
15825 }
15826
15827 /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
15828 ///
15829 /// # Example
15830 /// ```ignore,no_run
15831 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15832 /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
15833 /// ```
15834 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15835 self.verified_ciphertext_crc32c = v.into();
15836 self
15837 }
15838
15839 /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
15840 ///
15841 /// # Example
15842 /// ```ignore,no_run
15843 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
15844 /// use google_cloud_kms_v1::model::ProtectionLevel;
15845 /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15846 /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15847 /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
15848 /// ```
15849 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15850 mut self,
15851 v: T,
15852 ) -> Self {
15853 self.protection_level = v.into();
15854 self
15855 }
15856}
15857
15858impl wkt::message::Message for AsymmetricDecryptResponse {
15859 fn typename() -> &'static str {
15860 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
15861 }
15862}
15863
15864/// Response message for
15865/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
15866///
15867/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
15868#[derive(Clone, Default, PartialEq)]
15869#[non_exhaustive]
15870pub struct MacSignResponse {
15871 /// The resource name of the
15872 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15873 /// Check this field to verify that the intended resource was used for signing.
15874 ///
15875 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15876 pub name: std::string::String,
15877
15878 /// The created signature.
15879 pub mac: ::bytes::Bytes,
15880
15881 /// Integrity verification field. A CRC32C checksum of the returned
15882 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
15883 /// integrity check of
15884 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
15885 /// performed by computing the CRC32C checksum of
15886 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
15887 /// comparing your results to this field. Discard the response in case of
15888 /// non-matching checksum values, and perform a limited number of retries. A
15889 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15890 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15891 /// across different languages. However, it is a non-negative integer, which
15892 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15893 /// languages that support this type.
15894 ///
15895 /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
15896 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
15897
15898 /// Integrity verification field. A flag indicating whether
15899 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
15900 /// was received by
15901 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15902 /// for the integrity verification of the
15903 /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
15904 /// field indicates either that
15905 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
15906 /// was left unset or that it was not delivered to
15907 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15908 /// set
15909 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
15910 /// but this field is still false, discard the response and perform a limited
15911 /// number of retries.
15912 ///
15913 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15914 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
15915 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
15916 pub verified_data_crc32c: bool,
15917
15918 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15919 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15920 ///
15921 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15922 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15923 pub protection_level: crate::model::ProtectionLevel,
15924
15925 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15926}
15927
15928impl MacSignResponse {
15929 pub fn new() -> Self {
15930 std::default::Default::default()
15931 }
15932
15933 /// Sets the value of [name][crate::model::MacSignResponse::name].
15934 ///
15935 /// # Example
15936 /// ```ignore,no_run
15937 /// # use google_cloud_kms_v1::model::MacSignResponse;
15938 /// let x = MacSignResponse::new().set_name("example");
15939 /// ```
15940 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15941 self.name = v.into();
15942 self
15943 }
15944
15945 /// Sets the value of [mac][crate::model::MacSignResponse::mac].
15946 ///
15947 /// # Example
15948 /// ```ignore,no_run
15949 /// # use google_cloud_kms_v1::model::MacSignResponse;
15950 /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
15951 /// ```
15952 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15953 self.mac = v.into();
15954 self
15955 }
15956
15957 /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
15958 ///
15959 /// # Example
15960 /// ```ignore,no_run
15961 /// # use google_cloud_kms_v1::model::MacSignResponse;
15962 /// use wkt::Int64Value;
15963 /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
15964 /// ```
15965 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
15966 where
15967 T: std::convert::Into<wkt::Int64Value>,
15968 {
15969 self.mac_crc32c = std::option::Option::Some(v.into());
15970 self
15971 }
15972
15973 /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
15974 ///
15975 /// # Example
15976 /// ```ignore,no_run
15977 /// # use google_cloud_kms_v1::model::MacSignResponse;
15978 /// use wkt::Int64Value;
15979 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
15980 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
15981 /// ```
15982 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15983 where
15984 T: std::convert::Into<wkt::Int64Value>,
15985 {
15986 self.mac_crc32c = v.map(|x| x.into());
15987 self
15988 }
15989
15990 /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
15991 ///
15992 /// # Example
15993 /// ```ignore,no_run
15994 /// # use google_cloud_kms_v1::model::MacSignResponse;
15995 /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
15996 /// ```
15997 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15998 self.verified_data_crc32c = v.into();
15999 self
16000 }
16001
16002 /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
16003 ///
16004 /// # Example
16005 /// ```ignore,no_run
16006 /// # use google_cloud_kms_v1::model::MacSignResponse;
16007 /// use google_cloud_kms_v1::model::ProtectionLevel;
16008 /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
16009 /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16010 /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
16011 /// ```
16012 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16013 mut self,
16014 v: T,
16015 ) -> Self {
16016 self.protection_level = v.into();
16017 self
16018 }
16019}
16020
16021impl wkt::message::Message for MacSignResponse {
16022 fn typename() -> &'static str {
16023 "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
16024 }
16025}
16026
16027/// Response message for
16028/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
16029///
16030/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
16031#[derive(Clone, Default, PartialEq)]
16032#[non_exhaustive]
16033pub struct MacVerifyResponse {
16034 /// The resource name of the
16035 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16036 /// verification. Check this field to verify that the intended resource was
16037 /// used for verification.
16038 ///
16039 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16040 pub name: std::string::String,
16041
16042 /// This field indicates whether or not the verification operation for
16043 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
16044 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
16045 /// successful.
16046 ///
16047 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16048 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16049 pub success: bool,
16050
16051 /// Integrity verification field. A flag indicating whether
16052 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16053 /// was received by
16054 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16055 /// for the integrity verification of the
16056 /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
16057 /// field indicates either that
16058 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16059 /// was left unset or that it was not delivered to
16060 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16061 /// set
16062 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16063 /// but this field is still false, discard the response and perform a limited
16064 /// number of retries.
16065 ///
16066 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16067 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16068 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
16069 pub verified_data_crc32c: bool,
16070
16071 /// Integrity verification field. A flag indicating whether
16072 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16073 /// was received by
16074 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16075 /// for the integrity verification of the
16076 /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
16077 /// field indicates either that
16078 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16079 /// was left unset or that it was not delivered to
16080 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16081 /// set
16082 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16083 /// but this field is still false, discard the response and perform a limited
16084 /// number of retries.
16085 ///
16086 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16087 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16088 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
16089 pub verified_mac_crc32c: bool,
16090
16091 /// Integrity verification field. This value is used for the integrity
16092 /// verification of [MacVerifyResponse.success]. If the value of this field
16093 /// contradicts the value of [MacVerifyResponse.success], discard the response
16094 /// and perform a limited number of retries.
16095 pub verified_success_integrity: bool,
16096
16097 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16098 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16099 /// verification.
16100 ///
16101 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16102 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16103 pub protection_level: crate::model::ProtectionLevel,
16104
16105 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16106}
16107
16108impl MacVerifyResponse {
16109 pub fn new() -> Self {
16110 std::default::Default::default()
16111 }
16112
16113 /// Sets the value of [name][crate::model::MacVerifyResponse::name].
16114 ///
16115 /// # Example
16116 /// ```ignore,no_run
16117 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16118 /// let x = MacVerifyResponse::new().set_name("example");
16119 /// ```
16120 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16121 self.name = v.into();
16122 self
16123 }
16124
16125 /// Sets the value of [success][crate::model::MacVerifyResponse::success].
16126 ///
16127 /// # Example
16128 /// ```ignore,no_run
16129 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16130 /// let x = MacVerifyResponse::new().set_success(true);
16131 /// ```
16132 pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16133 self.success = v.into();
16134 self
16135 }
16136
16137 /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
16138 ///
16139 /// # Example
16140 /// ```ignore,no_run
16141 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16142 /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
16143 /// ```
16144 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16145 self.verified_data_crc32c = v.into();
16146 self
16147 }
16148
16149 /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
16150 ///
16151 /// # Example
16152 /// ```ignore,no_run
16153 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16154 /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
16155 /// ```
16156 pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16157 self.verified_mac_crc32c = v.into();
16158 self
16159 }
16160
16161 /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
16162 ///
16163 /// # Example
16164 /// ```ignore,no_run
16165 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16166 /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
16167 /// ```
16168 pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16169 self.verified_success_integrity = v.into();
16170 self
16171 }
16172
16173 /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
16174 ///
16175 /// # Example
16176 /// ```ignore,no_run
16177 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16178 /// use google_cloud_kms_v1::model::ProtectionLevel;
16179 /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
16180 /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
16181 /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
16182 /// ```
16183 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16184 mut self,
16185 v: T,
16186 ) -> Self {
16187 self.protection_level = v.into();
16188 self
16189 }
16190}
16191
16192impl wkt::message::Message for MacVerifyResponse {
16193 fn typename() -> &'static str {
16194 "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
16195 }
16196}
16197
16198/// Response message for
16199/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
16200///
16201/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
16202#[derive(Clone, Default, PartialEq)]
16203#[non_exhaustive]
16204pub struct DecapsulateResponse {
16205 /// The resource name of the
16206 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16207 /// decapsulation. Check this field to verify that the intended resource was
16208 /// used for decapsulation.
16209 ///
16210 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16211 pub name: std::string::String,
16212
16213 /// The decapsulated shared_secret originally encapsulated with the matching
16214 /// public key.
16215 pub shared_secret: ::bytes::Bytes,
16216
16217 /// Integrity verification field. A CRC32C checksum of the returned
16218 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
16219 /// An integrity check of
16220 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16221 /// can be performed by computing the CRC32C checksum of
16222 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16223 /// and comparing your results to this field. Discard the response in case of
16224 /// non-matching checksum values, and perform a limited number of retries. A
16225 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16226 /// checksum. Note: receiving this response message indicates that
16227 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16228 /// successfully decrypt the
16229 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
16230 /// field is defined as int64 for reasons of compatibility across different
16231 /// languages. However, it is a non-negative integer, which will never exceed
16232 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
16233 /// this type.
16234 ///
16235 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16236 /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
16237 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16238 pub shared_secret_crc32c: std::option::Option<i64>,
16239
16240 /// Integrity verification field. A flag indicating whether
16241 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16242 /// was received by
16243 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16244 /// for the integrity verification of the
16245 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
16246 /// value of this field indicates either that
16247 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16248 /// was left unset or that it was not delivered to
16249 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16250 /// set
16251 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16252 /// but this field is still false, discard the response and perform a limited
16253 /// number of retries.
16254 ///
16255 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16256 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
16257 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16258 pub verified_ciphertext_crc32c: bool,
16259
16260 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16261 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16262 /// decapsulation.
16263 ///
16264 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16265 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16266 pub protection_level: crate::model::ProtectionLevel,
16267
16268 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16269}
16270
16271impl DecapsulateResponse {
16272 pub fn new() -> Self {
16273 std::default::Default::default()
16274 }
16275
16276 /// Sets the value of [name][crate::model::DecapsulateResponse::name].
16277 ///
16278 /// # Example
16279 /// ```ignore,no_run
16280 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16281 /// let x = DecapsulateResponse::new().set_name("example");
16282 /// ```
16283 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16284 self.name = v.into();
16285 self
16286 }
16287
16288 /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
16289 ///
16290 /// # Example
16291 /// ```ignore,no_run
16292 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16293 /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
16294 /// ```
16295 pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16296 self.shared_secret = v.into();
16297 self
16298 }
16299
16300 /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16301 ///
16302 /// # Example
16303 /// ```ignore,no_run
16304 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16305 /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
16306 /// ```
16307 pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
16308 where
16309 T: std::convert::Into<i64>,
16310 {
16311 self.shared_secret_crc32c = std::option::Option::Some(v.into());
16312 self
16313 }
16314
16315 /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16316 ///
16317 /// # Example
16318 /// ```ignore,no_run
16319 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16320 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
16321 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
16322 /// ```
16323 pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16324 where
16325 T: std::convert::Into<i64>,
16326 {
16327 self.shared_secret_crc32c = v.map(|x| x.into());
16328 self
16329 }
16330
16331 /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
16332 ///
16333 /// # Example
16334 /// ```ignore,no_run
16335 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16336 /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
16337 /// ```
16338 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16339 self.verified_ciphertext_crc32c = v.into();
16340 self
16341 }
16342
16343 /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
16344 ///
16345 /// # Example
16346 /// ```ignore,no_run
16347 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16348 /// use google_cloud_kms_v1::model::ProtectionLevel;
16349 /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
16350 /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
16351 /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
16352 /// ```
16353 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16354 mut self,
16355 v: T,
16356 ) -> Self {
16357 self.protection_level = v.into();
16358 self
16359 }
16360}
16361
16362impl wkt::message::Message for DecapsulateResponse {
16363 fn typename() -> &'static str {
16364 "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
16365 }
16366}
16367
16368/// Response message for
16369/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
16370///
16371/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
16372#[derive(Clone, Default, PartialEq)]
16373#[non_exhaustive]
16374pub struct GenerateRandomBytesResponse {
16375 /// The generated data.
16376 pub data: ::bytes::Bytes,
16377
16378 /// Integrity verification field. A CRC32C checksum of the returned
16379 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
16380 /// An integrity check of
16381 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16382 /// can be performed by computing the CRC32C checksum of
16383 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16384 /// and comparing your results to this field. Discard the response in case of
16385 /// non-matching checksum values, and perform a limited number of retries. A
16386 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16387 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16388 /// across different languages. However, it is a non-negative integer, which
16389 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16390 /// languages that support this type.
16391 ///
16392 /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
16393 pub data_crc32c: std::option::Option<wkt::Int64Value>,
16394
16395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16396}
16397
16398impl GenerateRandomBytesResponse {
16399 pub fn new() -> Self {
16400 std::default::Default::default()
16401 }
16402
16403 /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
16404 ///
16405 /// # Example
16406 /// ```ignore,no_run
16407 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16408 /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
16409 /// ```
16410 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16411 self.data = v.into();
16412 self
16413 }
16414
16415 /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16416 ///
16417 /// # Example
16418 /// ```ignore,no_run
16419 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16420 /// use wkt::Int64Value;
16421 /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
16422 /// ```
16423 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
16424 where
16425 T: std::convert::Into<wkt::Int64Value>,
16426 {
16427 self.data_crc32c = std::option::Option::Some(v.into());
16428 self
16429 }
16430
16431 /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16432 ///
16433 /// # Example
16434 /// ```ignore,no_run
16435 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16436 /// use wkt::Int64Value;
16437 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
16438 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
16439 /// ```
16440 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16441 where
16442 T: std::convert::Into<wkt::Int64Value>,
16443 {
16444 self.data_crc32c = v.map(|x| x.into());
16445 self
16446 }
16447}
16448
16449impl wkt::message::Message for GenerateRandomBytesResponse {
16450 fn typename() -> &'static str {
16451 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
16452 }
16453}
16454
16455/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
16456///
16457/// [google.cloud.kms.v1.Digest]: crate::model::Digest
16458#[derive(Clone, Default, PartialEq)]
16459#[non_exhaustive]
16460pub struct Digest {
16461 /// Required. The message digest.
16462 pub digest: std::option::Option<crate::model::digest::Digest>,
16463
16464 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16465}
16466
16467impl Digest {
16468 pub fn new() -> Self {
16469 std::default::Default::default()
16470 }
16471
16472 /// Sets the value of [digest][crate::model::Digest::digest].
16473 ///
16474 /// Note that all the setters affecting `digest` are mutually
16475 /// exclusive.
16476 ///
16477 /// # Example
16478 /// ```ignore,no_run
16479 /// # use google_cloud_kms_v1::model::Digest;
16480 /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
16481 /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
16482 /// ```
16483 pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
16484 mut self,
16485 v: T,
16486 ) -> Self {
16487 self.digest = v.into();
16488 self
16489 }
16490
16491 /// The value of [digest][crate::model::Digest::digest]
16492 /// if it holds a `Sha256`, `None` if the field is not set or
16493 /// holds a different branch.
16494 pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
16495 #[allow(unreachable_patterns)]
16496 self.digest.as_ref().and_then(|v| match v {
16497 crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
16498 _ => std::option::Option::None,
16499 })
16500 }
16501
16502 /// Sets the value of [digest][crate::model::Digest::digest]
16503 /// to hold a `Sha256`.
16504 ///
16505 /// Note that all the setters affecting `digest` are
16506 /// mutually exclusive.
16507 ///
16508 /// # Example
16509 /// ```ignore,no_run
16510 /// # use google_cloud_kms_v1::model::Digest;
16511 /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
16512 /// assert!(x.sha256().is_some());
16513 /// assert!(x.sha384().is_none());
16514 /// assert!(x.sha512().is_none());
16515 /// ```
16516 pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16517 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
16518 self
16519 }
16520
16521 /// The value of [digest][crate::model::Digest::digest]
16522 /// if it holds a `Sha384`, `None` if the field is not set or
16523 /// holds a different branch.
16524 pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
16525 #[allow(unreachable_patterns)]
16526 self.digest.as_ref().and_then(|v| match v {
16527 crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
16528 _ => std::option::Option::None,
16529 })
16530 }
16531
16532 /// Sets the value of [digest][crate::model::Digest::digest]
16533 /// to hold a `Sha384`.
16534 ///
16535 /// Note that all the setters affecting `digest` are
16536 /// mutually exclusive.
16537 ///
16538 /// # Example
16539 /// ```ignore,no_run
16540 /// # use google_cloud_kms_v1::model::Digest;
16541 /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
16542 /// assert!(x.sha384().is_some());
16543 /// assert!(x.sha256().is_none());
16544 /// assert!(x.sha512().is_none());
16545 /// ```
16546 pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16547 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
16548 self
16549 }
16550
16551 /// The value of [digest][crate::model::Digest::digest]
16552 /// if it holds a `Sha512`, `None` if the field is not set or
16553 /// holds a different branch.
16554 pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
16555 #[allow(unreachable_patterns)]
16556 self.digest.as_ref().and_then(|v| match v {
16557 crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
16558 _ => std::option::Option::None,
16559 })
16560 }
16561
16562 /// Sets the value of [digest][crate::model::Digest::digest]
16563 /// to hold a `Sha512`.
16564 ///
16565 /// Note that all the setters affecting `digest` are
16566 /// mutually exclusive.
16567 ///
16568 /// # Example
16569 /// ```ignore,no_run
16570 /// # use google_cloud_kms_v1::model::Digest;
16571 /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
16572 /// assert!(x.sha512().is_some());
16573 /// assert!(x.sha256().is_none());
16574 /// assert!(x.sha384().is_none());
16575 /// ```
16576 pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16577 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
16578 self
16579 }
16580}
16581
16582impl wkt::message::Message for Digest {
16583 fn typename() -> &'static str {
16584 "type.googleapis.com/google.cloud.kms.v1.Digest"
16585 }
16586}
16587
16588/// Defines additional types related to [Digest].
16589pub mod digest {
16590 #[allow(unused_imports)]
16591 use super::*;
16592
16593 /// Required. The message digest.
16594 #[derive(Clone, Debug, PartialEq)]
16595 #[non_exhaustive]
16596 pub enum Digest {
16597 /// A message digest produced with the SHA-256 algorithm.
16598 Sha256(::bytes::Bytes),
16599 /// A message digest produced with the SHA-384 algorithm.
16600 Sha384(::bytes::Bytes),
16601 /// A message digest produced with the SHA-512 algorithm.
16602 Sha512(::bytes::Bytes),
16603 }
16604}
16605
16606/// Cloud KMS metadata for the given
16607/// [google.cloud.location.Location][google.cloud.location.Location].
16608///
16609/// [google.cloud.location.Location]: google_cloud_location::model::Location
16610#[derive(Clone, Default, PartialEq)]
16611#[non_exhaustive]
16612pub struct LocationMetadata {
16613 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16614 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16615 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
16616 /// location.
16617 ///
16618 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16619 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16620 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
16621 pub hsm_available: bool,
16622
16623 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16624 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16625 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
16626 /// this location.
16627 ///
16628 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16629 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16630 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
16631 pub ekm_available: bool,
16632
16633 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16634 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16635 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
16636 /// can be created in this location.
16637 ///
16638 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16639 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16640 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
16641 pub hsm_single_tenant_available: bool,
16642
16643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16644}
16645
16646impl LocationMetadata {
16647 pub fn new() -> Self {
16648 std::default::Default::default()
16649 }
16650
16651 /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
16652 ///
16653 /// # Example
16654 /// ```ignore,no_run
16655 /// # use google_cloud_kms_v1::model::LocationMetadata;
16656 /// let x = LocationMetadata::new().set_hsm_available(true);
16657 /// ```
16658 pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16659 self.hsm_available = v.into();
16660 self
16661 }
16662
16663 /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
16664 ///
16665 /// # Example
16666 /// ```ignore,no_run
16667 /// # use google_cloud_kms_v1::model::LocationMetadata;
16668 /// let x = LocationMetadata::new().set_ekm_available(true);
16669 /// ```
16670 pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16671 self.ekm_available = v.into();
16672 self
16673 }
16674
16675 /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
16676 ///
16677 /// # Example
16678 /// ```ignore,no_run
16679 /// # use google_cloud_kms_v1::model::LocationMetadata;
16680 /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
16681 /// ```
16682 pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16683 self.hsm_single_tenant_available = v.into();
16684 self
16685 }
16686}
16687
16688impl wkt::message::Message for LocationMetadata {
16689 fn typename() -> &'static str {
16690 "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
16691 }
16692}
16693
16694/// Represents the metadata of the
16695/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]
16696/// long-running operation.
16697///
16698/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
16699#[derive(Clone, Default, PartialEq)]
16700#[non_exhaustive]
16701pub struct DeleteCryptoKeyMetadata {
16702 /// Output only. The resource name of the
16703 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] created as a result
16704 /// of this operation, in the format
16705 /// `projects/*/locations/*/retiredResources/*`.
16706 ///
16707 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
16708 pub retired_resource: std::string::String,
16709
16710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16711}
16712
16713impl DeleteCryptoKeyMetadata {
16714 pub fn new() -> Self {
16715 std::default::Default::default()
16716 }
16717
16718 /// Sets the value of [retired_resource][crate::model::DeleteCryptoKeyMetadata::retired_resource].
16719 ///
16720 /// # Example
16721 /// ```ignore,no_run
16722 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyMetadata;
16723 /// let x = DeleteCryptoKeyMetadata::new().set_retired_resource("example");
16724 /// ```
16725 pub fn set_retired_resource<T: std::convert::Into<std::string::String>>(
16726 mut self,
16727 v: T,
16728 ) -> Self {
16729 self.retired_resource = v.into();
16730 self
16731 }
16732}
16733
16734impl wkt::message::Message for DeleteCryptoKeyMetadata {
16735 fn typename() -> &'static str {
16736 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyMetadata"
16737 }
16738}
16739
16740/// Represents the metadata of the
16741/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]
16742/// long-running operation.
16743///
16744/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
16745#[derive(Clone, Default, PartialEq)]
16746#[non_exhaustive]
16747pub struct DeleteCryptoKeyVersionMetadata {
16748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16749}
16750
16751impl DeleteCryptoKeyVersionMetadata {
16752 pub fn new() -> Self {
16753 std::default::Default::default()
16754 }
16755}
16756
16757impl wkt::message::Message for DeleteCryptoKeyVersionMetadata {
16758 fn typename() -> &'static str {
16759 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionMetadata"
16760 }
16761}
16762
16763/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
16764/// cryptographic operations are performed. For more information, see [Protection
16765/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
16766///
16767/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16768///
16769/// # Working with unknown values
16770///
16771/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16772/// additional enum variants at any time. Adding new variants is not considered
16773/// a breaking change. Applications should write their code in anticipation of:
16774///
16775/// - New values appearing in future releases of the client library, **and**
16776/// - New values received dynamically, without application changes.
16777///
16778/// Please consult the [Working with enums] section in the user guide for some
16779/// guidelines.
16780///
16781/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16782#[derive(Clone, Debug, PartialEq)]
16783#[non_exhaustive]
16784pub enum ProtectionLevel {
16785 /// Not specified.
16786 Unspecified,
16787 /// Crypto operations are performed in software.
16788 Software,
16789 /// Crypto operations are performed in a Hardware Security Module.
16790 Hsm,
16791 /// Crypto operations are performed by an external key manager.
16792 External,
16793 /// Crypto operations are performed in an EKM-over-VPC backend.
16794 ExternalVpc,
16795 /// Crypto operations are performed in a single-tenant HSM.
16796 HsmSingleTenant,
16797 /// If set, the enum was initialized with an unknown value.
16798 ///
16799 /// Applications can examine the value using [ProtectionLevel::value] or
16800 /// [ProtectionLevel::name].
16801 UnknownValue(protection_level::UnknownValue),
16802}
16803
16804#[doc(hidden)]
16805pub mod protection_level {
16806 #[allow(unused_imports)]
16807 use super::*;
16808 #[derive(Clone, Debug, PartialEq)]
16809 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16810}
16811
16812impl ProtectionLevel {
16813 /// Gets the enum value.
16814 ///
16815 /// Returns `None` if the enum contains an unknown value deserialized from
16816 /// the string representation of enums.
16817 pub fn value(&self) -> std::option::Option<i32> {
16818 match self {
16819 Self::Unspecified => std::option::Option::Some(0),
16820 Self::Software => std::option::Option::Some(1),
16821 Self::Hsm => std::option::Option::Some(2),
16822 Self::External => std::option::Option::Some(3),
16823 Self::ExternalVpc => std::option::Option::Some(4),
16824 Self::HsmSingleTenant => std::option::Option::Some(5),
16825 Self::UnknownValue(u) => u.0.value(),
16826 }
16827 }
16828
16829 /// Gets the enum value as a string.
16830 ///
16831 /// Returns `None` if the enum contains an unknown value deserialized from
16832 /// the integer representation of enums.
16833 pub fn name(&self) -> std::option::Option<&str> {
16834 match self {
16835 Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
16836 Self::Software => std::option::Option::Some("SOFTWARE"),
16837 Self::Hsm => std::option::Option::Some("HSM"),
16838 Self::External => std::option::Option::Some("EXTERNAL"),
16839 Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
16840 Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
16841 Self::UnknownValue(u) => u.0.name(),
16842 }
16843 }
16844}
16845
16846impl std::default::Default for ProtectionLevel {
16847 fn default() -> Self {
16848 use std::convert::From;
16849 Self::from(0)
16850 }
16851}
16852
16853impl std::fmt::Display for ProtectionLevel {
16854 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16855 wkt::internal::display_enum(f, self.name(), self.value())
16856 }
16857}
16858
16859impl std::convert::From<i32> for ProtectionLevel {
16860 fn from(value: i32) -> Self {
16861 match value {
16862 0 => Self::Unspecified,
16863 1 => Self::Software,
16864 2 => Self::Hsm,
16865 3 => Self::External,
16866 4 => Self::ExternalVpc,
16867 5 => Self::HsmSingleTenant,
16868 _ => Self::UnknownValue(protection_level::UnknownValue(
16869 wkt::internal::UnknownEnumValue::Integer(value),
16870 )),
16871 }
16872 }
16873}
16874
16875impl std::convert::From<&str> for ProtectionLevel {
16876 fn from(value: &str) -> Self {
16877 use std::string::ToString;
16878 match value {
16879 "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
16880 "SOFTWARE" => Self::Software,
16881 "HSM" => Self::Hsm,
16882 "EXTERNAL" => Self::External,
16883 "EXTERNAL_VPC" => Self::ExternalVpc,
16884 "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
16885 _ => Self::UnknownValue(protection_level::UnknownValue(
16886 wkt::internal::UnknownEnumValue::String(value.to_string()),
16887 )),
16888 }
16889 }
16890}
16891
16892impl serde::ser::Serialize for ProtectionLevel {
16893 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16894 where
16895 S: serde::Serializer,
16896 {
16897 match self {
16898 Self::Unspecified => serializer.serialize_i32(0),
16899 Self::Software => serializer.serialize_i32(1),
16900 Self::Hsm => serializer.serialize_i32(2),
16901 Self::External => serializer.serialize_i32(3),
16902 Self::ExternalVpc => serializer.serialize_i32(4),
16903 Self::HsmSingleTenant => serializer.serialize_i32(5),
16904 Self::UnknownValue(u) => u.0.serialize(serializer),
16905 }
16906 }
16907}
16908
16909impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
16910 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16911 where
16912 D: serde::Deserializer<'de>,
16913 {
16914 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
16915 ".google.cloud.kms.v1.ProtectionLevel",
16916 ))
16917 }
16918}
16919
16920/// Describes the reason for a data access. Please refer to
16921/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
16922/// for the detailed semantic meaning of justification reason codes.
16923///
16924/// # Working with unknown values
16925///
16926/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16927/// additional enum variants at any time. Adding new variants is not considered
16928/// a breaking change. Applications should write their code in anticipation of:
16929///
16930/// - New values appearing in future releases of the client library, **and**
16931/// - New values received dynamically, without application changes.
16932///
16933/// Please consult the [Working with enums] section in the user guide for some
16934/// guidelines.
16935///
16936/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16937#[derive(Clone, Debug, PartialEq)]
16938#[non_exhaustive]
16939pub enum AccessReason {
16940 /// Unspecified access reason.
16941 ReasonUnspecified,
16942 /// Customer-initiated support.
16943 CustomerInitiatedSupport,
16944 /// Google-initiated access for system management and troubleshooting.
16945 GoogleInitiatedService,
16946 /// Google-initiated access in response to a legal request or legal process.
16947 ThirdPartyDataRequest,
16948 /// Google-initiated access for security, fraud, abuse, or compliance purposes.
16949 GoogleInitiatedReview,
16950 /// Customer uses their account to perform any access to their own data which
16951 /// their IAM policy authorizes.
16952 CustomerInitiatedAccess,
16953 /// Google systems access customer data to help optimize the structure of the
16954 /// data or quality for future uses by the customer.
16955 GoogleInitiatedSystemOperation,
16956 /// No reason is expected for this key request.
16957 ReasonNotExpected,
16958 /// Deprecated: This code is no longer generated by
16959 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
16960 /// available in both Key Access Justifications and Access Transparency logs
16961 /// provide customer-visible signals of emergency access in more precise
16962 /// contexts.
16963 ///
16964 /// Customer uses their account to perform any access to their own data which
16965 /// their IAM policy authorizes, and one of the following is true:
16966 ///
16967 /// * A Google administrator has reset the root-access account associated with
16968 /// the user's organization within the past 7 days.
16969 /// * A Google-initiated emergency access operation has interacted with a
16970 /// resource in the same project or folder as the currently accessed resource
16971 /// within the past 7 days.
16972 #[deprecated]
16973 ModifiedCustomerInitiatedAccess,
16974 /// Deprecated: This code is no longer generated by
16975 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
16976 /// available in both Key Access Justifications and Access Transparency logs
16977 /// provide customer-visible signals of emergency access in more precise
16978 /// contexts.
16979 ///
16980 /// Google systems access customer data to help optimize the structure of the
16981 /// data or quality for future uses by the customer, and one of the following
16982 /// is true:
16983 ///
16984 /// * A Google administrator has reset the root-access account associated with
16985 /// the user's organization within the past 7 days.
16986 /// * A Google-initiated emergency access operation has interacted with a
16987 /// resource in the same project or folder as the currently accessed resource
16988 /// within the past 7 days.
16989 #[deprecated]
16990 ModifiedGoogleInitiatedSystemOperation,
16991 /// Google-initiated access to maintain system reliability.
16992 GoogleResponseToProductionAlert,
16993 /// One of the following operations is being executed while simultaneously
16994 /// encountering an internal technical issue which prevented a more precise
16995 /// justification code from being generated:
16996 ///
16997 /// * Your account has been used to perform any access to your own data which
16998 /// your IAM policy authorizes.
16999 /// * An automated Google system operates on encrypted customer data which your
17000 /// IAM policy authorizes.
17001 /// * Customer-initiated Google support access.
17002 /// * Google-initiated support access to protect system reliability.
17003 CustomerAuthorizedWorkflowServicing,
17004 /// If set, the enum was initialized with an unknown value.
17005 ///
17006 /// Applications can examine the value using [AccessReason::value] or
17007 /// [AccessReason::name].
17008 UnknownValue(access_reason::UnknownValue),
17009}
17010
17011#[doc(hidden)]
17012pub mod access_reason {
17013 #[allow(unused_imports)]
17014 use super::*;
17015 #[derive(Clone, Debug, PartialEq)]
17016 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17017}
17018
17019impl AccessReason {
17020 /// Gets the enum value.
17021 ///
17022 /// Returns `None` if the enum contains an unknown value deserialized from
17023 /// the string representation of enums.
17024 pub fn value(&self) -> std::option::Option<i32> {
17025 match self {
17026 Self::ReasonUnspecified => std::option::Option::Some(0),
17027 Self::CustomerInitiatedSupport => std::option::Option::Some(1),
17028 Self::GoogleInitiatedService => std::option::Option::Some(2),
17029 Self::ThirdPartyDataRequest => std::option::Option::Some(3),
17030 Self::GoogleInitiatedReview => std::option::Option::Some(4),
17031 Self::CustomerInitiatedAccess => std::option::Option::Some(5),
17032 Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
17033 Self::ReasonNotExpected => std::option::Option::Some(7),
17034 Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
17035 Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
17036 Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
17037 Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
17038 Self::UnknownValue(u) => u.0.value(),
17039 }
17040 }
17041
17042 /// Gets the enum value as a string.
17043 ///
17044 /// Returns `None` if the enum contains an unknown value deserialized from
17045 /// the integer representation of enums.
17046 pub fn name(&self) -> std::option::Option<&str> {
17047 match self {
17048 Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
17049 Self::CustomerInitiatedSupport => {
17050 std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
17051 }
17052 Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
17053 Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
17054 Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
17055 Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
17056 Self::GoogleInitiatedSystemOperation => {
17057 std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
17058 }
17059 Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
17060 Self::ModifiedCustomerInitiatedAccess => {
17061 std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
17062 }
17063 Self::ModifiedGoogleInitiatedSystemOperation => {
17064 std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
17065 }
17066 Self::GoogleResponseToProductionAlert => {
17067 std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
17068 }
17069 Self::CustomerAuthorizedWorkflowServicing => {
17070 std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
17071 }
17072 Self::UnknownValue(u) => u.0.name(),
17073 }
17074 }
17075}
17076
17077impl std::default::Default for AccessReason {
17078 fn default() -> Self {
17079 use std::convert::From;
17080 Self::from(0)
17081 }
17082}
17083
17084impl std::fmt::Display for AccessReason {
17085 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17086 wkt::internal::display_enum(f, self.name(), self.value())
17087 }
17088}
17089
17090impl std::convert::From<i32> for AccessReason {
17091 fn from(value: i32) -> Self {
17092 match value {
17093 0 => Self::ReasonUnspecified,
17094 1 => Self::CustomerInitiatedSupport,
17095 2 => Self::GoogleInitiatedService,
17096 3 => Self::ThirdPartyDataRequest,
17097 4 => Self::GoogleInitiatedReview,
17098 5 => Self::CustomerInitiatedAccess,
17099 6 => Self::GoogleInitiatedSystemOperation,
17100 7 => Self::ReasonNotExpected,
17101 8 => Self::ModifiedCustomerInitiatedAccess,
17102 9 => Self::ModifiedGoogleInitiatedSystemOperation,
17103 10 => Self::GoogleResponseToProductionAlert,
17104 11 => Self::CustomerAuthorizedWorkflowServicing,
17105 _ => Self::UnknownValue(access_reason::UnknownValue(
17106 wkt::internal::UnknownEnumValue::Integer(value),
17107 )),
17108 }
17109 }
17110}
17111
17112impl std::convert::From<&str> for AccessReason {
17113 fn from(value: &str) -> Self {
17114 use std::string::ToString;
17115 match value {
17116 "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
17117 "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
17118 "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
17119 "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
17120 "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
17121 "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
17122 "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
17123 "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
17124 "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
17125 "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
17126 Self::ModifiedGoogleInitiatedSystemOperation
17127 }
17128 "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
17129 "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
17130 _ => Self::UnknownValue(access_reason::UnknownValue(
17131 wkt::internal::UnknownEnumValue::String(value.to_string()),
17132 )),
17133 }
17134 }
17135}
17136
17137impl serde::ser::Serialize for AccessReason {
17138 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17139 where
17140 S: serde::Serializer,
17141 {
17142 match self {
17143 Self::ReasonUnspecified => serializer.serialize_i32(0),
17144 Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
17145 Self::GoogleInitiatedService => serializer.serialize_i32(2),
17146 Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
17147 Self::GoogleInitiatedReview => serializer.serialize_i32(4),
17148 Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
17149 Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
17150 Self::ReasonNotExpected => serializer.serialize_i32(7),
17151 Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
17152 Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
17153 Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
17154 Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
17155 Self::UnknownValue(u) => u.0.serialize(serializer),
17156 }
17157 }
17158}
17159
17160impl<'de> serde::de::Deserialize<'de> for AccessReason {
17161 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17162 where
17163 D: serde::Deserializer<'de>,
17164 {
17165 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
17166 ".google.cloud.kms.v1.AccessReason",
17167 ))
17168 }
17169}