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` or
589 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
590 ///
591 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
592 pub name: std::string::String,
593
594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
595}
596
597impl GetAutokeyConfigRequest {
598 pub fn new() -> Self {
599 std::default::Default::default()
600 }
601
602 /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
603 ///
604 /// # Example
605 /// ```ignore,no_run
606 /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
607 /// let x = GetAutokeyConfigRequest::new().set_name("example");
608 /// ```
609 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
610 self.name = v.into();
611 self
612 }
613}
614
615impl wkt::message::Message for GetAutokeyConfigRequest {
616 fn typename() -> &'static str {
617 "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
618 }
619}
620
621/// Cloud KMS Autokey configuration for a folder.
622#[derive(Clone, Default, PartialEq)]
623#[non_exhaustive]
624pub struct AutokeyConfig {
625 /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
626 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
627 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
628 ///
629 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
630 pub name: std::string::String,
631
632 /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
633 /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
634 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
635 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
636 /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
637 /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
638 /// this key project. Once configured, for Cloud KMS Autokey to function
639 /// properly, this key project must have the Cloud KMS API activated and the
640 /// Cloud KMS Service Agent for this key project must be granted the
641 /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
642 /// key project field will clear the configuration.
643 ///
644 /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
645 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
646 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
647 pub key_project: std::string::String,
648
649 /// Output only. The state for the AutokeyConfig.
650 pub state: crate::model::autokey_config::State,
651
652 /// Optional. A checksum computed by the server based on the value of other
653 /// fields. This may be sent on update requests to ensure that the client has
654 /// an up-to-date value before proceeding. The request will be rejected with an
655 /// ABORTED error on a mismatched etag.
656 pub etag: std::string::String,
657
658 /// Optional. KeyProjectResolutionMode for the AutokeyConfig.
659 /// Valid values are `DEDICATED_KEY_PROJECT`, `RESOURCE_PROJECT`, or
660 /// `DISABLED`.
661 pub key_project_resolution_mode: crate::model::autokey_config::KeyProjectResolutionMode,
662
663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
664}
665
666impl AutokeyConfig {
667 pub fn new() -> Self {
668 std::default::Default::default()
669 }
670
671 /// Sets the value of [name][crate::model::AutokeyConfig::name].
672 ///
673 /// # Example
674 /// ```ignore,no_run
675 /// # use google_cloud_kms_v1::model::AutokeyConfig;
676 /// let x = AutokeyConfig::new().set_name("example");
677 /// ```
678 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
679 self.name = v.into();
680 self
681 }
682
683 /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
684 ///
685 /// # Example
686 /// ```ignore,no_run
687 /// # use google_cloud_kms_v1::model::AutokeyConfig;
688 /// let x = AutokeyConfig::new().set_key_project("example");
689 /// ```
690 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
691 self.key_project = v.into();
692 self
693 }
694
695 /// Sets the value of [state][crate::model::AutokeyConfig::state].
696 ///
697 /// # Example
698 /// ```ignore,no_run
699 /// # use google_cloud_kms_v1::model::AutokeyConfig;
700 /// use google_cloud_kms_v1::model::autokey_config::State;
701 /// let x0 = AutokeyConfig::new().set_state(State::Active);
702 /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
703 /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
704 /// ```
705 pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
706 mut self,
707 v: T,
708 ) -> Self {
709 self.state = v.into();
710 self
711 }
712
713 /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
714 ///
715 /// # Example
716 /// ```ignore,no_run
717 /// # use google_cloud_kms_v1::model::AutokeyConfig;
718 /// let x = AutokeyConfig::new().set_etag("example");
719 /// ```
720 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
721 self.etag = v.into();
722 self
723 }
724
725 /// Sets the value of [key_project_resolution_mode][crate::model::AutokeyConfig::key_project_resolution_mode].
726 ///
727 /// # Example
728 /// ```ignore,no_run
729 /// # use google_cloud_kms_v1::model::AutokeyConfig;
730 /// use google_cloud_kms_v1::model::autokey_config::KeyProjectResolutionMode;
731 /// let x0 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::DedicatedKeyProject);
732 /// let x1 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::ResourceProject);
733 /// let x2 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::Disabled);
734 /// ```
735 pub fn set_key_project_resolution_mode<
736 T: std::convert::Into<crate::model::autokey_config::KeyProjectResolutionMode>,
737 >(
738 mut self,
739 v: T,
740 ) -> Self {
741 self.key_project_resolution_mode = v.into();
742 self
743 }
744}
745
746impl wkt::message::Message for AutokeyConfig {
747 fn typename() -> &'static str {
748 "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
749 }
750}
751
752/// Defines additional types related to [AutokeyConfig].
753pub mod autokey_config {
754 #[allow(unused_imports)]
755 use super::*;
756
757 /// The states AutokeyConfig can be in.
758 ///
759 /// # Working with unknown values
760 ///
761 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
762 /// additional enum variants at any time. Adding new variants is not considered
763 /// a breaking change. Applications should write their code in anticipation of:
764 ///
765 /// - New values appearing in future releases of the client library, **and**
766 /// - New values received dynamically, without application changes.
767 ///
768 /// Please consult the [Working with enums] section in the user guide for some
769 /// guidelines.
770 ///
771 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
772 #[derive(Clone, Debug, PartialEq)]
773 #[non_exhaustive]
774 pub enum State {
775 /// The state of the AutokeyConfig is unspecified.
776 Unspecified,
777 /// The AutokeyConfig is currently active.
778 Active,
779 /// A previously configured key project has been deleted and the current
780 /// AutokeyConfig is unusable.
781 KeyProjectDeleted,
782 /// The AutokeyConfig is not yet initialized or has been reset to its default
783 /// uninitialized state.
784 Uninitialized,
785 /// The service account lacks the necessary permissions in the key project to
786 /// configure Autokey.
787 KeyProjectPermissionDenied,
788 /// If set, the enum was initialized with an unknown value.
789 ///
790 /// Applications can examine the value using [State::value] or
791 /// [State::name].
792 UnknownValue(state::UnknownValue),
793 }
794
795 #[doc(hidden)]
796 pub mod state {
797 #[allow(unused_imports)]
798 use super::*;
799 #[derive(Clone, Debug, PartialEq)]
800 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
801 }
802
803 impl State {
804 /// Gets the enum value.
805 ///
806 /// Returns `None` if the enum contains an unknown value deserialized from
807 /// the string representation of enums.
808 pub fn value(&self) -> std::option::Option<i32> {
809 match self {
810 Self::Unspecified => std::option::Option::Some(0),
811 Self::Active => std::option::Option::Some(1),
812 Self::KeyProjectDeleted => std::option::Option::Some(2),
813 Self::Uninitialized => std::option::Option::Some(3),
814 Self::KeyProjectPermissionDenied => std::option::Option::Some(4),
815 Self::UnknownValue(u) => u.0.value(),
816 }
817 }
818
819 /// Gets the enum value as a string.
820 ///
821 /// Returns `None` if the enum contains an unknown value deserialized from
822 /// the integer representation of enums.
823 pub fn name(&self) -> std::option::Option<&str> {
824 match self {
825 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
826 Self::Active => std::option::Option::Some("ACTIVE"),
827 Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
828 Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
829 Self::KeyProjectPermissionDenied => {
830 std::option::Option::Some("KEY_PROJECT_PERMISSION_DENIED")
831 }
832 Self::UnknownValue(u) => u.0.name(),
833 }
834 }
835 }
836
837 impl std::default::Default for State {
838 fn default() -> Self {
839 use std::convert::From;
840 Self::from(0)
841 }
842 }
843
844 impl std::fmt::Display for State {
845 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
846 wkt::internal::display_enum(f, self.name(), self.value())
847 }
848 }
849
850 impl std::convert::From<i32> for State {
851 fn from(value: i32) -> Self {
852 match value {
853 0 => Self::Unspecified,
854 1 => Self::Active,
855 2 => Self::KeyProjectDeleted,
856 3 => Self::Uninitialized,
857 4 => Self::KeyProjectPermissionDenied,
858 _ => Self::UnknownValue(state::UnknownValue(
859 wkt::internal::UnknownEnumValue::Integer(value),
860 )),
861 }
862 }
863 }
864
865 impl std::convert::From<&str> for State {
866 fn from(value: &str) -> Self {
867 use std::string::ToString;
868 match value {
869 "STATE_UNSPECIFIED" => Self::Unspecified,
870 "ACTIVE" => Self::Active,
871 "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
872 "UNINITIALIZED" => Self::Uninitialized,
873 "KEY_PROJECT_PERMISSION_DENIED" => Self::KeyProjectPermissionDenied,
874 _ => Self::UnknownValue(state::UnknownValue(
875 wkt::internal::UnknownEnumValue::String(value.to_string()),
876 )),
877 }
878 }
879 }
880
881 impl serde::ser::Serialize for State {
882 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
883 where
884 S: serde::Serializer,
885 {
886 match self {
887 Self::Unspecified => serializer.serialize_i32(0),
888 Self::Active => serializer.serialize_i32(1),
889 Self::KeyProjectDeleted => serializer.serialize_i32(2),
890 Self::Uninitialized => serializer.serialize_i32(3),
891 Self::KeyProjectPermissionDenied => serializer.serialize_i32(4),
892 Self::UnknownValue(u) => u.0.serialize(serializer),
893 }
894 }
895 }
896
897 impl<'de> serde::de::Deserialize<'de> for State {
898 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
899 where
900 D: serde::Deserializer<'de>,
901 {
902 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
903 ".google.cloud.kms.v1.AutokeyConfig.State",
904 ))
905 }
906 }
907
908 /// Defines the resolution mode enum for the key project.
909 /// The
910 /// [KeyProjectResolutionMode][google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]
911 /// determines the mechanism by which
912 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] identifies a
913 /// [key_project][google.cloud.kms.v1.AutokeyConfig.key_project] at its
914 /// specific configuration node. This parameter also determines if Autokey can
915 /// be used within this project or folder.
916 ///
917 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
918 /// [google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]: crate::model::autokey_config::KeyProjectResolutionMode
919 /// [google.cloud.kms.v1.AutokeyConfig.key_project]: crate::model::AutokeyConfig::key_project
920 ///
921 /// # Working with unknown values
922 ///
923 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
924 /// additional enum variants at any time. Adding new variants is not considered
925 /// a breaking change. Applications should write their code in anticipation of:
926 ///
927 /// - New values appearing in future releases of the client library, **and**
928 /// - New values received dynamically, without application changes.
929 ///
930 /// Please consult the [Working with enums] section in the user guide for some
931 /// guidelines.
932 ///
933 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
934 #[derive(Clone, Debug, PartialEq)]
935 #[non_exhaustive]
936 pub enum KeyProjectResolutionMode {
937 /// Default value. KeyProjectResolutionMode when not specified will act as
938 /// `DEDICATED_KEY_PROJECT`.
939 Unspecified,
940 /// Keys are created in a dedicated project specified by `key_project`.
941 DedicatedKeyProject,
942 /// Keys are created in the same project as the resource requesting the key.
943 /// The `key_project` must not be set when this mode is used.
944 ResourceProject,
945 /// Disables the AutokeyConfig. When this mode is set, any AutokeyConfig
946 /// from higher levels in the resource hierarchy are ignored for this
947 /// resource and its descendants. This setting can be overridden
948 /// by a more specific configuration at a lower level. For example,
949 /// if Autokey is disabled on a folder, it can be re-enabled on a sub-folder
950 /// or project within that folder by setting a different mode (e.g.,
951 /// DEDICATED_KEY_PROJECT or RESOURCE_PROJECT).
952 Disabled,
953 /// If set, the enum was initialized with an unknown value.
954 ///
955 /// Applications can examine the value using [KeyProjectResolutionMode::value] or
956 /// [KeyProjectResolutionMode::name].
957 UnknownValue(key_project_resolution_mode::UnknownValue),
958 }
959
960 #[doc(hidden)]
961 pub mod key_project_resolution_mode {
962 #[allow(unused_imports)]
963 use super::*;
964 #[derive(Clone, Debug, PartialEq)]
965 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
966 }
967
968 impl KeyProjectResolutionMode {
969 /// Gets the enum value.
970 ///
971 /// Returns `None` if the enum contains an unknown value deserialized from
972 /// the string representation of enums.
973 pub fn value(&self) -> std::option::Option<i32> {
974 match self {
975 Self::Unspecified => std::option::Option::Some(0),
976 Self::DedicatedKeyProject => std::option::Option::Some(1),
977 Self::ResourceProject => std::option::Option::Some(2),
978 Self::Disabled => std::option::Option::Some(3),
979 Self::UnknownValue(u) => u.0.value(),
980 }
981 }
982
983 /// Gets the enum value as a string.
984 ///
985 /// Returns `None` if the enum contains an unknown value deserialized from
986 /// the integer representation of enums.
987 pub fn name(&self) -> std::option::Option<&str> {
988 match self {
989 Self::Unspecified => {
990 std::option::Option::Some("KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED")
991 }
992 Self::DedicatedKeyProject => std::option::Option::Some("DEDICATED_KEY_PROJECT"),
993 Self::ResourceProject => std::option::Option::Some("RESOURCE_PROJECT"),
994 Self::Disabled => std::option::Option::Some("DISABLED"),
995 Self::UnknownValue(u) => u.0.name(),
996 }
997 }
998 }
999
1000 impl std::default::Default for KeyProjectResolutionMode {
1001 fn default() -> Self {
1002 use std::convert::From;
1003 Self::from(0)
1004 }
1005 }
1006
1007 impl std::fmt::Display for KeyProjectResolutionMode {
1008 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1009 wkt::internal::display_enum(f, self.name(), self.value())
1010 }
1011 }
1012
1013 impl std::convert::From<i32> for KeyProjectResolutionMode {
1014 fn from(value: i32) -> Self {
1015 match value {
1016 0 => Self::Unspecified,
1017 1 => Self::DedicatedKeyProject,
1018 2 => Self::ResourceProject,
1019 3 => Self::Disabled,
1020 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1021 wkt::internal::UnknownEnumValue::Integer(value),
1022 )),
1023 }
1024 }
1025 }
1026
1027 impl std::convert::From<&str> for KeyProjectResolutionMode {
1028 fn from(value: &str) -> Self {
1029 use std::string::ToString;
1030 match value {
1031 "KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED" => Self::Unspecified,
1032 "DEDICATED_KEY_PROJECT" => Self::DedicatedKeyProject,
1033 "RESOURCE_PROJECT" => Self::ResourceProject,
1034 "DISABLED" => Self::Disabled,
1035 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1036 wkt::internal::UnknownEnumValue::String(value.to_string()),
1037 )),
1038 }
1039 }
1040 }
1041
1042 impl serde::ser::Serialize for KeyProjectResolutionMode {
1043 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1044 where
1045 S: serde::Serializer,
1046 {
1047 match self {
1048 Self::Unspecified => serializer.serialize_i32(0),
1049 Self::DedicatedKeyProject => serializer.serialize_i32(1),
1050 Self::ResourceProject => serializer.serialize_i32(2),
1051 Self::Disabled => serializer.serialize_i32(3),
1052 Self::UnknownValue(u) => u.0.serialize(serializer),
1053 }
1054 }
1055 }
1056
1057 impl<'de> serde::de::Deserialize<'de> for KeyProjectResolutionMode {
1058 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1059 where
1060 D: serde::Deserializer<'de>,
1061 {
1062 deserializer.deserialize_any(
1063 wkt::internal::EnumVisitor::<KeyProjectResolutionMode>::new(
1064 ".google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode",
1065 ),
1066 )
1067 }
1068 }
1069}
1070
1071/// Request message for
1072/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1073///
1074/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1075#[derive(Clone, Default, PartialEq)]
1076#[non_exhaustive]
1077pub struct ShowEffectiveAutokeyConfigRequest {
1078 /// Required. Name of the resource project to the show effective Cloud KMS
1079 /// Autokey configuration for. This may be helpful for interrogating the effect
1080 /// of nested folder configurations on a given resource project.
1081 pub parent: std::string::String,
1082
1083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1084}
1085
1086impl ShowEffectiveAutokeyConfigRequest {
1087 pub fn new() -> Self {
1088 std::default::Default::default()
1089 }
1090
1091 /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
1092 ///
1093 /// # Example
1094 /// ```ignore,no_run
1095 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
1096 /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
1097 /// ```
1098 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1099 self.parent = v.into();
1100 self
1101 }
1102}
1103
1104impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
1105 fn typename() -> &'static str {
1106 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
1107 }
1108}
1109
1110/// Response message for
1111/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1112///
1113/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1114#[derive(Clone, Default, PartialEq)]
1115#[non_exhaustive]
1116pub struct ShowEffectiveAutokeyConfigResponse {
1117 /// Name of the key project configured in the resource project's folder
1118 /// ancestry.
1119 pub key_project: std::string::String,
1120
1121 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1122}
1123
1124impl ShowEffectiveAutokeyConfigResponse {
1125 pub fn new() -> Self {
1126 std::default::Default::default()
1127 }
1128
1129 /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
1130 ///
1131 /// # Example
1132 /// ```ignore,no_run
1133 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
1134 /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
1135 /// ```
1136 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1137 self.key_project = v.into();
1138 self
1139 }
1140}
1141
1142impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
1143 fn typename() -> &'static str {
1144 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
1145 }
1146}
1147
1148/// Request message for
1149/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1150///
1151/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1152#[derive(Clone, Default, PartialEq)]
1153#[non_exhaustive]
1154pub struct ListEkmConnectionsRequest {
1155 /// Required. The resource name of the location associated with the
1156 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
1157 /// `projects/*/locations/*`.
1158 ///
1159 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1160 pub parent: std::string::String,
1161
1162 /// Optional. Optional limit on the number of
1163 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
1164 /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
1165 /// subsequently be obtained by including the
1166 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
1167 /// in a subsequent request. If unspecified, the server will pick an
1168 /// appropriate default.
1169 ///
1170 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1171 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1172 pub page_size: i32,
1173
1174 /// Optional. Optional pagination token, returned earlier via
1175 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
1176 ///
1177 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1178 pub page_token: std::string::String,
1179
1180 /// Optional. Only include resources that match the filter in the response. For
1181 /// more information, see
1182 /// [Sorting and filtering list
1183 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1184 pub filter: std::string::String,
1185
1186 /// Optional. Specify how the results should be sorted. If not specified, the
1187 /// results will be sorted in the default order. For more information, see
1188 /// [Sorting and filtering list
1189 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1190 pub order_by: std::string::String,
1191
1192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1193}
1194
1195impl ListEkmConnectionsRequest {
1196 pub fn new() -> Self {
1197 std::default::Default::default()
1198 }
1199
1200 /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1201 ///
1202 /// # Example
1203 /// ```ignore,no_run
1204 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1205 /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1206 /// ```
1207 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1208 self.parent = v.into();
1209 self
1210 }
1211
1212 /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1213 ///
1214 /// # Example
1215 /// ```ignore,no_run
1216 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1217 /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1218 /// ```
1219 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1220 self.page_size = v.into();
1221 self
1222 }
1223
1224 /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1225 ///
1226 /// # Example
1227 /// ```ignore,no_run
1228 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1229 /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1230 /// ```
1231 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1232 self.page_token = v.into();
1233 self
1234 }
1235
1236 /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1237 ///
1238 /// # Example
1239 /// ```ignore,no_run
1240 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1241 /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1242 /// ```
1243 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1244 self.filter = v.into();
1245 self
1246 }
1247
1248 /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1249 ///
1250 /// # Example
1251 /// ```ignore,no_run
1252 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1253 /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1254 /// ```
1255 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1256 self.order_by = v.into();
1257 self
1258 }
1259}
1260
1261impl wkt::message::Message for ListEkmConnectionsRequest {
1262 fn typename() -> &'static str {
1263 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1264 }
1265}
1266
1267/// Response message for
1268/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1269///
1270/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1271#[derive(Clone, Default, PartialEq)]
1272#[non_exhaustive]
1273pub struct ListEkmConnectionsResponse {
1274 /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1275 ///
1276 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1277 pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1278
1279 /// A token to retrieve next page of results. Pass this value in
1280 /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1281 /// to retrieve the next page of results.
1282 ///
1283 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1284 pub next_page_token: std::string::String,
1285
1286 /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1287 /// that matched the query.
1288 ///
1289 /// This field is not populated if
1290 /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1291 /// is applied.
1292 ///
1293 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1294 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1295 pub total_size: i32,
1296
1297 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1298}
1299
1300impl ListEkmConnectionsResponse {
1301 pub fn new() -> Self {
1302 std::default::Default::default()
1303 }
1304
1305 /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1306 ///
1307 /// # Example
1308 /// ```ignore,no_run
1309 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1310 /// use google_cloud_kms_v1::model::EkmConnection;
1311 /// let x = ListEkmConnectionsResponse::new()
1312 /// .set_ekm_connections([
1313 /// EkmConnection::default()/* use setters */,
1314 /// EkmConnection::default()/* use (different) setters */,
1315 /// ]);
1316 /// ```
1317 pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1318 where
1319 T: std::iter::IntoIterator<Item = V>,
1320 V: std::convert::Into<crate::model::EkmConnection>,
1321 {
1322 use std::iter::Iterator;
1323 self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1324 self
1325 }
1326
1327 /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1328 ///
1329 /// # Example
1330 /// ```ignore,no_run
1331 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1332 /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1333 /// ```
1334 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1335 self.next_page_token = v.into();
1336 self
1337 }
1338
1339 /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1340 ///
1341 /// # Example
1342 /// ```ignore,no_run
1343 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1344 /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1345 /// ```
1346 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1347 self.total_size = v.into();
1348 self
1349 }
1350}
1351
1352impl wkt::message::Message for ListEkmConnectionsResponse {
1353 fn typename() -> &'static str {
1354 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1355 }
1356}
1357
1358#[doc(hidden)]
1359impl google_cloud_gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1360 type PageItem = crate::model::EkmConnection;
1361
1362 fn items(self) -> std::vec::Vec<Self::PageItem> {
1363 self.ekm_connections
1364 }
1365
1366 fn next_page_token(&self) -> std::string::String {
1367 use std::clone::Clone;
1368 self.next_page_token.clone()
1369 }
1370}
1371
1372/// Request message for
1373/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1374///
1375/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1376#[derive(Clone, Default, PartialEq)]
1377#[non_exhaustive]
1378pub struct GetEkmConnectionRequest {
1379 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1380 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1381 ///
1382 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1383 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1384 pub name: std::string::String,
1385
1386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1387}
1388
1389impl GetEkmConnectionRequest {
1390 pub fn new() -> Self {
1391 std::default::Default::default()
1392 }
1393
1394 /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1395 ///
1396 /// # Example
1397 /// ```ignore,no_run
1398 /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1399 /// let x = GetEkmConnectionRequest::new().set_name("example");
1400 /// ```
1401 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1402 self.name = v.into();
1403 self
1404 }
1405}
1406
1407impl wkt::message::Message for GetEkmConnectionRequest {
1408 fn typename() -> &'static str {
1409 "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1410 }
1411}
1412
1413/// Request message for
1414/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1415///
1416/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1417#[derive(Clone, Default, PartialEq)]
1418#[non_exhaustive]
1419pub struct CreateEkmConnectionRequest {
1420 /// Required. The resource name of the location associated with the
1421 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1422 /// `projects/*/locations/*`.
1423 ///
1424 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1425 pub parent: std::string::String,
1426
1427 /// Required. It must be unique within a location and match the regular
1428 /// expression `[a-zA-Z0-9_-]{1,63}`.
1429 pub ekm_connection_id: std::string::String,
1430
1431 /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1432 /// initial field values.
1433 ///
1434 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1435 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1436
1437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1438}
1439
1440impl CreateEkmConnectionRequest {
1441 pub fn new() -> Self {
1442 std::default::Default::default()
1443 }
1444
1445 /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1446 ///
1447 /// # Example
1448 /// ```ignore,no_run
1449 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1450 /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1451 /// ```
1452 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1453 self.parent = v.into();
1454 self
1455 }
1456
1457 /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1458 ///
1459 /// # Example
1460 /// ```ignore,no_run
1461 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1462 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1463 /// ```
1464 pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1465 mut self,
1466 v: T,
1467 ) -> Self {
1468 self.ekm_connection_id = v.into();
1469 self
1470 }
1471
1472 /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1473 ///
1474 /// # Example
1475 /// ```ignore,no_run
1476 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1477 /// use google_cloud_kms_v1::model::EkmConnection;
1478 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1479 /// ```
1480 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1481 where
1482 T: std::convert::Into<crate::model::EkmConnection>,
1483 {
1484 self.ekm_connection = std::option::Option::Some(v.into());
1485 self
1486 }
1487
1488 /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1489 ///
1490 /// # Example
1491 /// ```ignore,no_run
1492 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1493 /// use google_cloud_kms_v1::model::EkmConnection;
1494 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1495 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1496 /// ```
1497 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1498 where
1499 T: std::convert::Into<crate::model::EkmConnection>,
1500 {
1501 self.ekm_connection = v.map(|x| x.into());
1502 self
1503 }
1504}
1505
1506impl wkt::message::Message for CreateEkmConnectionRequest {
1507 fn typename() -> &'static str {
1508 "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1509 }
1510}
1511
1512/// Request message for
1513/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1514///
1515/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1516#[derive(Clone, Default, PartialEq)]
1517#[non_exhaustive]
1518pub struct UpdateEkmConnectionRequest {
1519 /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1520 /// values.
1521 ///
1522 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1523 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1524
1525 /// Required. List of fields to be updated in this request.
1526 pub update_mask: std::option::Option<wkt::FieldMask>,
1527
1528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1529}
1530
1531impl UpdateEkmConnectionRequest {
1532 pub fn new() -> Self {
1533 std::default::Default::default()
1534 }
1535
1536 /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1537 ///
1538 /// # Example
1539 /// ```ignore,no_run
1540 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1541 /// use google_cloud_kms_v1::model::EkmConnection;
1542 /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1543 /// ```
1544 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1545 where
1546 T: std::convert::Into<crate::model::EkmConnection>,
1547 {
1548 self.ekm_connection = std::option::Option::Some(v.into());
1549 self
1550 }
1551
1552 /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1553 ///
1554 /// # Example
1555 /// ```ignore,no_run
1556 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1557 /// use google_cloud_kms_v1::model::EkmConnection;
1558 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1559 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1560 /// ```
1561 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1562 where
1563 T: std::convert::Into<crate::model::EkmConnection>,
1564 {
1565 self.ekm_connection = v.map(|x| x.into());
1566 self
1567 }
1568
1569 /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1570 ///
1571 /// # Example
1572 /// ```ignore,no_run
1573 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1574 /// use wkt::FieldMask;
1575 /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1576 /// ```
1577 pub fn set_update_mask<T>(mut self, v: T) -> Self
1578 where
1579 T: std::convert::Into<wkt::FieldMask>,
1580 {
1581 self.update_mask = std::option::Option::Some(v.into());
1582 self
1583 }
1584
1585 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1586 ///
1587 /// # Example
1588 /// ```ignore,no_run
1589 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1590 /// use wkt::FieldMask;
1591 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1592 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1593 /// ```
1594 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1595 where
1596 T: std::convert::Into<wkt::FieldMask>,
1597 {
1598 self.update_mask = v.map(|x| x.into());
1599 self
1600 }
1601}
1602
1603impl wkt::message::Message for UpdateEkmConnectionRequest {
1604 fn typename() -> &'static str {
1605 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1606 }
1607}
1608
1609/// Request message for
1610/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1611///
1612/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1613#[derive(Clone, Default, PartialEq)]
1614#[non_exhaustive]
1615pub struct GetEkmConfigRequest {
1616 /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1617 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1618 ///
1619 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1620 /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1621 pub name: std::string::String,
1622
1623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1624}
1625
1626impl GetEkmConfigRequest {
1627 pub fn new() -> Self {
1628 std::default::Default::default()
1629 }
1630
1631 /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1632 ///
1633 /// # Example
1634 /// ```ignore,no_run
1635 /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1636 /// let x = GetEkmConfigRequest::new().set_name("example");
1637 /// ```
1638 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1639 self.name = v.into();
1640 self
1641 }
1642}
1643
1644impl wkt::message::Message for GetEkmConfigRequest {
1645 fn typename() -> &'static str {
1646 "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1647 }
1648}
1649
1650/// Request message for
1651/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1652///
1653/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1654#[derive(Clone, Default, PartialEq)]
1655#[non_exhaustive]
1656pub struct UpdateEkmConfigRequest {
1657 /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1658 ///
1659 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1660 pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1661
1662 /// Required. List of fields to be updated in this request.
1663 pub update_mask: std::option::Option<wkt::FieldMask>,
1664
1665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1666}
1667
1668impl UpdateEkmConfigRequest {
1669 pub fn new() -> Self {
1670 std::default::Default::default()
1671 }
1672
1673 /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1674 ///
1675 /// # Example
1676 /// ```ignore,no_run
1677 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1678 /// use google_cloud_kms_v1::model::EkmConfig;
1679 /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1680 /// ```
1681 pub fn set_ekm_config<T>(mut self, v: T) -> Self
1682 where
1683 T: std::convert::Into<crate::model::EkmConfig>,
1684 {
1685 self.ekm_config = std::option::Option::Some(v.into());
1686 self
1687 }
1688
1689 /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1690 ///
1691 /// # Example
1692 /// ```ignore,no_run
1693 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1694 /// use google_cloud_kms_v1::model::EkmConfig;
1695 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1696 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1697 /// ```
1698 pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1699 where
1700 T: std::convert::Into<crate::model::EkmConfig>,
1701 {
1702 self.ekm_config = v.map(|x| x.into());
1703 self
1704 }
1705
1706 /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1707 ///
1708 /// # Example
1709 /// ```ignore,no_run
1710 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1711 /// use wkt::FieldMask;
1712 /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1713 /// ```
1714 pub fn set_update_mask<T>(mut self, v: T) -> Self
1715 where
1716 T: std::convert::Into<wkt::FieldMask>,
1717 {
1718 self.update_mask = std::option::Option::Some(v.into());
1719 self
1720 }
1721
1722 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1723 ///
1724 /// # Example
1725 /// ```ignore,no_run
1726 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1727 /// use wkt::FieldMask;
1728 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1729 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1730 /// ```
1731 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1732 where
1733 T: std::convert::Into<wkt::FieldMask>,
1734 {
1735 self.update_mask = v.map(|x| x.into());
1736 self
1737 }
1738}
1739
1740impl wkt::message::Message for UpdateEkmConfigRequest {
1741 fn typename() -> &'static str {
1742 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1743 }
1744}
1745
1746/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1747/// certificate used to authenticate HTTPS connections to EKM replicas.
1748///
1749/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1750#[derive(Clone, Default, PartialEq)]
1751#[non_exhaustive]
1752pub struct Certificate {
1753 /// Required. The raw certificate bytes in DER format.
1754 pub raw_der: ::bytes::Bytes,
1755
1756 /// Output only. True if the certificate was parsed successfully.
1757 pub parsed: bool,
1758
1759 /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1760 /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1761 ///
1762 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1763 pub issuer: std::string::String,
1764
1765 /// Output only. The subject distinguished name in RFC 2253 format. Only
1766 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1767 ///
1768 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1769 pub subject: std::string::String,
1770
1771 /// Output only. The subject Alternative DNS names. Only present if
1772 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1773 ///
1774 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1775 pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1776
1777 /// Output only. The certificate is not valid before this time. Only present if
1778 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1779 ///
1780 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1781 pub not_before_time: std::option::Option<wkt::Timestamp>,
1782
1783 /// Output only. The certificate is not valid after this time. Only present if
1784 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1785 ///
1786 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1787 pub not_after_time: std::option::Option<wkt::Timestamp>,
1788
1789 /// Output only. The certificate serial number as a hex string. Only present if
1790 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1791 ///
1792 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1793 pub serial_number: std::string::String,
1794
1795 /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1796 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1797 ///
1798 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1799 pub sha256_fingerprint: std::string::String,
1800
1801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1802}
1803
1804impl Certificate {
1805 pub fn new() -> Self {
1806 std::default::Default::default()
1807 }
1808
1809 /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1810 ///
1811 /// # Example
1812 /// ```ignore,no_run
1813 /// # use google_cloud_kms_v1::model::Certificate;
1814 /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1815 /// ```
1816 pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1817 self.raw_der = v.into();
1818 self
1819 }
1820
1821 /// Sets the value of [parsed][crate::model::Certificate::parsed].
1822 ///
1823 /// # Example
1824 /// ```ignore,no_run
1825 /// # use google_cloud_kms_v1::model::Certificate;
1826 /// let x = Certificate::new().set_parsed(true);
1827 /// ```
1828 pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1829 self.parsed = v.into();
1830 self
1831 }
1832
1833 /// Sets the value of [issuer][crate::model::Certificate::issuer].
1834 ///
1835 /// # Example
1836 /// ```ignore,no_run
1837 /// # use google_cloud_kms_v1::model::Certificate;
1838 /// let x = Certificate::new().set_issuer("example");
1839 /// ```
1840 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1841 self.issuer = v.into();
1842 self
1843 }
1844
1845 /// Sets the value of [subject][crate::model::Certificate::subject].
1846 ///
1847 /// # Example
1848 /// ```ignore,no_run
1849 /// # use google_cloud_kms_v1::model::Certificate;
1850 /// let x = Certificate::new().set_subject("example");
1851 /// ```
1852 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1853 self.subject = v.into();
1854 self
1855 }
1856
1857 /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1858 ///
1859 /// # Example
1860 /// ```ignore,no_run
1861 /// # use google_cloud_kms_v1::model::Certificate;
1862 /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1863 /// ```
1864 pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1865 where
1866 T: std::iter::IntoIterator<Item = V>,
1867 V: std::convert::Into<std::string::String>,
1868 {
1869 use std::iter::Iterator;
1870 self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1871 self
1872 }
1873
1874 /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1875 ///
1876 /// # Example
1877 /// ```ignore,no_run
1878 /// # use google_cloud_kms_v1::model::Certificate;
1879 /// use wkt::Timestamp;
1880 /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1881 /// ```
1882 pub fn set_not_before_time<T>(mut self, v: T) -> Self
1883 where
1884 T: std::convert::Into<wkt::Timestamp>,
1885 {
1886 self.not_before_time = std::option::Option::Some(v.into());
1887 self
1888 }
1889
1890 /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1891 ///
1892 /// # Example
1893 /// ```ignore,no_run
1894 /// # use google_cloud_kms_v1::model::Certificate;
1895 /// use wkt::Timestamp;
1896 /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1897 /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1898 /// ```
1899 pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1900 where
1901 T: std::convert::Into<wkt::Timestamp>,
1902 {
1903 self.not_before_time = v.map(|x| x.into());
1904 self
1905 }
1906
1907 /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1908 ///
1909 /// # Example
1910 /// ```ignore,no_run
1911 /// # use google_cloud_kms_v1::model::Certificate;
1912 /// use wkt::Timestamp;
1913 /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1914 /// ```
1915 pub fn set_not_after_time<T>(mut self, v: T) -> Self
1916 where
1917 T: std::convert::Into<wkt::Timestamp>,
1918 {
1919 self.not_after_time = std::option::Option::Some(v.into());
1920 self
1921 }
1922
1923 /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1924 ///
1925 /// # Example
1926 /// ```ignore,no_run
1927 /// # use google_cloud_kms_v1::model::Certificate;
1928 /// use wkt::Timestamp;
1929 /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1930 /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1931 /// ```
1932 pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1933 where
1934 T: std::convert::Into<wkt::Timestamp>,
1935 {
1936 self.not_after_time = v.map(|x| x.into());
1937 self
1938 }
1939
1940 /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1941 ///
1942 /// # Example
1943 /// ```ignore,no_run
1944 /// # use google_cloud_kms_v1::model::Certificate;
1945 /// let x = Certificate::new().set_serial_number("example");
1946 /// ```
1947 pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1948 self.serial_number = v.into();
1949 self
1950 }
1951
1952 /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1953 ///
1954 /// # Example
1955 /// ```ignore,no_run
1956 /// # use google_cloud_kms_v1::model::Certificate;
1957 /// let x = Certificate::new().set_sha256_fingerprint("example");
1958 /// ```
1959 pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1960 mut self,
1961 v: T,
1962 ) -> Self {
1963 self.sha256_fingerprint = v.into();
1964 self
1965 }
1966}
1967
1968impl wkt::message::Message for Certificate {
1969 fn typename() -> &'static str {
1970 "type.googleapis.com/google.cloud.kms.v1.Certificate"
1971 }
1972}
1973
1974/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
1975/// individual EKM connection. It can be used for creating
1976/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
1977/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
1978/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
1979/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
1980/// performing cryptographic operations using keys created within the
1981/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
1982///
1983/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
1984/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
1985/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1986/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
1987/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
1988#[derive(Clone, Default, PartialEq)]
1989#[non_exhaustive]
1990pub struct EkmConnection {
1991 /// Output only. The resource name for the
1992 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
1993 /// `projects/*/locations/*/ekmConnections/*`.
1994 ///
1995 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1996 pub name: std::string::String,
1997
1998 /// Output only. The time at which the
1999 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
2000 ///
2001 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2002 pub create_time: std::option::Option<wkt::Timestamp>,
2003
2004 /// Optional. A list of
2005 /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
2006 /// the EKM can be reached. There should be one ServiceResolver per EKM
2007 /// replica. Currently, only a single
2008 /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
2009 /// supported.
2010 ///
2011 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2012 pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
2013
2014 /// Optional. Etag of the currently stored
2015 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2016 ///
2017 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2018 pub etag: std::string::String,
2019
2020 /// Optional. Describes who can perform control plane operations on the EKM. If
2021 /// unset, this defaults to
2022 /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
2023 ///
2024 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
2025 pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
2026
2027 /// Optional. Identifies the EKM Crypto Space that this
2028 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
2029 /// field is required if
2030 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
2031 /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
2032 ///
2033 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2034 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2035 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
2036 pub crypto_space_path: std::string::String,
2037
2038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2039}
2040
2041impl EkmConnection {
2042 pub fn new() -> Self {
2043 std::default::Default::default()
2044 }
2045
2046 /// Sets the value of [name][crate::model::EkmConnection::name].
2047 ///
2048 /// # Example
2049 /// ```ignore,no_run
2050 /// # use google_cloud_kms_v1::model::EkmConnection;
2051 /// let x = EkmConnection::new().set_name("example");
2052 /// ```
2053 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2054 self.name = v.into();
2055 self
2056 }
2057
2058 /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
2059 ///
2060 /// # Example
2061 /// ```ignore,no_run
2062 /// # use google_cloud_kms_v1::model::EkmConnection;
2063 /// use wkt::Timestamp;
2064 /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
2065 /// ```
2066 pub fn set_create_time<T>(mut self, v: T) -> Self
2067 where
2068 T: std::convert::Into<wkt::Timestamp>,
2069 {
2070 self.create_time = std::option::Option::Some(v.into());
2071 self
2072 }
2073
2074 /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
2075 ///
2076 /// # Example
2077 /// ```ignore,no_run
2078 /// # use google_cloud_kms_v1::model::EkmConnection;
2079 /// use wkt::Timestamp;
2080 /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2081 /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
2082 /// ```
2083 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2084 where
2085 T: std::convert::Into<wkt::Timestamp>,
2086 {
2087 self.create_time = v.map(|x| x.into());
2088 self
2089 }
2090
2091 /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
2092 ///
2093 /// # Example
2094 /// ```ignore,no_run
2095 /// # use google_cloud_kms_v1::model::EkmConnection;
2096 /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2097 /// let x = EkmConnection::new()
2098 /// .set_service_resolvers([
2099 /// ServiceResolver::default()/* use setters */,
2100 /// ServiceResolver::default()/* use (different) setters */,
2101 /// ]);
2102 /// ```
2103 pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
2104 where
2105 T: std::iter::IntoIterator<Item = V>,
2106 V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
2107 {
2108 use std::iter::Iterator;
2109 self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
2110 self
2111 }
2112
2113 /// Sets the value of [etag][crate::model::EkmConnection::etag].
2114 ///
2115 /// # Example
2116 /// ```ignore,no_run
2117 /// # use google_cloud_kms_v1::model::EkmConnection;
2118 /// let x = EkmConnection::new().set_etag("example");
2119 /// ```
2120 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2121 self.etag = v.into();
2122 self
2123 }
2124
2125 /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
2126 ///
2127 /// # Example
2128 /// ```ignore,no_run
2129 /// # use google_cloud_kms_v1::model::EkmConnection;
2130 /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
2131 /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
2132 /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
2133 /// ```
2134 pub fn set_key_management_mode<
2135 T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
2136 >(
2137 mut self,
2138 v: T,
2139 ) -> Self {
2140 self.key_management_mode = v.into();
2141 self
2142 }
2143
2144 /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
2145 ///
2146 /// # Example
2147 /// ```ignore,no_run
2148 /// # use google_cloud_kms_v1::model::EkmConnection;
2149 /// let x = EkmConnection::new().set_crypto_space_path("example");
2150 /// ```
2151 pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
2152 mut self,
2153 v: T,
2154 ) -> Self {
2155 self.crypto_space_path = v.into();
2156 self
2157 }
2158}
2159
2160impl wkt::message::Message for EkmConnection {
2161 fn typename() -> &'static str {
2162 "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
2163 }
2164}
2165
2166/// Defines additional types related to [EkmConnection].
2167pub mod ekm_connection {
2168 #[allow(unused_imports)]
2169 use super::*;
2170
2171 /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
2172 /// represents an EKM replica that can be reached within an
2173 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2174 ///
2175 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2176 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2177 #[derive(Clone, Default, PartialEq)]
2178 #[non_exhaustive]
2179 pub struct ServiceResolver {
2180 /// Required. The resource name of the Service Directory service pointing to
2181 /// an EKM replica, in the format
2182 /// `projects/*/locations/*/namespaces/*/services/*`.
2183 pub service_directory_service: std::string::String,
2184
2185 /// Optional. The filter applied to the endpoints of the resolved service. If
2186 /// no filter is specified, all endpoints will be considered. An endpoint
2187 /// will be chosen arbitrarily from the filtered list for each request.
2188 ///
2189 /// For endpoint filter syntax and examples, see
2190 /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
2191 pub endpoint_filter: std::string::String,
2192
2193 /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
2194 pub hostname: std::string::String,
2195
2196 /// Required. A list of leaf server certificates used to authenticate HTTPS
2197 /// connections to the EKM replica. Currently, a maximum of 10
2198 /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2199 ///
2200 /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2201 pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2202
2203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2204 }
2205
2206 impl ServiceResolver {
2207 pub fn new() -> Self {
2208 std::default::Default::default()
2209 }
2210
2211 /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2212 ///
2213 /// # Example
2214 /// ```ignore,no_run
2215 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2216 /// let x = ServiceResolver::new().set_service_directory_service("example");
2217 /// ```
2218 pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2219 mut self,
2220 v: T,
2221 ) -> Self {
2222 self.service_directory_service = v.into();
2223 self
2224 }
2225
2226 /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2227 ///
2228 /// # Example
2229 /// ```ignore,no_run
2230 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2231 /// let x = ServiceResolver::new().set_endpoint_filter("example");
2232 /// ```
2233 pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2234 mut self,
2235 v: T,
2236 ) -> Self {
2237 self.endpoint_filter = v.into();
2238 self
2239 }
2240
2241 /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2242 ///
2243 /// # Example
2244 /// ```ignore,no_run
2245 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2246 /// let x = ServiceResolver::new().set_hostname("example");
2247 /// ```
2248 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2249 self.hostname = v.into();
2250 self
2251 }
2252
2253 /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2254 ///
2255 /// # Example
2256 /// ```ignore,no_run
2257 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2258 /// use google_cloud_kms_v1::model::Certificate;
2259 /// let x = ServiceResolver::new()
2260 /// .set_server_certificates([
2261 /// Certificate::default()/* use setters */,
2262 /// Certificate::default()/* use (different) setters */,
2263 /// ]);
2264 /// ```
2265 pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2266 where
2267 T: std::iter::IntoIterator<Item = V>,
2268 V: std::convert::Into<crate::model::Certificate>,
2269 {
2270 use std::iter::Iterator;
2271 self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2272 self
2273 }
2274 }
2275
2276 impl wkt::message::Message for ServiceResolver {
2277 fn typename() -> &'static str {
2278 "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2279 }
2280 }
2281
2282 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2283 /// describes who can perform control plane cryptographic operations using this
2284 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2285 ///
2286 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2287 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2288 ///
2289 /// # Working with unknown values
2290 ///
2291 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2292 /// additional enum variants at any time. Adding new variants is not considered
2293 /// a breaking change. Applications should write their code in anticipation of:
2294 ///
2295 /// - New values appearing in future releases of the client library, **and**
2296 /// - New values received dynamically, without application changes.
2297 ///
2298 /// Please consult the [Working with enums] section in the user guide for some
2299 /// guidelines.
2300 ///
2301 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2302 #[derive(Clone, Debug, PartialEq)]
2303 #[non_exhaustive]
2304 pub enum KeyManagementMode {
2305 /// Not specified.
2306 Unspecified,
2307 /// EKM-side key management operations on
2308 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2309 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2310 /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2311 ///
2312 /// * When creating a
2313 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2314 /// this
2315 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2316 /// supply the key path of pre-existing external key material that will be
2317 /// linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2318 /// * Destruction of external key material cannot be requested via the
2319 /// Cloud KMS API and must be performed directly in the EKM.
2320 /// * Automatic rotation of key material is not supported.
2321 ///
2322 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2323 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2324 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2325 Manual,
2326 /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2327 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2328 /// management operations initiated from Cloud KMS. This means that:
2329 ///
2330 /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2331 /// associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2332 /// is
2333 /// created, the EKM automatically generates new key material and a new
2334 /// key path. The caller cannot supply the key path of pre-existing
2335 /// external key material.
2336 /// * Destruction of external key material associated with this
2337 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2338 /// calling
2339 /// [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2340 /// * Automatic rotation of key material is supported.
2341 ///
2342 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2343 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2344 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2345 /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2346 CloudKms,
2347 /// If set, the enum was initialized with an unknown value.
2348 ///
2349 /// Applications can examine the value using [KeyManagementMode::value] or
2350 /// [KeyManagementMode::name].
2351 UnknownValue(key_management_mode::UnknownValue),
2352 }
2353
2354 #[doc(hidden)]
2355 pub mod key_management_mode {
2356 #[allow(unused_imports)]
2357 use super::*;
2358 #[derive(Clone, Debug, PartialEq)]
2359 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2360 }
2361
2362 impl KeyManagementMode {
2363 /// Gets the enum value.
2364 ///
2365 /// Returns `None` if the enum contains an unknown value deserialized from
2366 /// the string representation of enums.
2367 pub fn value(&self) -> std::option::Option<i32> {
2368 match self {
2369 Self::Unspecified => std::option::Option::Some(0),
2370 Self::Manual => std::option::Option::Some(1),
2371 Self::CloudKms => std::option::Option::Some(2),
2372 Self::UnknownValue(u) => u.0.value(),
2373 }
2374 }
2375
2376 /// Gets the enum value as a string.
2377 ///
2378 /// Returns `None` if the enum contains an unknown value deserialized from
2379 /// the integer representation of enums.
2380 pub fn name(&self) -> std::option::Option<&str> {
2381 match self {
2382 Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2383 Self::Manual => std::option::Option::Some("MANUAL"),
2384 Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2385 Self::UnknownValue(u) => u.0.name(),
2386 }
2387 }
2388 }
2389
2390 impl std::default::Default for KeyManagementMode {
2391 fn default() -> Self {
2392 use std::convert::From;
2393 Self::from(0)
2394 }
2395 }
2396
2397 impl std::fmt::Display for KeyManagementMode {
2398 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2399 wkt::internal::display_enum(f, self.name(), self.value())
2400 }
2401 }
2402
2403 impl std::convert::From<i32> for KeyManagementMode {
2404 fn from(value: i32) -> Self {
2405 match value {
2406 0 => Self::Unspecified,
2407 1 => Self::Manual,
2408 2 => Self::CloudKms,
2409 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2410 wkt::internal::UnknownEnumValue::Integer(value),
2411 )),
2412 }
2413 }
2414 }
2415
2416 impl std::convert::From<&str> for KeyManagementMode {
2417 fn from(value: &str) -> Self {
2418 use std::string::ToString;
2419 match value {
2420 "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2421 "MANUAL" => Self::Manual,
2422 "CLOUD_KMS" => Self::CloudKms,
2423 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2424 wkt::internal::UnknownEnumValue::String(value.to_string()),
2425 )),
2426 }
2427 }
2428 }
2429
2430 impl serde::ser::Serialize for KeyManagementMode {
2431 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2432 where
2433 S: serde::Serializer,
2434 {
2435 match self {
2436 Self::Unspecified => serializer.serialize_i32(0),
2437 Self::Manual => serializer.serialize_i32(1),
2438 Self::CloudKms => serializer.serialize_i32(2),
2439 Self::UnknownValue(u) => u.0.serialize(serializer),
2440 }
2441 }
2442 }
2443
2444 impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2445 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2446 where
2447 D: serde::Deserializer<'de>,
2448 {
2449 deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2450 ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2451 ))
2452 }
2453 }
2454}
2455
2456/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2457/// represents configuration parameters that apply to all
2458/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2459/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2460/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2461/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2462/// project and location.
2463///
2464/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2465/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2466/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2467/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2468/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2469#[derive(Clone, Default, PartialEq)]
2470#[non_exhaustive]
2471pub struct EkmConfig {
2472 /// Output only. The resource name for the
2473 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2474 /// `projects/*/locations/*/ekmConfig`.
2475 ///
2476 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2477 pub name: std::string::String,
2478
2479 /// Optional. Resource name of the default
2480 /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2481 /// the empty string removes the default.
2482 ///
2483 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2484 pub default_ekm_connection: std::string::String,
2485
2486 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2487}
2488
2489impl EkmConfig {
2490 pub fn new() -> Self {
2491 std::default::Default::default()
2492 }
2493
2494 /// Sets the value of [name][crate::model::EkmConfig::name].
2495 ///
2496 /// # Example
2497 /// ```ignore,no_run
2498 /// # use google_cloud_kms_v1::model::EkmConfig;
2499 /// let x = EkmConfig::new().set_name("example");
2500 /// ```
2501 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2502 self.name = v.into();
2503 self
2504 }
2505
2506 /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2507 ///
2508 /// # Example
2509 /// ```ignore,no_run
2510 /// # use google_cloud_kms_v1::model::EkmConfig;
2511 /// let x = EkmConfig::new().set_default_ekm_connection("example");
2512 /// ```
2513 pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2514 mut self,
2515 v: T,
2516 ) -> Self {
2517 self.default_ekm_connection = v.into();
2518 self
2519 }
2520}
2521
2522impl wkt::message::Message for EkmConfig {
2523 fn typename() -> &'static str {
2524 "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2525 }
2526}
2527
2528/// Request message for
2529/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2530///
2531/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2532#[derive(Clone, Default, PartialEq)]
2533#[non_exhaustive]
2534pub struct VerifyConnectivityRequest {
2535 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2536 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2537 ///
2538 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2539 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2540 pub name: std::string::String,
2541
2542 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2543}
2544
2545impl VerifyConnectivityRequest {
2546 pub fn new() -> Self {
2547 std::default::Default::default()
2548 }
2549
2550 /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2551 ///
2552 /// # Example
2553 /// ```ignore,no_run
2554 /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2555 /// let x = VerifyConnectivityRequest::new().set_name("example");
2556 /// ```
2557 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2558 self.name = v.into();
2559 self
2560 }
2561}
2562
2563impl wkt::message::Message for VerifyConnectivityRequest {
2564 fn typename() -> &'static str {
2565 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2566 }
2567}
2568
2569/// Response message for
2570/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2571///
2572/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2573#[derive(Clone, Default, PartialEq)]
2574#[non_exhaustive]
2575pub struct VerifyConnectivityResponse {
2576 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2577}
2578
2579impl VerifyConnectivityResponse {
2580 pub fn new() -> Self {
2581 std::default::Default::default()
2582 }
2583}
2584
2585impl wkt::message::Message for VerifyConnectivityResponse {
2586 fn typename() -> &'static str {
2587 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2588 }
2589}
2590
2591/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2592/// represents a single-tenant HSM instance. It can be used for creating
2593/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2594/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2595/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2596/// well as performing cryptographic operations using keys created within the
2597/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2598///
2599/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2600/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2601/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2602#[derive(Clone, Default, PartialEq)]
2603#[non_exhaustive]
2604pub struct SingleTenantHsmInstance {
2605 /// Identifier. The resource name for this
2606 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2607 /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2608 ///
2609 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2610 pub name: std::string::String,
2611
2612 /// Output only. The time at which the
2613 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2614 /// created.
2615 ///
2616 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2617 pub create_time: std::option::Option<wkt::Timestamp>,
2618
2619 /// Output only. The state of the
2620 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2621 ///
2622 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2623 pub state: crate::model::single_tenant_hsm_instance::State,
2624
2625 /// Required. The quorum auth configuration for the
2626 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2627 ///
2628 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2629 pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2630
2631 /// Output only. The time at which the
2632 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2633 /// deleted.
2634 ///
2635 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2636 pub delete_time: std::option::Option<wkt::Timestamp>,
2637
2638 /// Output only. The system-defined duration that an instance can remain
2639 /// unrefreshed until it is automatically disabled. This will have a value of
2640 /// 120 days.
2641 pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2642
2643 /// Output only. The time at which the instance will be automatically disabled
2644 /// if not refreshed. This field is updated upon creation and after each
2645 /// successful refresh operation and enable. A
2646 /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2647 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2648 /// before this time otherwise the
2649 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2650 /// become disabled.
2651 ///
2652 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2653 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
2654 pub disable_time: std::option::Option<wkt::Timestamp>,
2655
2656 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2657}
2658
2659impl SingleTenantHsmInstance {
2660 pub fn new() -> Self {
2661 std::default::Default::default()
2662 }
2663
2664 /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2665 ///
2666 /// # Example
2667 /// ```ignore,no_run
2668 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2669 /// let x = SingleTenantHsmInstance::new().set_name("example");
2670 /// ```
2671 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2672 self.name = v.into();
2673 self
2674 }
2675
2676 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2677 ///
2678 /// # Example
2679 /// ```ignore,no_run
2680 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2681 /// use wkt::Timestamp;
2682 /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2683 /// ```
2684 pub fn set_create_time<T>(mut self, v: T) -> Self
2685 where
2686 T: std::convert::Into<wkt::Timestamp>,
2687 {
2688 self.create_time = std::option::Option::Some(v.into());
2689 self
2690 }
2691
2692 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2693 ///
2694 /// # Example
2695 /// ```ignore,no_run
2696 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2697 /// use wkt::Timestamp;
2698 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2699 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2700 /// ```
2701 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2702 where
2703 T: std::convert::Into<wkt::Timestamp>,
2704 {
2705 self.create_time = v.map(|x| x.into());
2706 self
2707 }
2708
2709 /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2710 ///
2711 /// # Example
2712 /// ```ignore,no_run
2713 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2714 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2715 /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2716 /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2717 /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2718 /// ```
2719 pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2720 mut self,
2721 v: T,
2722 ) -> Self {
2723 self.state = v.into();
2724 self
2725 }
2726
2727 /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2728 ///
2729 /// # Example
2730 /// ```ignore,no_run
2731 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2732 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2733 /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2734 /// ```
2735 pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2736 where
2737 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2738 {
2739 self.quorum_auth = std::option::Option::Some(v.into());
2740 self
2741 }
2742
2743 /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2744 ///
2745 /// # Example
2746 /// ```ignore,no_run
2747 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2748 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2749 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2750 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2751 /// ```
2752 pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2753 where
2754 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2755 {
2756 self.quorum_auth = v.map(|x| x.into());
2757 self
2758 }
2759
2760 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2761 ///
2762 /// # Example
2763 /// ```ignore,no_run
2764 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2765 /// use wkt::Timestamp;
2766 /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2767 /// ```
2768 pub fn set_delete_time<T>(mut self, v: T) -> Self
2769 where
2770 T: std::convert::Into<wkt::Timestamp>,
2771 {
2772 self.delete_time = std::option::Option::Some(v.into());
2773 self
2774 }
2775
2776 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2777 ///
2778 /// # Example
2779 /// ```ignore,no_run
2780 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2781 /// use wkt::Timestamp;
2782 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2783 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2784 /// ```
2785 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2786 where
2787 T: std::convert::Into<wkt::Timestamp>,
2788 {
2789 self.delete_time = v.map(|x| x.into());
2790 self
2791 }
2792
2793 /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2794 ///
2795 /// # Example
2796 /// ```ignore,no_run
2797 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2798 /// use wkt::Duration;
2799 /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2800 /// ```
2801 pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2802 where
2803 T: std::convert::Into<wkt::Duration>,
2804 {
2805 self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2806 self
2807 }
2808
2809 /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2810 ///
2811 /// # Example
2812 /// ```ignore,no_run
2813 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2814 /// use wkt::Duration;
2815 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2816 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2817 /// ```
2818 pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2819 mut self,
2820 v: std::option::Option<T>,
2821 ) -> Self
2822 where
2823 T: std::convert::Into<wkt::Duration>,
2824 {
2825 self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2826 self
2827 }
2828
2829 /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2830 ///
2831 /// # Example
2832 /// ```ignore,no_run
2833 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2834 /// use wkt::Timestamp;
2835 /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2836 /// ```
2837 pub fn set_disable_time<T>(mut self, v: T) -> Self
2838 where
2839 T: std::convert::Into<wkt::Timestamp>,
2840 {
2841 self.disable_time = std::option::Option::Some(v.into());
2842 self
2843 }
2844
2845 /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2846 ///
2847 /// # Example
2848 /// ```ignore,no_run
2849 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2850 /// use wkt::Timestamp;
2851 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2852 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2853 /// ```
2854 pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2855 where
2856 T: std::convert::Into<wkt::Timestamp>,
2857 {
2858 self.disable_time = v.map(|x| x.into());
2859 self
2860 }
2861}
2862
2863impl wkt::message::Message for SingleTenantHsmInstance {
2864 fn typename() -> &'static str {
2865 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2866 }
2867}
2868
2869/// Defines additional types related to [SingleTenantHsmInstance].
2870pub mod single_tenant_hsm_instance {
2871 #[allow(unused_imports)]
2872 use super::*;
2873
2874 /// Configuration for M of N quorum auth.
2875 #[derive(Clone, Default, PartialEq)]
2876 #[non_exhaustive]
2877 pub struct QuorumAuth {
2878 /// Required. The total number of approvers. This is the N value used
2879 /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2880 /// or equal to 16.
2881 pub total_approver_count: i32,
2882
2883 /// Output only. The required numbers of approvers. The M value used for M of
2884 /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2885 /// to
2886 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2887 ///
2888 ///
2889 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2890 pub required_approver_count: i32,
2891
2892 /// Output only. The public keys associated with the 2FA keys for M of N
2893 /// quorum auth.
2894 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2895
2896 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2897 }
2898
2899 impl QuorumAuth {
2900 pub fn new() -> Self {
2901 std::default::Default::default()
2902 }
2903
2904 /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2905 ///
2906 /// # Example
2907 /// ```ignore,no_run
2908 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2909 /// let x = QuorumAuth::new().set_total_approver_count(42);
2910 /// ```
2911 pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2912 self.total_approver_count = v.into();
2913 self
2914 }
2915
2916 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2917 ///
2918 /// # Example
2919 /// ```ignore,no_run
2920 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2921 /// let x = QuorumAuth::new().set_required_approver_count(42);
2922 /// ```
2923 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2924 self.required_approver_count = v.into();
2925 self
2926 }
2927
2928 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
2929 ///
2930 /// # Example
2931 /// ```ignore,no_run
2932 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2933 /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
2934 /// ```
2935 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
2936 where
2937 T: std::iter::IntoIterator<Item = V>,
2938 V: std::convert::Into<std::string::String>,
2939 {
2940 use std::iter::Iterator;
2941 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
2942 self
2943 }
2944 }
2945
2946 impl wkt::message::Message for QuorumAuth {
2947 fn typename() -> &'static str {
2948 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
2949 }
2950 }
2951
2952 /// The set of states of a
2953 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2954 ///
2955 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2956 ///
2957 /// # Working with unknown values
2958 ///
2959 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2960 /// additional enum variants at any time. Adding new variants is not considered
2961 /// a breaking change. Applications should write their code in anticipation of:
2962 ///
2963 /// - New values appearing in future releases of the client library, **and**
2964 /// - New values received dynamically, without application changes.
2965 ///
2966 /// Please consult the [Working with enums] section in the user guide for some
2967 /// guidelines.
2968 ///
2969 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2970 #[derive(Clone, Debug, PartialEq)]
2971 #[non_exhaustive]
2972 pub enum State {
2973 /// Not specified.
2974 Unspecified,
2975 /// The
2976 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2977 /// being created.
2978 ///
2979 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2980 Creating,
2981 /// The
2982 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2983 /// waiting for 2FA keys to be registered. This can be done by calling
2984 /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
2985 /// with the [RegisterTwoFactorAuthKeys][] operation.
2986 ///
2987 /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
2988 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2989 PendingTwoFactorAuthRegistration,
2990 /// The
2991 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
2992 /// ready to use. A
2993 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2994 /// must be in the
2995 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
2996 /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
2997 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
2998 /// be usable.
2999 ///
3000 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3001 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3002 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
3003 Active,
3004 /// The
3005 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3006 /// being disabled.
3007 ///
3008 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3009 Disabling,
3010 /// The
3011 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3012 /// disabled.
3013 ///
3014 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3015 Disabled,
3016 /// The
3017 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3018 /// being deleted. Requests to the instance will be rejected in this state.
3019 ///
3020 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3021 Deleting,
3022 /// The
3023 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3024 /// has been deleted.
3025 ///
3026 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3027 Deleted,
3028 /// The
3029 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3030 /// has failed and can not be recovered or used.
3031 ///
3032 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3033 Failed,
3034 /// If set, the enum was initialized with an unknown value.
3035 ///
3036 /// Applications can examine the value using [State::value] or
3037 /// [State::name].
3038 UnknownValue(state::UnknownValue),
3039 }
3040
3041 #[doc(hidden)]
3042 pub mod state {
3043 #[allow(unused_imports)]
3044 use super::*;
3045 #[derive(Clone, Debug, PartialEq)]
3046 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3047 }
3048
3049 impl State {
3050 /// Gets the enum value.
3051 ///
3052 /// Returns `None` if the enum contains an unknown value deserialized from
3053 /// the string representation of enums.
3054 pub fn value(&self) -> std::option::Option<i32> {
3055 match self {
3056 Self::Unspecified => std::option::Option::Some(0),
3057 Self::Creating => std::option::Option::Some(1),
3058 Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
3059 Self::Active => std::option::Option::Some(3),
3060 Self::Disabling => std::option::Option::Some(4),
3061 Self::Disabled => std::option::Option::Some(5),
3062 Self::Deleting => std::option::Option::Some(6),
3063 Self::Deleted => std::option::Option::Some(7),
3064 Self::Failed => std::option::Option::Some(8),
3065 Self::UnknownValue(u) => u.0.value(),
3066 }
3067 }
3068
3069 /// Gets the enum value as a string.
3070 ///
3071 /// Returns `None` if the enum contains an unknown value deserialized from
3072 /// the integer representation of enums.
3073 pub fn name(&self) -> std::option::Option<&str> {
3074 match self {
3075 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3076 Self::Creating => std::option::Option::Some("CREATING"),
3077 Self::PendingTwoFactorAuthRegistration => {
3078 std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
3079 }
3080 Self::Active => std::option::Option::Some("ACTIVE"),
3081 Self::Disabling => std::option::Option::Some("DISABLING"),
3082 Self::Disabled => std::option::Option::Some("DISABLED"),
3083 Self::Deleting => std::option::Option::Some("DELETING"),
3084 Self::Deleted => std::option::Option::Some("DELETED"),
3085 Self::Failed => std::option::Option::Some("FAILED"),
3086 Self::UnknownValue(u) => u.0.name(),
3087 }
3088 }
3089 }
3090
3091 impl std::default::Default for State {
3092 fn default() -> Self {
3093 use std::convert::From;
3094 Self::from(0)
3095 }
3096 }
3097
3098 impl std::fmt::Display for State {
3099 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3100 wkt::internal::display_enum(f, self.name(), self.value())
3101 }
3102 }
3103
3104 impl std::convert::From<i32> for State {
3105 fn from(value: i32) -> Self {
3106 match value {
3107 0 => Self::Unspecified,
3108 1 => Self::Creating,
3109 2 => Self::PendingTwoFactorAuthRegistration,
3110 3 => Self::Active,
3111 4 => Self::Disabling,
3112 5 => Self::Disabled,
3113 6 => Self::Deleting,
3114 7 => Self::Deleted,
3115 8 => Self::Failed,
3116 _ => Self::UnknownValue(state::UnknownValue(
3117 wkt::internal::UnknownEnumValue::Integer(value),
3118 )),
3119 }
3120 }
3121 }
3122
3123 impl std::convert::From<&str> for State {
3124 fn from(value: &str) -> Self {
3125 use std::string::ToString;
3126 match value {
3127 "STATE_UNSPECIFIED" => Self::Unspecified,
3128 "CREATING" => Self::Creating,
3129 "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
3130 "ACTIVE" => Self::Active,
3131 "DISABLING" => Self::Disabling,
3132 "DISABLED" => Self::Disabled,
3133 "DELETING" => Self::Deleting,
3134 "DELETED" => Self::Deleted,
3135 "FAILED" => Self::Failed,
3136 _ => Self::UnknownValue(state::UnknownValue(
3137 wkt::internal::UnknownEnumValue::String(value.to_string()),
3138 )),
3139 }
3140 }
3141 }
3142
3143 impl serde::ser::Serialize for State {
3144 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3145 where
3146 S: serde::Serializer,
3147 {
3148 match self {
3149 Self::Unspecified => serializer.serialize_i32(0),
3150 Self::Creating => serializer.serialize_i32(1),
3151 Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
3152 Self::Active => serializer.serialize_i32(3),
3153 Self::Disabling => serializer.serialize_i32(4),
3154 Self::Disabled => serializer.serialize_i32(5),
3155 Self::Deleting => serializer.serialize_i32(6),
3156 Self::Deleted => serializer.serialize_i32(7),
3157 Self::Failed => serializer.serialize_i32(8),
3158 Self::UnknownValue(u) => u.0.serialize(serializer),
3159 }
3160 }
3161 }
3162
3163 impl<'de> serde::de::Deserialize<'de> for State {
3164 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3165 where
3166 D: serde::Deserializer<'de>,
3167 {
3168 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3169 ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
3170 ))
3171 }
3172 }
3173}
3174
3175/// A
3176/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3177/// represents a proposal to perform an operation on a
3178/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3179///
3180/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3181/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3182#[derive(Clone, Default, PartialEq)]
3183#[non_exhaustive]
3184pub struct SingleTenantHsmInstanceProposal {
3185 /// Identifier. The resource name for this
3186 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
3187 /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
3188 ///
3189 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3190 pub name: std::string::String,
3191
3192 /// Output only. The time at which the
3193 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3194 /// was created.
3195 ///
3196 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3197 pub create_time: std::option::Option<wkt::Timestamp>,
3198
3199 /// Output only. The state of the
3200 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3201 ///
3202 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3203 pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3204
3205 /// Output only. The root cause of the most recent failure. Only present if
3206 /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3207 /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3208 ///
3209 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3210 pub failure_reason: std::string::String,
3211
3212 /// Output only. The time at which the
3213 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3214 /// was deleted.
3215 ///
3216 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3217 pub delete_time: std::option::Option<wkt::Timestamp>,
3218
3219 /// Output only. The time at which the soft-deleted
3220 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3221 /// will be permanently purged. This field is only populated
3222 /// when the state is DELETED and will be set a time after expiration of the
3223 /// proposal, i.e. >= expire_time or (create_time + ttl).
3224 ///
3225 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3226 pub purge_time: std::option::Option<wkt::Timestamp>,
3227
3228 /// The approval parameters for the
3229 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3230 /// The type of parameters is determined by the operation being proposed.
3231 ///
3232 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3233 pub approval_parameters:
3234 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3235
3236 /// The expiration of the
3237 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3238 /// If not set, the
3239 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3240 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3241 /// time is 5 minutes.
3242 ///
3243 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3244 pub expiration:
3245 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3246
3247 /// The operation to perform on the
3248 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3249 ///
3250 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3251 pub operation:
3252 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3253
3254 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3255}
3256
3257impl SingleTenantHsmInstanceProposal {
3258 pub fn new() -> Self {
3259 std::default::Default::default()
3260 }
3261
3262 /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3263 ///
3264 /// # Example
3265 /// ```ignore,no_run
3266 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3267 /// let x = SingleTenantHsmInstanceProposal::new().set_name("example");
3268 /// ```
3269 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3270 self.name = v.into();
3271 self
3272 }
3273
3274 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3275 ///
3276 /// # Example
3277 /// ```ignore,no_run
3278 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3279 /// use wkt::Timestamp;
3280 /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3281 /// ```
3282 pub fn set_create_time<T>(mut self, v: T) -> Self
3283 where
3284 T: std::convert::Into<wkt::Timestamp>,
3285 {
3286 self.create_time = std::option::Option::Some(v.into());
3287 self
3288 }
3289
3290 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3291 ///
3292 /// # Example
3293 /// ```ignore,no_run
3294 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3295 /// use wkt::Timestamp;
3296 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3297 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3298 /// ```
3299 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3300 where
3301 T: std::convert::Into<wkt::Timestamp>,
3302 {
3303 self.create_time = v.map(|x| x.into());
3304 self
3305 }
3306
3307 /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3308 ///
3309 /// # Example
3310 /// ```ignore,no_run
3311 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3312 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3313 /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3314 /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3315 /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3316 /// ```
3317 pub fn set_state<
3318 T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3319 >(
3320 mut self,
3321 v: T,
3322 ) -> Self {
3323 self.state = v.into();
3324 self
3325 }
3326
3327 /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3328 ///
3329 /// # Example
3330 /// ```ignore,no_run
3331 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3332 /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3333 /// ```
3334 pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3335 self.failure_reason = v.into();
3336 self
3337 }
3338
3339 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3340 ///
3341 /// # Example
3342 /// ```ignore,no_run
3343 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3344 /// use wkt::Timestamp;
3345 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3346 /// ```
3347 pub fn set_delete_time<T>(mut self, v: T) -> Self
3348 where
3349 T: std::convert::Into<wkt::Timestamp>,
3350 {
3351 self.delete_time = std::option::Option::Some(v.into());
3352 self
3353 }
3354
3355 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3356 ///
3357 /// # Example
3358 /// ```ignore,no_run
3359 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3360 /// use wkt::Timestamp;
3361 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3362 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3363 /// ```
3364 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3365 where
3366 T: std::convert::Into<wkt::Timestamp>,
3367 {
3368 self.delete_time = v.map(|x| x.into());
3369 self
3370 }
3371
3372 /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3373 ///
3374 /// # Example
3375 /// ```ignore,no_run
3376 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3377 /// use wkt::Timestamp;
3378 /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3379 /// ```
3380 pub fn set_purge_time<T>(mut self, v: T) -> Self
3381 where
3382 T: std::convert::Into<wkt::Timestamp>,
3383 {
3384 self.purge_time = std::option::Option::Some(v.into());
3385 self
3386 }
3387
3388 /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3389 ///
3390 /// # Example
3391 /// ```ignore,no_run
3392 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3393 /// use wkt::Timestamp;
3394 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3395 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3396 /// ```
3397 pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3398 where
3399 T: std::convert::Into<wkt::Timestamp>,
3400 {
3401 self.purge_time = v.map(|x| x.into());
3402 self
3403 }
3404
3405 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3406 ///
3407 /// Note that all the setters affecting `approval_parameters` are mutually
3408 /// exclusive.
3409 ///
3410 /// # Example
3411 /// ```ignore,no_run
3412 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3413 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3414 /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3415 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3416 /// ```
3417 pub fn set_approval_parameters<
3418 T: std::convert::Into<
3419 std::option::Option<
3420 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3421 >,
3422 >,
3423 >(
3424 mut self,
3425 v: T,
3426 ) -> Self {
3427 self.approval_parameters = v.into();
3428 self
3429 }
3430
3431 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3432 /// if it holds a `QuorumParameters`, `None` if the field is not set or
3433 /// holds a different branch.
3434 pub fn quorum_parameters(
3435 &self,
3436 ) -> std::option::Option<
3437 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3438 > {
3439 #[allow(unreachable_patterns)]
3440 self.approval_parameters.as_ref().and_then(|v| match v {
3441 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3442 _ => std::option::Option::None,
3443 })
3444 }
3445
3446 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3447 /// to hold a `QuorumParameters`.
3448 ///
3449 /// Note that all the setters affecting `approval_parameters` are
3450 /// mutually exclusive.
3451 ///
3452 /// # Example
3453 /// ```ignore,no_run
3454 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3455 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3456 /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3457 /// assert!(x.quorum_parameters().is_some());
3458 /// assert!(x.required_action_quorum_parameters().is_none());
3459 /// ```
3460 pub fn set_quorum_parameters<
3461 T: std::convert::Into<
3462 std::boxed::Box<
3463 crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3464 >,
3465 >,
3466 >(
3467 mut self,
3468 v: T,
3469 ) -> Self {
3470 self.approval_parameters = std::option::Option::Some(
3471 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3472 v.into(),
3473 ),
3474 );
3475 self
3476 }
3477
3478 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3479 /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3480 /// holds a different branch.
3481 pub fn required_action_quorum_parameters(
3482 &self,
3483 ) -> std::option::Option<
3484 &std::boxed::Box<
3485 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3486 >,
3487 > {
3488 #[allow(unreachable_patterns)]
3489 self.approval_parameters.as_ref().and_then(|v| match v {
3490 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3491 _ => std::option::Option::None,
3492 })
3493 }
3494
3495 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3496 /// to hold a `RequiredActionQuorumParameters`.
3497 ///
3498 /// Note that all the setters affecting `approval_parameters` are
3499 /// mutually exclusive.
3500 ///
3501 /// # Example
3502 /// ```ignore,no_run
3503 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3504 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3505 /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3506 /// assert!(x.required_action_quorum_parameters().is_some());
3507 /// assert!(x.quorum_parameters().is_none());
3508 /// ```
3509 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{
3510 self.approval_parameters = std::option::Option::Some(
3511 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3512 v.into()
3513 )
3514 );
3515 self
3516 }
3517
3518 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3519 ///
3520 /// Note that all the setters affecting `expiration` are mutually
3521 /// exclusive.
3522 ///
3523 /// # Example
3524 /// ```ignore,no_run
3525 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3526 /// use wkt::Timestamp;
3527 /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3528 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3529 /// ```
3530 pub fn set_expiration<
3531 T: std::convert::Into<
3532 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3533 >,
3534 >(
3535 mut self,
3536 v: T,
3537 ) -> Self {
3538 self.expiration = v.into();
3539 self
3540 }
3541
3542 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3543 /// if it holds a `ExpireTime`, `None` if the field is not set or
3544 /// holds a different branch.
3545 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3546 #[allow(unreachable_patterns)]
3547 self.expiration.as_ref().and_then(|v| match v {
3548 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3549 std::option::Option::Some(v)
3550 }
3551 _ => std::option::Option::None,
3552 })
3553 }
3554
3555 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3556 /// to hold a `ExpireTime`.
3557 ///
3558 /// Note that all the setters affecting `expiration` are
3559 /// mutually exclusive.
3560 ///
3561 /// # Example
3562 /// ```ignore,no_run
3563 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3564 /// use wkt::Timestamp;
3565 /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3566 /// assert!(x.expire_time().is_some());
3567 /// assert!(x.ttl().is_none());
3568 /// ```
3569 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3570 mut self,
3571 v: T,
3572 ) -> Self {
3573 self.expiration = std::option::Option::Some(
3574 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3575 );
3576 self
3577 }
3578
3579 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3580 /// if it holds a `Ttl`, `None` if the field is not set or
3581 /// holds a different branch.
3582 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3583 #[allow(unreachable_patterns)]
3584 self.expiration.as_ref().and_then(|v| match v {
3585 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3586 std::option::Option::Some(v)
3587 }
3588 _ => std::option::Option::None,
3589 })
3590 }
3591
3592 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3593 /// to hold a `Ttl`.
3594 ///
3595 /// Note that all the setters affecting `expiration` are
3596 /// mutually exclusive.
3597 ///
3598 /// # Example
3599 /// ```ignore,no_run
3600 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3601 /// use wkt::Duration;
3602 /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3603 /// assert!(x.ttl().is_some());
3604 /// assert!(x.expire_time().is_none());
3605 /// ```
3606 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3607 self.expiration = std::option::Option::Some(
3608 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3609 );
3610 self
3611 }
3612
3613 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3614 ///
3615 /// Note that all the setters affecting `operation` are mutually
3616 /// exclusive.
3617 ///
3618 /// # Example
3619 /// ```ignore,no_run
3620 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3621 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3622 /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3623 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3624 /// ```
3625 pub fn set_operation<
3626 T: std::convert::Into<
3627 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3628 >,
3629 >(
3630 mut self,
3631 v: T,
3632 ) -> Self {
3633 self.operation = v.into();
3634 self
3635 }
3636
3637 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3638 /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3639 /// holds a different branch.
3640 pub fn register_two_factor_auth_keys(
3641 &self,
3642 ) -> std::option::Option<
3643 &std::boxed::Box<
3644 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3645 >,
3646 > {
3647 #[allow(unreachable_patterns)]
3648 self.operation.as_ref().and_then(|v| match v {
3649 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3650 _ => std::option::Option::None,
3651 })
3652 }
3653
3654 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3655 /// to hold a `RegisterTwoFactorAuthKeys`.
3656 ///
3657 /// Note that all the setters affecting `operation` are
3658 /// mutually exclusive.
3659 ///
3660 /// # Example
3661 /// ```ignore,no_run
3662 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3663 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3664 /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3665 /// assert!(x.register_two_factor_auth_keys().is_some());
3666 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3667 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3668 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3669 /// assert!(x.add_quorum_member().is_none());
3670 /// assert!(x.remove_quorum_member().is_none());
3671 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3672 /// ```
3673 pub fn set_register_two_factor_auth_keys<
3674 T: std::convert::Into<
3675 std::boxed::Box<
3676 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3677 >,
3678 >,
3679 >(
3680 mut self,
3681 v: T,
3682 ) -> Self {
3683 self.operation = std::option::Option::Some(
3684 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3685 v.into(),
3686 ),
3687 );
3688 self
3689 }
3690
3691 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3692 /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3693 /// holds a different branch.
3694 pub fn disable_single_tenant_hsm_instance(
3695 &self,
3696 ) -> std::option::Option<
3697 &std::boxed::Box<
3698 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3699 >,
3700 > {
3701 #[allow(unreachable_patterns)]
3702 self.operation.as_ref().and_then(|v| match v {
3703 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3704 _ => std::option::Option::None,
3705 })
3706 }
3707
3708 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3709 /// to hold a `DisableSingleTenantHsmInstance`.
3710 ///
3711 /// Note that all the setters affecting `operation` are
3712 /// mutually exclusive.
3713 ///
3714 /// # Example
3715 /// ```ignore,no_run
3716 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3717 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3718 /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3719 /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3720 /// assert!(x.register_two_factor_auth_keys().is_none());
3721 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3722 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3723 /// assert!(x.add_quorum_member().is_none());
3724 /// assert!(x.remove_quorum_member().is_none());
3725 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3726 /// ```
3727 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{
3728 self.operation = std::option::Option::Some(
3729 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3730 v.into()
3731 )
3732 );
3733 self
3734 }
3735
3736 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3737 /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3738 /// holds a different branch.
3739 pub fn enable_single_tenant_hsm_instance(
3740 &self,
3741 ) -> std::option::Option<
3742 &std::boxed::Box<
3743 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3744 >,
3745 > {
3746 #[allow(unreachable_patterns)]
3747 self.operation.as_ref().and_then(|v| match v {
3748 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3749 _ => std::option::Option::None,
3750 })
3751 }
3752
3753 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3754 /// to hold a `EnableSingleTenantHsmInstance`.
3755 ///
3756 /// Note that all the setters affecting `operation` are
3757 /// mutually exclusive.
3758 ///
3759 /// # Example
3760 /// ```ignore,no_run
3761 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3762 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3763 /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3764 /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3765 /// assert!(x.register_two_factor_auth_keys().is_none());
3766 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3767 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3768 /// assert!(x.add_quorum_member().is_none());
3769 /// assert!(x.remove_quorum_member().is_none());
3770 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3771 /// ```
3772 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{
3773 self.operation = std::option::Option::Some(
3774 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3775 v.into()
3776 )
3777 );
3778 self
3779 }
3780
3781 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3782 /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3783 /// holds a different branch.
3784 pub fn delete_single_tenant_hsm_instance(
3785 &self,
3786 ) -> std::option::Option<
3787 &std::boxed::Box<
3788 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3789 >,
3790 > {
3791 #[allow(unreachable_patterns)]
3792 self.operation.as_ref().and_then(|v| match v {
3793 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3794 _ => std::option::Option::None,
3795 })
3796 }
3797
3798 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3799 /// to hold a `DeleteSingleTenantHsmInstance`.
3800 ///
3801 /// Note that all the setters affecting `operation` are
3802 /// mutually exclusive.
3803 ///
3804 /// # Example
3805 /// ```ignore,no_run
3806 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3807 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3808 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3809 /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3810 /// assert!(x.register_two_factor_auth_keys().is_none());
3811 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3812 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3813 /// assert!(x.add_quorum_member().is_none());
3814 /// assert!(x.remove_quorum_member().is_none());
3815 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3816 /// ```
3817 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{
3818 self.operation = std::option::Option::Some(
3819 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3820 v.into()
3821 )
3822 );
3823 self
3824 }
3825
3826 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3827 /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3828 /// holds a different branch.
3829 pub fn add_quorum_member(
3830 &self,
3831 ) -> std::option::Option<
3832 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3833 > {
3834 #[allow(unreachable_patterns)]
3835 self.operation.as_ref().and_then(|v| match v {
3836 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3837 std::option::Option::Some(v)
3838 }
3839 _ => std::option::Option::None,
3840 })
3841 }
3842
3843 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3844 /// to hold a `AddQuorumMember`.
3845 ///
3846 /// Note that all the setters affecting `operation` are
3847 /// mutually exclusive.
3848 ///
3849 /// # Example
3850 /// ```ignore,no_run
3851 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3852 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3853 /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3854 /// assert!(x.add_quorum_member().is_some());
3855 /// assert!(x.register_two_factor_auth_keys().is_none());
3856 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3857 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3858 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3859 /// assert!(x.remove_quorum_member().is_none());
3860 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3861 /// ```
3862 pub fn set_add_quorum_member<
3863 T: std::convert::Into<
3864 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3865 >,
3866 >(
3867 mut self,
3868 v: T,
3869 ) -> Self {
3870 self.operation = std::option::Option::Some(
3871 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3872 );
3873 self
3874 }
3875
3876 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3877 /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3878 /// holds a different branch.
3879 pub fn remove_quorum_member(
3880 &self,
3881 ) -> std::option::Option<
3882 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3883 > {
3884 #[allow(unreachable_patterns)]
3885 self.operation.as_ref().and_then(|v| match v {
3886 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3887 std::option::Option::Some(v)
3888 }
3889 _ => std::option::Option::None,
3890 })
3891 }
3892
3893 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3894 /// to hold a `RemoveQuorumMember`.
3895 ///
3896 /// Note that all the setters affecting `operation` are
3897 /// mutually exclusive.
3898 ///
3899 /// # Example
3900 /// ```ignore,no_run
3901 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3902 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
3903 /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3904 /// assert!(x.remove_quorum_member().is_some());
3905 /// assert!(x.register_two_factor_auth_keys().is_none());
3906 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3907 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3908 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3909 /// assert!(x.add_quorum_member().is_none());
3910 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3911 /// ```
3912 pub fn set_remove_quorum_member<
3913 T: std::convert::Into<
3914 std::boxed::Box<
3915 crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
3916 >,
3917 >,
3918 >(
3919 mut self,
3920 v: T,
3921 ) -> Self {
3922 self.operation = std::option::Option::Some(
3923 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
3924 v.into(),
3925 ),
3926 );
3927 self
3928 }
3929
3930 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3931 /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
3932 /// holds a different branch.
3933 pub fn refresh_single_tenant_hsm_instance(
3934 &self,
3935 ) -> std::option::Option<
3936 &std::boxed::Box<
3937 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
3938 >,
3939 > {
3940 #[allow(unreachable_patterns)]
3941 self.operation.as_ref().and_then(|v| match v {
3942 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3943 _ => std::option::Option::None,
3944 })
3945 }
3946
3947 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3948 /// to hold a `RefreshSingleTenantHsmInstance`.
3949 ///
3950 /// Note that all the setters affecting `operation` are
3951 /// mutually exclusive.
3952 ///
3953 /// # Example
3954 /// ```ignore,no_run
3955 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3956 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
3957 /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
3958 /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
3959 /// assert!(x.register_two_factor_auth_keys().is_none());
3960 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3961 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3962 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3963 /// assert!(x.add_quorum_member().is_none());
3964 /// assert!(x.remove_quorum_member().is_none());
3965 /// ```
3966 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{
3967 self.operation = std::option::Option::Some(
3968 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
3969 v.into()
3970 )
3971 );
3972 self
3973 }
3974}
3975
3976impl wkt::message::Message for SingleTenantHsmInstanceProposal {
3977 fn typename() -> &'static str {
3978 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
3979 }
3980}
3981
3982/// Defines additional types related to [SingleTenantHsmInstanceProposal].
3983pub mod single_tenant_hsm_instance_proposal {
3984 #[allow(unused_imports)]
3985 use super::*;
3986
3987 /// Parameters of quorum approval for the
3988 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3989 ///
3990 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3991 #[derive(Clone, Default, PartialEq)]
3992 #[non_exhaustive]
3993 pub struct QuorumParameters {
3994 /// Output only. The required numbers of approvers. This is the M value used
3995 /// for M of N quorum auth. It is less than the number of public keys.
3996 pub required_approver_count: i32,
3997
3998 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
3999 /// of N of these challenges are required to be signed to approve the
4000 /// operation.
4001 pub challenges: std::vec::Vec<crate::model::Challenge>,
4002
4003 /// Output only. The public keys associated with the 2FA keys that have
4004 /// already approved the
4005 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4006 /// by signing the challenge.
4007 ///
4008 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4009 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4010
4011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4012 }
4013
4014 impl QuorumParameters {
4015 pub fn new() -> Self {
4016 std::default::Default::default()
4017 }
4018
4019 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
4020 ///
4021 /// # Example
4022 /// ```ignore,no_run
4023 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4024 /// let x = QuorumParameters::new().set_required_approver_count(42);
4025 /// ```
4026 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4027 self.required_approver_count = v.into();
4028 self
4029 }
4030
4031 /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
4032 ///
4033 /// # Example
4034 /// ```ignore,no_run
4035 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4036 /// use google_cloud_kms_v1::model::Challenge;
4037 /// let x = QuorumParameters::new()
4038 /// .set_challenges([
4039 /// Challenge::default()/* use setters */,
4040 /// Challenge::default()/* use (different) setters */,
4041 /// ]);
4042 /// ```
4043 pub fn set_challenges<T, V>(mut self, v: T) -> Self
4044 where
4045 T: std::iter::IntoIterator<Item = V>,
4046 V: std::convert::Into<crate::model::Challenge>,
4047 {
4048 use std::iter::Iterator;
4049 self.challenges = v.into_iter().map(|i| i.into()).collect();
4050 self
4051 }
4052
4053 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
4054 ///
4055 /// # Example
4056 /// ```ignore,no_run
4057 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4058 /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4059 /// ```
4060 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4061 where
4062 T: std::iter::IntoIterator<Item = V>,
4063 V: std::convert::Into<std::string::String>,
4064 {
4065 use std::iter::Iterator;
4066 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4067 self
4068 }
4069 }
4070
4071 impl wkt::message::Message for QuorumParameters {
4072 fn typename() -> &'static str {
4073 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
4074 }
4075 }
4076
4077 /// Parameters for an approval that has both required challenges and a
4078 /// quorum.
4079 #[derive(Clone, Default, PartialEq)]
4080 #[non_exhaustive]
4081 pub struct RequiredActionQuorumParameters {
4082 /// Output only. A list of specific challenges that must be signed.
4083 /// For some operations, this will contain a single challenge.
4084 pub required_challenges: std::vec::Vec<crate::model::Challenge>,
4085
4086 /// Output only. The required number of quorum approvers. This is the M value
4087 /// used for M of N quorum auth. It is less than the number of public keys.
4088 pub required_approver_count: i32,
4089
4090 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4091 /// of N of these challenges are required to be signed to approve the
4092 /// operation.
4093 pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
4094
4095 /// Output only. The public keys associated with the 2FA keys that have
4096 /// already approved the
4097 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4098 /// by signing the challenge.
4099 ///
4100 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4101 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4102
4103 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4104 }
4105
4106 impl RequiredActionQuorumParameters {
4107 pub fn new() -> Self {
4108 std::default::Default::default()
4109 }
4110
4111 /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
4112 ///
4113 /// # Example
4114 /// ```ignore,no_run
4115 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4116 /// use google_cloud_kms_v1::model::Challenge;
4117 /// let x = RequiredActionQuorumParameters::new()
4118 /// .set_required_challenges([
4119 /// Challenge::default()/* use setters */,
4120 /// Challenge::default()/* use (different) setters */,
4121 /// ]);
4122 /// ```
4123 pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
4124 where
4125 T: std::iter::IntoIterator<Item = V>,
4126 V: std::convert::Into<crate::model::Challenge>,
4127 {
4128 use std::iter::Iterator;
4129 self.required_challenges = v.into_iter().map(|i| i.into()).collect();
4130 self
4131 }
4132
4133 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
4134 ///
4135 /// # Example
4136 /// ```ignore,no_run
4137 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4138 /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
4139 /// ```
4140 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4141 self.required_approver_count = v.into();
4142 self
4143 }
4144
4145 /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
4146 ///
4147 /// # Example
4148 /// ```ignore,no_run
4149 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4150 /// use google_cloud_kms_v1::model::Challenge;
4151 /// let x = RequiredActionQuorumParameters::new()
4152 /// .set_quorum_challenges([
4153 /// Challenge::default()/* use setters */,
4154 /// Challenge::default()/* use (different) setters */,
4155 /// ]);
4156 /// ```
4157 pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
4158 where
4159 T: std::iter::IntoIterator<Item = V>,
4160 V: std::convert::Into<crate::model::Challenge>,
4161 {
4162 use std::iter::Iterator;
4163 self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
4164 self
4165 }
4166
4167 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
4168 ///
4169 /// # Example
4170 /// ```ignore,no_run
4171 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4172 /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4173 /// ```
4174 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4175 where
4176 T: std::iter::IntoIterator<Item = V>,
4177 V: std::convert::Into<std::string::String>,
4178 {
4179 use std::iter::Iterator;
4180 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4181 self
4182 }
4183 }
4184
4185 impl wkt::message::Message for RequiredActionQuorumParameters {
4186 fn typename() -> &'static str {
4187 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
4188 }
4189 }
4190
4191 /// Register 2FA keys for the
4192 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4193 /// This operation requires all Challenges to be signed by 2FA keys. The
4194 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4195 /// be in the
4196 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4197 /// state to perform this operation.
4198 ///
4199 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4200 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4201 #[derive(Clone, Default, PartialEq)]
4202 #[non_exhaustive]
4203 pub struct RegisterTwoFactorAuthKeys {
4204 /// Required. The required numbers of approvers to set for the
4205 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4206 /// This is the M value used for M of N quorum auth. Must be greater than or
4207 /// equal to 2 and less than or equal to
4208 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4209 ///
4210 ///
4211 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4212 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4213 pub required_approver_count: i32,
4214
4215 /// Required. The public keys associated with the 2FA keys for M of N quorum
4216 /// auth. Public keys must be associated with RSA 2048 keys.
4217 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4218
4219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4220 }
4221
4222 impl RegisterTwoFactorAuthKeys {
4223 pub fn new() -> Self {
4224 std::default::Default::default()
4225 }
4226
4227 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4228 ///
4229 /// # Example
4230 /// ```ignore,no_run
4231 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4232 /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4233 /// ```
4234 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4235 self.required_approver_count = v.into();
4236 self
4237 }
4238
4239 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4240 ///
4241 /// # Example
4242 /// ```ignore,no_run
4243 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4244 /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4245 /// ```
4246 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4247 where
4248 T: std::iter::IntoIterator<Item = V>,
4249 V: std::convert::Into<std::string::String>,
4250 {
4251 use std::iter::Iterator;
4252 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4253 self
4254 }
4255 }
4256
4257 impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4258 fn typename() -> &'static str {
4259 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4260 }
4261 }
4262
4263 /// Disable the
4264 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4265 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4266 /// be in the
4267 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4268 /// perform this operation.
4269 ///
4270 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4271 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4272 #[derive(Clone, Default, PartialEq)]
4273 #[non_exhaustive]
4274 pub struct DisableSingleTenantHsmInstance {
4275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4276 }
4277
4278 impl DisableSingleTenantHsmInstance {
4279 pub fn new() -> Self {
4280 std::default::Default::default()
4281 }
4282 }
4283
4284 impl wkt::message::Message for DisableSingleTenantHsmInstance {
4285 fn typename() -> &'static str {
4286 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4287 }
4288 }
4289
4290 /// Enable the
4291 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4292 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4293 /// be in the
4294 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4295 /// state to perform this operation.
4296 ///
4297 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4298 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4299 #[derive(Clone, Default, PartialEq)]
4300 #[non_exhaustive]
4301 pub struct EnableSingleTenantHsmInstance {
4302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4303 }
4304
4305 impl EnableSingleTenantHsmInstance {
4306 pub fn new() -> Self {
4307 std::default::Default::default()
4308 }
4309 }
4310
4311 impl wkt::message::Message for EnableSingleTenantHsmInstance {
4312 fn typename() -> &'static str {
4313 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4314 }
4315 }
4316
4317 /// Delete the
4318 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4319 /// Deleting a
4320 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4321 /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4322 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4323 /// unusable. The
4324 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4325 /// not be in the
4326 /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4327 /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4328 /// to perform this operation.
4329 ///
4330 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4331 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4332 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4333 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4334 #[derive(Clone, Default, PartialEq)]
4335 #[non_exhaustive]
4336 pub struct DeleteSingleTenantHsmInstance {
4337 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4338 }
4339
4340 impl DeleteSingleTenantHsmInstance {
4341 pub fn new() -> Self {
4342 std::default::Default::default()
4343 }
4344 }
4345
4346 impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4347 fn typename() -> &'static str {
4348 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4349 }
4350 }
4351
4352 /// Add a quorum member to the
4353 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4354 /// This will increase the
4355 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4356 /// by 1. The
4357 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4358 /// be in the
4359 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4360 /// perform this operation.
4361 ///
4362 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4363 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4364 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4365 #[derive(Clone, Default, PartialEq)]
4366 #[non_exhaustive]
4367 pub struct AddQuorumMember {
4368 /// Required. The public key associated with the 2FA key for the new quorum
4369 /// member to add. Public keys must be associated with RSA 2048 keys.
4370 pub two_factor_public_key_pem: std::string::String,
4371
4372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4373 }
4374
4375 impl AddQuorumMember {
4376 pub fn new() -> Self {
4377 std::default::Default::default()
4378 }
4379
4380 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4381 ///
4382 /// # Example
4383 /// ```ignore,no_run
4384 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4385 /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4386 /// ```
4387 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4388 mut self,
4389 v: T,
4390 ) -> Self {
4391 self.two_factor_public_key_pem = v.into();
4392 self
4393 }
4394 }
4395
4396 impl wkt::message::Message for AddQuorumMember {
4397 fn typename() -> &'static str {
4398 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4399 }
4400 }
4401
4402 /// Remove a quorum member from the
4403 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4404 /// This will reduce
4405 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4406 /// by 1. The
4407 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4408 /// be in the
4409 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4410 /// perform this operation.
4411 ///
4412 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4413 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4414 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4415 #[derive(Clone, Default, PartialEq)]
4416 #[non_exhaustive]
4417 pub struct RemoveQuorumMember {
4418 /// Required. The public key associated with the 2FA key for the quorum
4419 /// member to remove. Public keys must be associated with RSA 2048 keys.
4420 pub two_factor_public_key_pem: std::string::String,
4421
4422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4423 }
4424
4425 impl RemoveQuorumMember {
4426 pub fn new() -> Self {
4427 std::default::Default::default()
4428 }
4429
4430 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4431 ///
4432 /// # Example
4433 /// ```ignore,no_run
4434 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4435 /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4436 /// ```
4437 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4438 mut self,
4439 v: T,
4440 ) -> Self {
4441 self.two_factor_public_key_pem = v.into();
4442 self
4443 }
4444 }
4445
4446 impl wkt::message::Message for RemoveQuorumMember {
4447 fn typename() -> &'static str {
4448 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4449 }
4450 }
4451
4452 /// Refreshes the
4453 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4454 /// This operation must be performed periodically to keep the
4455 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4456 /// active. This operation must be performed before
4457 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4458 /// has passed. The
4459 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4460 /// be in the
4461 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4462 /// perform this operation.
4463 ///
4464 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4465 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4466 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4467 #[derive(Clone, Default, PartialEq)]
4468 #[non_exhaustive]
4469 pub struct RefreshSingleTenantHsmInstance {
4470 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4471 }
4472
4473 impl RefreshSingleTenantHsmInstance {
4474 pub fn new() -> Self {
4475 std::default::Default::default()
4476 }
4477 }
4478
4479 impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4480 fn typename() -> &'static str {
4481 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4482 }
4483 }
4484
4485 /// The set of states of a
4486 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4487 ///
4488 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4489 ///
4490 /// # Working with unknown values
4491 ///
4492 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4493 /// additional enum variants at any time. Adding new variants is not considered
4494 /// a breaking change. Applications should write their code in anticipation of:
4495 ///
4496 /// - New values appearing in future releases of the client library, **and**
4497 /// - New values received dynamically, without application changes.
4498 ///
4499 /// Please consult the [Working with enums] section in the user guide for some
4500 /// guidelines.
4501 ///
4502 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
4503 #[derive(Clone, Debug, PartialEq)]
4504 #[non_exhaustive]
4505 pub enum State {
4506 /// Not specified.
4507 Unspecified,
4508 /// The
4509 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4510 /// is being created.
4511 ///
4512 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4513 Creating,
4514 /// The
4515 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4516 /// is pending approval.
4517 ///
4518 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4519 Pending,
4520 /// The
4521 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4522 /// has been approved.
4523 ///
4524 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4525 Approved,
4526 /// The
4527 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4528 /// is being executed.
4529 ///
4530 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4531 Running,
4532 /// The
4533 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4534 /// has been executed successfully.
4535 ///
4536 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4537 Succeeded,
4538 /// The
4539 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4540 /// has failed.
4541 ///
4542 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4543 Failed,
4544 /// The
4545 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4546 /// has been deleted and will be purged after the purge_time.
4547 ///
4548 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4549 Deleted,
4550 /// If set, the enum was initialized with an unknown value.
4551 ///
4552 /// Applications can examine the value using [State::value] or
4553 /// [State::name].
4554 UnknownValue(state::UnknownValue),
4555 }
4556
4557 #[doc(hidden)]
4558 pub mod state {
4559 #[allow(unused_imports)]
4560 use super::*;
4561 #[derive(Clone, Debug, PartialEq)]
4562 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4563 }
4564
4565 impl State {
4566 /// Gets the enum value.
4567 ///
4568 /// Returns `None` if the enum contains an unknown value deserialized from
4569 /// the string representation of enums.
4570 pub fn value(&self) -> std::option::Option<i32> {
4571 match self {
4572 Self::Unspecified => std::option::Option::Some(0),
4573 Self::Creating => std::option::Option::Some(1),
4574 Self::Pending => std::option::Option::Some(2),
4575 Self::Approved => std::option::Option::Some(3),
4576 Self::Running => std::option::Option::Some(4),
4577 Self::Succeeded => std::option::Option::Some(5),
4578 Self::Failed => std::option::Option::Some(6),
4579 Self::Deleted => std::option::Option::Some(7),
4580 Self::UnknownValue(u) => u.0.value(),
4581 }
4582 }
4583
4584 /// Gets the enum value as a string.
4585 ///
4586 /// Returns `None` if the enum contains an unknown value deserialized from
4587 /// the integer representation of enums.
4588 pub fn name(&self) -> std::option::Option<&str> {
4589 match self {
4590 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4591 Self::Creating => std::option::Option::Some("CREATING"),
4592 Self::Pending => std::option::Option::Some("PENDING"),
4593 Self::Approved => std::option::Option::Some("APPROVED"),
4594 Self::Running => std::option::Option::Some("RUNNING"),
4595 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4596 Self::Failed => std::option::Option::Some("FAILED"),
4597 Self::Deleted => std::option::Option::Some("DELETED"),
4598 Self::UnknownValue(u) => u.0.name(),
4599 }
4600 }
4601 }
4602
4603 impl std::default::Default for State {
4604 fn default() -> Self {
4605 use std::convert::From;
4606 Self::from(0)
4607 }
4608 }
4609
4610 impl std::fmt::Display for State {
4611 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4612 wkt::internal::display_enum(f, self.name(), self.value())
4613 }
4614 }
4615
4616 impl std::convert::From<i32> for State {
4617 fn from(value: i32) -> Self {
4618 match value {
4619 0 => Self::Unspecified,
4620 1 => Self::Creating,
4621 2 => Self::Pending,
4622 3 => Self::Approved,
4623 4 => Self::Running,
4624 5 => Self::Succeeded,
4625 6 => Self::Failed,
4626 7 => Self::Deleted,
4627 _ => Self::UnknownValue(state::UnknownValue(
4628 wkt::internal::UnknownEnumValue::Integer(value),
4629 )),
4630 }
4631 }
4632 }
4633
4634 impl std::convert::From<&str> for State {
4635 fn from(value: &str) -> Self {
4636 use std::string::ToString;
4637 match value {
4638 "STATE_UNSPECIFIED" => Self::Unspecified,
4639 "CREATING" => Self::Creating,
4640 "PENDING" => Self::Pending,
4641 "APPROVED" => Self::Approved,
4642 "RUNNING" => Self::Running,
4643 "SUCCEEDED" => Self::Succeeded,
4644 "FAILED" => Self::Failed,
4645 "DELETED" => Self::Deleted,
4646 _ => Self::UnknownValue(state::UnknownValue(
4647 wkt::internal::UnknownEnumValue::String(value.to_string()),
4648 )),
4649 }
4650 }
4651 }
4652
4653 impl serde::ser::Serialize for State {
4654 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4655 where
4656 S: serde::Serializer,
4657 {
4658 match self {
4659 Self::Unspecified => serializer.serialize_i32(0),
4660 Self::Creating => serializer.serialize_i32(1),
4661 Self::Pending => serializer.serialize_i32(2),
4662 Self::Approved => serializer.serialize_i32(3),
4663 Self::Running => serializer.serialize_i32(4),
4664 Self::Succeeded => serializer.serialize_i32(5),
4665 Self::Failed => serializer.serialize_i32(6),
4666 Self::Deleted => serializer.serialize_i32(7),
4667 Self::UnknownValue(u) => u.0.serialize(serializer),
4668 }
4669 }
4670 }
4671
4672 impl<'de> serde::de::Deserialize<'de> for State {
4673 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4674 where
4675 D: serde::Deserializer<'de>,
4676 {
4677 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4678 ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4679 ))
4680 }
4681 }
4682
4683 /// The approval parameters for the
4684 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4685 /// The type of parameters is determined by the operation being proposed.
4686 ///
4687 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4688 #[derive(Clone, Debug, PartialEq)]
4689 #[non_exhaustive]
4690 pub enum ApprovalParameters {
4691 /// Output only. The quorum approval parameters for the
4692 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4693 ///
4694 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4695 QuorumParameters(
4696 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4697 ),
4698 /// Output only. Parameters for an approval of a
4699 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4700 /// that has both required challenges and a quorum.
4701 ///
4702 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4703 RequiredActionQuorumParameters(
4704 std::boxed::Box<
4705 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4706 >,
4707 ),
4708 }
4709
4710 /// The expiration of the
4711 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4712 /// If not set, the
4713 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4714 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4715 /// time is 5 minutes.
4716 ///
4717 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4718 #[derive(Clone, Debug, PartialEq)]
4719 #[non_exhaustive]
4720 pub enum Expiration {
4721 /// The time at which the
4722 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4723 /// will expire if not approved and executed.
4724 ///
4725 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4726 ExpireTime(std::boxed::Box<wkt::Timestamp>),
4727 /// Input only. The TTL for the
4728 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4729 /// Proposals will expire after this duration.
4730 ///
4731 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4732 Ttl(std::boxed::Box<wkt::Duration>),
4733 }
4734
4735 /// The operation to perform on the
4736 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4737 ///
4738 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4739 #[derive(Clone, Debug, PartialEq)]
4740 #[non_exhaustive]
4741 pub enum Operation {
4742 /// Register 2FA keys for the
4743 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4744 /// This operation requires all N Challenges to be signed by 2FA keys. The
4745 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4746 /// must be in the
4747 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4748 /// state to perform this operation.
4749 ///
4750 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4751 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4752 RegisterTwoFactorAuthKeys(
4753 std::boxed::Box<
4754 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4755 >,
4756 ),
4757 /// Disable the
4758 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4759 /// The
4760 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4761 /// must be in the
4762 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4763 /// to perform this operation.
4764 ///
4765 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4766 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4767 DisableSingleTenantHsmInstance(
4768 std::boxed::Box<
4769 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4770 >,
4771 ),
4772 /// Enable the
4773 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4774 /// The
4775 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4776 /// must be in the
4777 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4778 /// state to perform this operation.
4779 ///
4780 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4781 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4782 EnableSingleTenantHsmInstance(
4783 std::boxed::Box<
4784 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4785 >,
4786 ),
4787 /// Delete the
4788 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4789 /// Deleting a
4790 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4791 /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4792 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4793 /// unusable. The
4794 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4795 /// must be in the
4796 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
4797 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4798 /// state to perform this operation.
4799 ///
4800 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4801 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4802 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4803 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4804 DeleteSingleTenantHsmInstance(
4805 std::boxed::Box<
4806 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
4807 >,
4808 ),
4809 /// Add a quorum member to the
4810 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4811 /// This will increase the
4812 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4813 /// by 1. The
4814 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4815 /// must be in the
4816 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4817 /// to perform this operation.
4818 ///
4819 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4820 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4821 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4822 AddQuorumMember(
4823 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
4824 ),
4825 /// Remove a quorum member from the
4826 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4827 /// This will reduce
4828 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4829 /// by 1. The
4830 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4831 /// must be in the
4832 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4833 /// to perform this operation.
4834 ///
4835 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4836 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4837 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4838 RemoveQuorumMember(
4839 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
4840 ),
4841 /// Refreshes the
4842 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4843 /// This operation must be performed periodically to keep the
4844 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4845 /// active. This operation must be performed before
4846 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4847 /// has passed. The
4848 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4849 /// must be in the
4850 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4851 /// to perform this operation.
4852 ///
4853 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4854 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4855 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4856 RefreshSingleTenantHsmInstance(
4857 std::boxed::Box<
4858 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4859 >,
4860 ),
4861 }
4862}
4863
4864/// A challenge to be signed by a 2FA key.
4865#[derive(Clone, Default, PartialEq)]
4866#[non_exhaustive]
4867pub struct Challenge {
4868 /// Output only. The challenge to be signed by the 2FA key indicated by the
4869 /// public key.
4870 pub challenge: ::bytes::Bytes,
4871
4872 /// Output only. The public key associated with the 2FA key that should sign
4873 /// the challenge.
4874 pub public_key_pem: std::string::String,
4875
4876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4877}
4878
4879impl Challenge {
4880 pub fn new() -> Self {
4881 std::default::Default::default()
4882 }
4883
4884 /// Sets the value of [challenge][crate::model::Challenge::challenge].
4885 ///
4886 /// # Example
4887 /// ```ignore,no_run
4888 /// # use google_cloud_kms_v1::model::Challenge;
4889 /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
4890 /// ```
4891 pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4892 self.challenge = v.into();
4893 self
4894 }
4895
4896 /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
4897 ///
4898 /// # Example
4899 /// ```ignore,no_run
4900 /// # use google_cloud_kms_v1::model::Challenge;
4901 /// let x = Challenge::new().set_public_key_pem("example");
4902 /// ```
4903 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4904 self.public_key_pem = v.into();
4905 self
4906 }
4907}
4908
4909impl wkt::message::Message for Challenge {
4910 fn typename() -> &'static str {
4911 "type.googleapis.com/google.cloud.kms.v1.Challenge"
4912 }
4913}
4914
4915/// A reply to a challenge signed by a 2FA key.
4916#[derive(Clone, Default, PartialEq)]
4917#[non_exhaustive]
4918pub struct ChallengeReply {
4919 /// Required. The signed challenge associated with the 2FA key.
4920 /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
4921 pub signed_challenge: ::bytes::Bytes,
4922
4923 /// Required. The public key associated with the 2FA key.
4924 pub public_key_pem: std::string::String,
4925
4926 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4927}
4928
4929impl ChallengeReply {
4930 pub fn new() -> Self {
4931 std::default::Default::default()
4932 }
4933
4934 /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
4935 ///
4936 /// # Example
4937 /// ```ignore,no_run
4938 /// # use google_cloud_kms_v1::model::ChallengeReply;
4939 /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
4940 /// ```
4941 pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4942 self.signed_challenge = v.into();
4943 self
4944 }
4945
4946 /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
4947 ///
4948 /// # Example
4949 /// ```ignore,no_run
4950 /// # use google_cloud_kms_v1::model::ChallengeReply;
4951 /// let x = ChallengeReply::new().set_public_key_pem("example");
4952 /// ```
4953 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4954 self.public_key_pem = v.into();
4955 self
4956 }
4957}
4958
4959impl wkt::message::Message for ChallengeReply {
4960 fn typename() -> &'static str {
4961 "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
4962 }
4963}
4964
4965/// Request message for
4966/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
4967///
4968/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
4969#[derive(Clone, Default, PartialEq)]
4970#[non_exhaustive]
4971pub struct ListSingleTenantHsmInstancesRequest {
4972 /// Required. The resource name of the location associated with the
4973 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4974 /// list, in the format `projects/*/locations/*`.
4975 ///
4976 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4977 pub parent: std::string::String,
4978
4979 /// Optional. Optional limit on the number of
4980 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
4981 /// include in the response. Further
4982 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
4983 /// subsequently be
4984 /// obtained by including the
4985 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
4986 /// in a subsequent request. If unspecified, the server will pick an
4987 /// appropriate default.
4988 ///
4989 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4990 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4991 pub page_size: i32,
4992
4993 /// Optional. Optional pagination token, returned earlier via
4994 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
4995 ///
4996 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
4997 pub page_token: std::string::String,
4998
4999 /// Optional. Only include resources that match the filter in the response. For
5000 /// more information, see
5001 /// [Sorting and filtering list
5002 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5003 pub filter: std::string::String,
5004
5005 /// Optional. Specify how the results should be sorted. If not specified, the
5006 /// results will be sorted in the default order. For more information, see
5007 /// [Sorting and filtering list
5008 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5009 pub order_by: std::string::String,
5010
5011 /// Optional. If set to true,
5012 /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
5013 /// will also return
5014 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
5015 /// DELETED state.
5016 ///
5017 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5018 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5019 pub show_deleted: bool,
5020
5021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5022}
5023
5024impl ListSingleTenantHsmInstancesRequest {
5025 pub fn new() -> Self {
5026 std::default::Default::default()
5027 }
5028
5029 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
5030 ///
5031 /// # Example
5032 /// ```ignore,no_run
5033 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5034 /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
5035 /// ```
5036 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5037 self.parent = v.into();
5038 self
5039 }
5040
5041 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
5042 ///
5043 /// # Example
5044 /// ```ignore,no_run
5045 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5046 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
5047 /// ```
5048 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5049 self.page_size = v.into();
5050 self
5051 }
5052
5053 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
5054 ///
5055 /// # Example
5056 /// ```ignore,no_run
5057 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5058 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
5059 /// ```
5060 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5061 self.page_token = v.into();
5062 self
5063 }
5064
5065 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
5066 ///
5067 /// # Example
5068 /// ```ignore,no_run
5069 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5070 /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
5071 /// ```
5072 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5073 self.filter = v.into();
5074 self
5075 }
5076
5077 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
5078 ///
5079 /// # Example
5080 /// ```ignore,no_run
5081 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5082 /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
5083 /// ```
5084 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5085 self.order_by = v.into();
5086 self
5087 }
5088
5089 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
5090 ///
5091 /// # Example
5092 /// ```ignore,no_run
5093 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5094 /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
5095 /// ```
5096 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5097 self.show_deleted = v.into();
5098 self
5099 }
5100}
5101
5102impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
5103 fn typename() -> &'static str {
5104 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
5105 }
5106}
5107
5108/// Response message for
5109/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5110///
5111/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5112#[derive(Clone, Default, PartialEq)]
5113#[non_exhaustive]
5114pub struct ListSingleTenantHsmInstancesResponse {
5115 /// The list of
5116 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
5117 ///
5118 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5119 pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
5120
5121 /// A token to retrieve next page of results. Pass this value in
5122 /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
5123 /// to retrieve the next page of results.
5124 ///
5125 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
5126 pub next_page_token: std::string::String,
5127
5128 /// The total number of
5129 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
5130 /// that matched the query.
5131 ///
5132 /// This field is not populated if
5133 /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
5134 /// is applied.
5135 ///
5136 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
5137 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5138 pub total_size: i32,
5139
5140 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5141}
5142
5143impl ListSingleTenantHsmInstancesResponse {
5144 pub fn new() -> Self {
5145 std::default::Default::default()
5146 }
5147
5148 /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
5149 ///
5150 /// # Example
5151 /// ```ignore,no_run
5152 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5153 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5154 /// let x = ListSingleTenantHsmInstancesResponse::new()
5155 /// .set_single_tenant_hsm_instances([
5156 /// SingleTenantHsmInstance::default()/* use setters */,
5157 /// SingleTenantHsmInstance::default()/* use (different) setters */,
5158 /// ]);
5159 /// ```
5160 pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
5161 where
5162 T: std::iter::IntoIterator<Item = V>,
5163 V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5164 {
5165 use std::iter::Iterator;
5166 self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
5167 self
5168 }
5169
5170 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
5171 ///
5172 /// # Example
5173 /// ```ignore,no_run
5174 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5175 /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
5176 /// ```
5177 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5178 self.next_page_token = v.into();
5179 self
5180 }
5181
5182 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
5183 ///
5184 /// # Example
5185 /// ```ignore,no_run
5186 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5187 /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
5188 /// ```
5189 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5190 self.total_size = v.into();
5191 self
5192 }
5193}
5194
5195impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
5196 fn typename() -> &'static str {
5197 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
5198 }
5199}
5200
5201#[doc(hidden)]
5202impl google_cloud_gax::paginator::internal::PageableResponse
5203 for ListSingleTenantHsmInstancesResponse
5204{
5205 type PageItem = crate::model::SingleTenantHsmInstance;
5206
5207 fn items(self) -> std::vec::Vec<Self::PageItem> {
5208 self.single_tenant_hsm_instances
5209 }
5210
5211 fn next_page_token(&self) -> std::string::String {
5212 use std::clone::Clone;
5213 self.next_page_token.clone()
5214 }
5215}
5216
5217/// Request message for
5218/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5219///
5220/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5221#[derive(Clone, Default, PartialEq)]
5222#[non_exhaustive]
5223pub struct GetSingleTenantHsmInstanceRequest {
5224 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5225 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5226 /// to get.
5227 ///
5228 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5229 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5230 pub name: std::string::String,
5231
5232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5233}
5234
5235impl GetSingleTenantHsmInstanceRequest {
5236 pub fn new() -> Self {
5237 std::default::Default::default()
5238 }
5239
5240 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5241 ///
5242 /// # Example
5243 /// ```ignore,no_run
5244 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5245 /// let x = GetSingleTenantHsmInstanceRequest::new().set_name("example");
5246 /// ```
5247 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5248 self.name = v.into();
5249 self
5250 }
5251}
5252
5253impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5254 fn typename() -> &'static str {
5255 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5256 }
5257}
5258
5259/// Request message for
5260/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5261///
5262/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5263#[derive(Clone, Default, PartialEq)]
5264#[non_exhaustive]
5265pub struct CreateSingleTenantHsmInstanceRequest {
5266 /// Required. The resource name of the location associated with the
5267 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5268 /// the format `projects/*/locations/*`.
5269 ///
5270 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5271 pub parent: std::string::String,
5272
5273 /// Optional. It must be unique within a location and match the regular
5274 /// expression `[a-zA-Z0-9_-]{1,63}`.
5275 pub single_tenant_hsm_instance_id: std::string::String,
5276
5277 /// Required. An
5278 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5279 /// initial field values.
5280 ///
5281 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5282 pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5283
5284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5285}
5286
5287impl CreateSingleTenantHsmInstanceRequest {
5288 pub fn new() -> Self {
5289 std::default::Default::default()
5290 }
5291
5292 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5293 ///
5294 /// # Example
5295 /// ```ignore,no_run
5296 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5297 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5298 /// ```
5299 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5300 self.parent = v.into();
5301 self
5302 }
5303
5304 /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5305 ///
5306 /// # Example
5307 /// ```ignore,no_run
5308 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5309 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5310 /// ```
5311 pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5312 mut self,
5313 v: T,
5314 ) -> Self {
5315 self.single_tenant_hsm_instance_id = v.into();
5316 self
5317 }
5318
5319 /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5320 ///
5321 /// # Example
5322 /// ```ignore,no_run
5323 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5324 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5325 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5326 /// ```
5327 pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5328 where
5329 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5330 {
5331 self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5332 self
5333 }
5334
5335 /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5336 ///
5337 /// # Example
5338 /// ```ignore,no_run
5339 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5340 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5341 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5342 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5343 /// ```
5344 pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5345 where
5346 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5347 {
5348 self.single_tenant_hsm_instance = v.map(|x| x.into());
5349 self
5350 }
5351}
5352
5353impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5354 fn typename() -> &'static str {
5355 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5356 }
5357}
5358
5359/// Metadata message for
5360/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5361/// long-running operation response.
5362///
5363/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5364#[derive(Clone, Default, PartialEq)]
5365#[non_exhaustive]
5366pub struct CreateSingleTenantHsmInstanceMetadata {
5367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5368}
5369
5370impl CreateSingleTenantHsmInstanceMetadata {
5371 pub fn new() -> Self {
5372 std::default::Default::default()
5373 }
5374}
5375
5376impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5377 fn typename() -> &'static str {
5378 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5379 }
5380}
5381
5382/// Request message for
5383/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5384///
5385/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5386#[derive(Clone, Default, PartialEq)]
5387#[non_exhaustive]
5388pub struct CreateSingleTenantHsmInstanceProposalRequest {
5389 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5390 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5391 /// associated with the
5392 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5393 ///
5394 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5395 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5396 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5397 pub parent: std::string::String,
5398
5399 /// Optional. It must be unique within a location and match the regular
5400 /// expression `[a-zA-Z0-9_-]{1,63}`.
5401 pub single_tenant_hsm_instance_proposal_id: std::string::String,
5402
5403 /// Required. The
5404 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5405 /// to create.
5406 ///
5407 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5408 pub single_tenant_hsm_instance_proposal:
5409 std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5410
5411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5412}
5413
5414impl CreateSingleTenantHsmInstanceProposalRequest {
5415 pub fn new() -> Self {
5416 std::default::Default::default()
5417 }
5418
5419 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5420 ///
5421 /// # Example
5422 /// ```ignore,no_run
5423 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5424 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent("example");
5425 /// ```
5426 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5427 self.parent = v.into();
5428 self
5429 }
5430
5431 /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5432 ///
5433 /// # Example
5434 /// ```ignore,no_run
5435 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5436 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5437 /// ```
5438 pub fn set_single_tenant_hsm_instance_proposal_id<
5439 T: std::convert::Into<std::string::String>,
5440 >(
5441 mut self,
5442 v: T,
5443 ) -> Self {
5444 self.single_tenant_hsm_instance_proposal_id = v.into();
5445 self
5446 }
5447
5448 /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5449 ///
5450 /// # Example
5451 /// ```ignore,no_run
5452 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5453 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5454 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5455 /// ```
5456 pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5457 where
5458 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5459 {
5460 self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5461 self
5462 }
5463
5464 /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5465 ///
5466 /// # Example
5467 /// ```ignore,no_run
5468 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5469 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5470 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5471 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5472 /// ```
5473 pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5474 mut self,
5475 v: std::option::Option<T>,
5476 ) -> Self
5477 where
5478 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5479 {
5480 self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5481 self
5482 }
5483}
5484
5485impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5486 fn typename() -> &'static str {
5487 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5488 }
5489}
5490
5491/// Metadata message for
5492/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5493/// long-running operation response.
5494///
5495/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5496#[derive(Clone, Default, PartialEq)]
5497#[non_exhaustive]
5498pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5499 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5500}
5501
5502impl CreateSingleTenantHsmInstanceProposalMetadata {
5503 pub fn new() -> Self {
5504 std::default::Default::default()
5505 }
5506}
5507
5508impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5509 fn typename() -> &'static str {
5510 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5511 }
5512}
5513
5514/// Request message for
5515/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5516///
5517/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5518#[derive(Clone, Default, PartialEq)]
5519#[non_exhaustive]
5520pub struct GetSingleTenantHsmInstanceProposalRequest {
5521 /// Required. The
5522 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5523 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5524 /// to get.
5525 ///
5526 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5527 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5528 pub name: std::string::String,
5529
5530 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5531}
5532
5533impl GetSingleTenantHsmInstanceProposalRequest {
5534 pub fn new() -> Self {
5535 std::default::Default::default()
5536 }
5537
5538 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5539 ///
5540 /// # Example
5541 /// ```ignore,no_run
5542 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5543 /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5544 /// ```
5545 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5546 self.name = v.into();
5547 self
5548 }
5549}
5550
5551impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5552 fn typename() -> &'static str {
5553 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5554 }
5555}
5556
5557/// Request message for
5558/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5559///
5560/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5561#[derive(Clone, Default, PartialEq)]
5562#[non_exhaustive]
5563pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5564 /// Required. The
5565 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5566 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5567 /// to approve.
5568 ///
5569 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5570 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5571 pub name: std::string::String,
5572
5573 /// The approval payload. The type of approval payload must correspond to the
5574 /// type of approval_parameters in the proposal.
5575 pub approval_payload: std::option::Option<
5576 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5577 >,
5578
5579 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5580}
5581
5582impl ApproveSingleTenantHsmInstanceProposalRequest {
5583 pub fn new() -> Self {
5584 std::default::Default::default()
5585 }
5586
5587 /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5588 ///
5589 /// # Example
5590 /// ```ignore,no_run
5591 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5592 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5593 /// ```
5594 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5595 self.name = v.into();
5596 self
5597 }
5598
5599 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5600 ///
5601 /// Note that all the setters affecting `approval_payload` are mutually
5602 /// exclusive.
5603 ///
5604 /// # Example
5605 /// ```ignore,no_run
5606 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5607 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5608 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5609 /// google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5610 /// ```
5611 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
5612 {
5613 self.approval_payload = v.into();
5614 self
5615 }
5616
5617 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5618 /// if it holds a `QuorumReply`, `None` if the field is not set or
5619 /// holds a different branch.
5620 pub fn quorum_reply(
5621 &self,
5622 ) -> std::option::Option<
5623 &std::boxed::Box<
5624 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5625 >,
5626 > {
5627 #[allow(unreachable_patterns)]
5628 self.approval_payload.as_ref().and_then(|v| match v {
5629 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5630 _ => std::option::Option::None,
5631 })
5632 }
5633
5634 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5635 /// to hold a `QuorumReply`.
5636 ///
5637 /// Note that all the setters affecting `approval_payload` are
5638 /// mutually exclusive.
5639 ///
5640 /// # Example
5641 /// ```ignore,no_run
5642 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5643 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5644 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5645 /// assert!(x.quorum_reply().is_some());
5646 /// assert!(x.required_action_quorum_reply().is_none());
5647 /// ```
5648 pub fn set_quorum_reply<
5649 T: std::convert::Into<
5650 std::boxed::Box<
5651 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5652 >,
5653 >,
5654 >(
5655 mut self,
5656 v: T,
5657 ) -> Self {
5658 self.approval_payload = std::option::Option::Some(
5659 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5660 v.into()
5661 )
5662 );
5663 self
5664 }
5665
5666 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5667 /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5668 /// holds a different branch.
5669 pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5670 #[allow(unreachable_patterns)]
5671 self.approval_payload.as_ref().and_then(|v| match v {
5672 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5673 _ => std::option::Option::None,
5674 })
5675 }
5676
5677 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5678 /// to hold a `RequiredActionQuorumReply`.
5679 ///
5680 /// Note that all the setters affecting `approval_payload` are
5681 /// mutually exclusive.
5682 ///
5683 /// # Example
5684 /// ```ignore,no_run
5685 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5686 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5687 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5688 /// assert!(x.required_action_quorum_reply().is_some());
5689 /// assert!(x.quorum_reply().is_none());
5690 /// ```
5691 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{
5692 self.approval_payload = std::option::Option::Some(
5693 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5694 v.into()
5695 )
5696 );
5697 self
5698 }
5699}
5700
5701impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5702 fn typename() -> &'static str {
5703 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5704 }
5705}
5706
5707/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5708pub mod approve_single_tenant_hsm_instance_proposal_request {
5709 #[allow(unused_imports)]
5710 use super::*;
5711
5712 /// The reply to
5713 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5714 /// for approving the proposal.
5715 ///
5716 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5717 #[derive(Clone, Default, PartialEq)]
5718 #[non_exhaustive]
5719 pub struct QuorumReply {
5720 /// Required. The challenge replies to approve the proposal. Challenge
5721 /// replies can be sent across multiple requests. The proposal will be
5722 /// approved when
5723 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5724 /// challenge replies are provided.
5725 ///
5726 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5727 pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5728
5729 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5730 }
5731
5732 impl QuorumReply {
5733 pub fn new() -> Self {
5734 std::default::Default::default()
5735 }
5736
5737 /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5738 ///
5739 /// # Example
5740 /// ```ignore,no_run
5741 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5742 /// use google_cloud_kms_v1::model::ChallengeReply;
5743 /// let x = QuorumReply::new()
5744 /// .set_challenge_replies([
5745 /// ChallengeReply::default()/* use setters */,
5746 /// ChallengeReply::default()/* use (different) setters */,
5747 /// ]);
5748 /// ```
5749 pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5750 where
5751 T: std::iter::IntoIterator<Item = V>,
5752 V: std::convert::Into<crate::model::ChallengeReply>,
5753 {
5754 use std::iter::Iterator;
5755 self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5756 self
5757 }
5758 }
5759
5760 impl wkt::message::Message for QuorumReply {
5761 fn typename() -> &'static str {
5762 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
5763 }
5764 }
5765
5766 /// The reply to
5767 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5768 /// for approving the proposal.
5769 ///
5770 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5771 #[derive(Clone, Default, PartialEq)]
5772 #[non_exhaustive]
5773 pub struct RequiredActionQuorumReply {
5774 /// Required. All required challenges must be signed for the proposal to be
5775 /// approved. These can be sent across multiple requests.
5776 pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5777
5778 /// Required. Quorum members' signed challenge replies. These can be provided
5779 /// across multiple requests. The proposal will be approved when
5780 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
5781 /// quorum_challenge_replies are provided and when all
5782 /// required_challenge_replies are provided.
5783 ///
5784 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
5785 pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5786
5787 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5788 }
5789
5790 impl RequiredActionQuorumReply {
5791 pub fn new() -> Self {
5792 std::default::Default::default()
5793 }
5794
5795 /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
5796 ///
5797 /// # Example
5798 /// ```ignore,no_run
5799 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5800 /// use google_cloud_kms_v1::model::ChallengeReply;
5801 /// let x = RequiredActionQuorumReply::new()
5802 /// .set_required_challenge_replies([
5803 /// ChallengeReply::default()/* use setters */,
5804 /// ChallengeReply::default()/* use (different) setters */,
5805 /// ]);
5806 /// ```
5807 pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
5808 where
5809 T: std::iter::IntoIterator<Item = V>,
5810 V: std::convert::Into<crate::model::ChallengeReply>,
5811 {
5812 use std::iter::Iterator;
5813 self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5814 self
5815 }
5816
5817 /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
5818 ///
5819 /// # Example
5820 /// ```ignore,no_run
5821 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5822 /// use google_cloud_kms_v1::model::ChallengeReply;
5823 /// let x = RequiredActionQuorumReply::new()
5824 /// .set_quorum_challenge_replies([
5825 /// ChallengeReply::default()/* use setters */,
5826 /// ChallengeReply::default()/* use (different) setters */,
5827 /// ]);
5828 /// ```
5829 pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
5830 where
5831 T: std::iter::IntoIterator<Item = V>,
5832 V: std::convert::Into<crate::model::ChallengeReply>,
5833 {
5834 use std::iter::Iterator;
5835 self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5836 self
5837 }
5838 }
5839
5840 impl wkt::message::Message for RequiredActionQuorumReply {
5841 fn typename() -> &'static str {
5842 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
5843 }
5844 }
5845
5846 /// The approval payload. The type of approval payload must correspond to the
5847 /// type of approval_parameters in the proposal.
5848 #[derive(Clone, Debug, PartialEq)]
5849 #[non_exhaustive]
5850 pub enum ApprovalPayload {
5851 /// Required. The reply to
5852 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5853 /// for approving the proposal.
5854 ///
5855 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5856 QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
5857 /// Required. The reply to
5858 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5859 /// for approving the proposal.
5860 ///
5861 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5862 RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
5863 }
5864}
5865
5866/// Response message for
5867/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5868///
5869/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5870#[derive(Clone, Default, PartialEq)]
5871#[non_exhaustive]
5872pub struct ApproveSingleTenantHsmInstanceProposalResponse {
5873 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5874}
5875
5876impl ApproveSingleTenantHsmInstanceProposalResponse {
5877 pub fn new() -> Self {
5878 std::default::Default::default()
5879 }
5880}
5881
5882impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
5883 fn typename() -> &'static str {
5884 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
5885 }
5886}
5887
5888/// Request message for
5889/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5890///
5891/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5892#[derive(Clone, Default, PartialEq)]
5893#[non_exhaustive]
5894pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
5895 /// Required. The
5896 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5897 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5898 /// to execute.
5899 ///
5900 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5901 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5902 pub name: std::string::String,
5903
5904 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5905}
5906
5907impl ExecuteSingleTenantHsmInstanceProposalRequest {
5908 pub fn new() -> Self {
5909 std::default::Default::default()
5910 }
5911
5912 /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
5913 ///
5914 /// # Example
5915 /// ```ignore,no_run
5916 /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
5917 /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
5918 /// ```
5919 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5920 self.name = v.into();
5921 self
5922 }
5923}
5924
5925impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
5926 fn typename() -> &'static str {
5927 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
5928 }
5929}
5930
5931/// Response message for
5932/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
5933///
5934/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5935#[derive(Clone, Default, PartialEq)]
5936#[non_exhaustive]
5937pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
5938 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5939}
5940
5941impl ExecuteSingleTenantHsmInstanceProposalResponse {
5942 pub fn new() -> Self {
5943 std::default::Default::default()
5944 }
5945}
5946
5947impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
5948 fn typename() -> &'static str {
5949 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
5950 }
5951}
5952
5953/// Metadata message for
5954/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
5955/// long-running operation response.
5956///
5957/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
5958#[derive(Clone, Default, PartialEq)]
5959#[non_exhaustive]
5960pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
5961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5962}
5963
5964impl ExecuteSingleTenantHsmInstanceProposalMetadata {
5965 pub fn new() -> Self {
5966 std::default::Default::default()
5967 }
5968}
5969
5970impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
5971 fn typename() -> &'static str {
5972 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
5973 }
5974}
5975
5976/// Request message for
5977/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
5978///
5979/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
5980#[derive(Clone, Default, PartialEq)]
5981#[non_exhaustive]
5982pub struct ListSingleTenantHsmInstanceProposalsRequest {
5983 /// Required. The resource name of the single tenant HSM instance associated
5984 /// with the
5985 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5986 /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
5987 ///
5988 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5989 pub parent: std::string::String,
5990
5991 /// Optional. Optional limit on the number of
5992 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5993 /// to include in the response. Further
5994 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5995 /// can subsequently be obtained by including the
5996 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
5997 /// in a subsequent request. If unspecified, the server will pick an
5998 /// appropriate default.
5999 ///
6000 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6001 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6002 pub page_size: i32,
6003
6004 /// Optional. Optional pagination token, returned earlier via
6005 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
6006 ///
6007 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6008 pub page_token: std::string::String,
6009
6010 /// Optional. Only include resources that match the filter in the response. For
6011 /// more information, see
6012 /// [Sorting and filtering list
6013 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6014 pub filter: std::string::String,
6015
6016 /// Optional. Specify how the results should be sorted. If not specified, the
6017 /// results will be sorted in the default order. For more information, see
6018 /// [Sorting and filtering list
6019 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6020 pub order_by: std::string::String,
6021
6022 /// Optional. If set to true,
6023 /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
6024 /// will also return
6025 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6026 /// in DELETED state.
6027 ///
6028 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6029 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6030 pub show_deleted: bool,
6031
6032 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6033}
6034
6035impl ListSingleTenantHsmInstanceProposalsRequest {
6036 pub fn new() -> Self {
6037 std::default::Default::default()
6038 }
6039
6040 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
6041 ///
6042 /// # Example
6043 /// ```ignore,no_run
6044 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6045 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent("example");
6046 /// ```
6047 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6048 self.parent = v.into();
6049 self
6050 }
6051
6052 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
6053 ///
6054 /// # Example
6055 /// ```ignore,no_run
6056 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6057 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
6058 /// ```
6059 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6060 self.page_size = v.into();
6061 self
6062 }
6063
6064 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
6065 ///
6066 /// # Example
6067 /// ```ignore,no_run
6068 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6069 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
6070 /// ```
6071 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6072 self.page_token = v.into();
6073 self
6074 }
6075
6076 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
6077 ///
6078 /// # Example
6079 /// ```ignore,no_run
6080 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6081 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
6082 /// ```
6083 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6084 self.filter = v.into();
6085 self
6086 }
6087
6088 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
6089 ///
6090 /// # Example
6091 /// ```ignore,no_run
6092 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6093 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
6094 /// ```
6095 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6096 self.order_by = v.into();
6097 self
6098 }
6099
6100 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
6101 ///
6102 /// # Example
6103 /// ```ignore,no_run
6104 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6105 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
6106 /// ```
6107 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6108 self.show_deleted = v.into();
6109 self
6110 }
6111}
6112
6113impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
6114 fn typename() -> &'static str {
6115 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
6116 }
6117}
6118
6119/// Response message for
6120/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6121///
6122/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6123#[derive(Clone, Default, PartialEq)]
6124#[non_exhaustive]
6125pub struct ListSingleTenantHsmInstanceProposalsResponse {
6126 /// The list of
6127 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
6128 ///
6129 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6130 pub single_tenant_hsm_instance_proposals:
6131 std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
6132
6133 /// A token to retrieve next page of results. Pass this value in
6134 /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
6135 /// to retrieve the next page of results.
6136 ///
6137 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
6138 pub next_page_token: std::string::String,
6139
6140 /// The total number of
6141 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6142 /// that matched the query.
6143 ///
6144 /// This field is not populated if
6145 /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
6146 /// is applied.
6147 ///
6148 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
6149 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6150 pub total_size: i32,
6151
6152 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6153}
6154
6155impl ListSingleTenantHsmInstanceProposalsResponse {
6156 pub fn new() -> Self {
6157 std::default::Default::default()
6158 }
6159
6160 /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
6161 ///
6162 /// # Example
6163 /// ```ignore,no_run
6164 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6165 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
6166 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
6167 /// .set_single_tenant_hsm_instance_proposals([
6168 /// SingleTenantHsmInstanceProposal::default()/* use setters */,
6169 /// SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
6170 /// ]);
6171 /// ```
6172 pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
6173 where
6174 T: std::iter::IntoIterator<Item = V>,
6175 V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
6176 {
6177 use std::iter::Iterator;
6178 self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
6179 self
6180 }
6181
6182 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
6183 ///
6184 /// # Example
6185 /// ```ignore,no_run
6186 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6187 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
6188 /// ```
6189 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6190 self.next_page_token = v.into();
6191 self
6192 }
6193
6194 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
6195 ///
6196 /// # Example
6197 /// ```ignore,no_run
6198 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6199 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6200 /// ```
6201 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6202 self.total_size = v.into();
6203 self
6204 }
6205}
6206
6207impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6208 fn typename() -> &'static str {
6209 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6210 }
6211}
6212
6213#[doc(hidden)]
6214impl google_cloud_gax::paginator::internal::PageableResponse
6215 for ListSingleTenantHsmInstanceProposalsResponse
6216{
6217 type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6218
6219 fn items(self) -> std::vec::Vec<Self::PageItem> {
6220 self.single_tenant_hsm_instance_proposals
6221 }
6222
6223 fn next_page_token(&self) -> std::string::String {
6224 use std::clone::Clone;
6225 self.next_page_token.clone()
6226 }
6227}
6228
6229/// Request message for
6230/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6231///
6232/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6233#[derive(Clone, Default, PartialEq)]
6234#[non_exhaustive]
6235pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6236 /// Required. The
6237 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6238 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6239 /// to delete.
6240 ///
6241 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6242 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6243 pub name: std::string::String,
6244
6245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6246}
6247
6248impl DeleteSingleTenantHsmInstanceProposalRequest {
6249 pub fn new() -> Self {
6250 std::default::Default::default()
6251 }
6252
6253 /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6254 ///
6255 /// # Example
6256 /// ```ignore,no_run
6257 /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6258 /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name("example");
6259 /// ```
6260 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6261 self.name = v.into();
6262 self
6263 }
6264}
6265
6266impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6267 fn typename() -> &'static str {
6268 "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6269 }
6270}
6271
6272/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6273/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6274///
6275/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6276/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6277#[derive(Clone, Default, PartialEq)]
6278#[non_exhaustive]
6279pub struct KeyRing {
6280 /// Output only. The resource name for the
6281 /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6282 /// `projects/*/locations/*/keyRings/*`.
6283 ///
6284 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6285 pub name: std::string::String,
6286
6287 /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6288 /// was created.
6289 ///
6290 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6291 pub create_time: std::option::Option<wkt::Timestamp>,
6292
6293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6294}
6295
6296impl KeyRing {
6297 pub fn new() -> Self {
6298 std::default::Default::default()
6299 }
6300
6301 /// Sets the value of [name][crate::model::KeyRing::name].
6302 ///
6303 /// # Example
6304 /// ```ignore,no_run
6305 /// # use google_cloud_kms_v1::model::KeyRing;
6306 /// let x = KeyRing::new().set_name("example");
6307 /// ```
6308 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6309 self.name = v.into();
6310 self
6311 }
6312
6313 /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6314 ///
6315 /// # Example
6316 /// ```ignore,no_run
6317 /// # use google_cloud_kms_v1::model::KeyRing;
6318 /// use wkt::Timestamp;
6319 /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6320 /// ```
6321 pub fn set_create_time<T>(mut self, v: T) -> Self
6322 where
6323 T: std::convert::Into<wkt::Timestamp>,
6324 {
6325 self.create_time = std::option::Option::Some(v.into());
6326 self
6327 }
6328
6329 /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6330 ///
6331 /// # Example
6332 /// ```ignore,no_run
6333 /// # use google_cloud_kms_v1::model::KeyRing;
6334 /// use wkt::Timestamp;
6335 /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6336 /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6337 /// ```
6338 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6339 where
6340 T: std::convert::Into<wkt::Timestamp>,
6341 {
6342 self.create_time = v.map(|x| x.into());
6343 self
6344 }
6345}
6346
6347impl wkt::message::Message for KeyRing {
6348 fn typename() -> &'static str {
6349 "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6350 }
6351}
6352
6353/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6354/// can be used for cryptographic operations.
6355///
6356/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6357/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6358/// key material used in cryptographic operations.
6359///
6360/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6361/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6362#[derive(Clone, Default, PartialEq)]
6363#[non_exhaustive]
6364pub struct CryptoKey {
6365 /// Output only. The resource name for this
6366 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6367 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6368 ///
6369 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6370 pub name: std::string::String,
6371
6372 /// Output only. A copy of the "primary"
6373 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6374 /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6375 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6376 /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6377 ///
6378 /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6379 /// updated via
6380 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6381 ///
6382 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6383 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6384 /// may have a primary. For other keys, this field will be omitted.
6385 ///
6386 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6387 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6388 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6389 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6390 /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6391 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6392 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6393 pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6394
6395 /// Immutable. The immutable purpose of this
6396 /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6397 ///
6398 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6399 pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6400
6401 /// Output only. The time at which this
6402 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6403 ///
6404 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6405 pub create_time: std::option::Option<wkt::Timestamp>,
6406
6407 /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6408 /// the Key Management Service will automatically:
6409 ///
6410 /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6411 /// 1. Mark the new version as primary.
6412 ///
6413 /// Key rotations performed manually via
6414 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6415 /// and
6416 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6417 /// do not affect
6418 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6419 ///
6420 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6421 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6422 /// support automatic rotation. For other keys, this field must be omitted.
6423 ///
6424 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6425 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6426 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6427 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6428 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6429 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6430 pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6431
6432 /// A template describing settings for new
6433 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6434 /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6435 /// instances created by either
6436 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6437 /// or auto-rotation are controlled by this template.
6438 ///
6439 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6440 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6441 pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6442
6443 /// Labels with user-defined metadata. For more information, see
6444 /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6445 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6446
6447 /// Immutable. Whether this key may contain imported versions only.
6448 pub import_only: bool,
6449
6450 /// Immutable. The period of time that versions of this key spend in the
6451 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6452 /// state before transitioning to
6453 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6454 /// If not specified at creation time, the default duration is 30 days.
6455 ///
6456 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6457 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6458 pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6459
6460 /// Immutable. The resource name of the backend environment where the key
6461 /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6462 /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6463 /// where all related cryptographic operations are performed. Only applicable
6464 /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6465 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6466 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6467 /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6468 /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6469 /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6470 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6471 /// with the resource name in the format
6472 /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6473 /// Note, this list is non-exhaustive and may apply to additional
6474 /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6475 ///
6476 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6477 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6478 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6479 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6480 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6481 pub crypto_key_backend: std::string::String,
6482
6483 /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6484 /// If this field is present and this key is enrolled in Key Access
6485 /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6486 /// decrypt, and sign operations, and the operation will fail if rejected by
6487 /// the policy. The policy is defined by specifying zero or more allowed
6488 /// justification codes.
6489 /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6490 /// By default, this field is absent, and all justification codes are allowed.
6491 pub key_access_justifications_policy:
6492 std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6493
6494 /// Controls the rate of automatic rotation.
6495 pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6496
6497 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6498}
6499
6500impl CryptoKey {
6501 pub fn new() -> Self {
6502 std::default::Default::default()
6503 }
6504
6505 /// Sets the value of [name][crate::model::CryptoKey::name].
6506 ///
6507 /// # Example
6508 /// ```ignore,no_run
6509 /// # use google_cloud_kms_v1::model::CryptoKey;
6510 /// let x = CryptoKey::new().set_name("example");
6511 /// ```
6512 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6513 self.name = v.into();
6514 self
6515 }
6516
6517 /// Sets the value of [primary][crate::model::CryptoKey::primary].
6518 ///
6519 /// # Example
6520 /// ```ignore,no_run
6521 /// # use google_cloud_kms_v1::model::CryptoKey;
6522 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6523 /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6524 /// ```
6525 pub fn set_primary<T>(mut self, v: T) -> Self
6526 where
6527 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6528 {
6529 self.primary = std::option::Option::Some(v.into());
6530 self
6531 }
6532
6533 /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6534 ///
6535 /// # Example
6536 /// ```ignore,no_run
6537 /// # use google_cloud_kms_v1::model::CryptoKey;
6538 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6539 /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6540 /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6541 /// ```
6542 pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6543 where
6544 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6545 {
6546 self.primary = v.map(|x| x.into());
6547 self
6548 }
6549
6550 /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6551 ///
6552 /// # Example
6553 /// ```ignore,no_run
6554 /// # use google_cloud_kms_v1::model::CryptoKey;
6555 /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6556 /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6557 /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6558 /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6559 /// ```
6560 pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6561 mut self,
6562 v: T,
6563 ) -> Self {
6564 self.purpose = v.into();
6565 self
6566 }
6567
6568 /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6569 ///
6570 /// # Example
6571 /// ```ignore,no_run
6572 /// # use google_cloud_kms_v1::model::CryptoKey;
6573 /// use wkt::Timestamp;
6574 /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6575 /// ```
6576 pub fn set_create_time<T>(mut self, v: T) -> Self
6577 where
6578 T: std::convert::Into<wkt::Timestamp>,
6579 {
6580 self.create_time = std::option::Option::Some(v.into());
6581 self
6582 }
6583
6584 /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6585 ///
6586 /// # Example
6587 /// ```ignore,no_run
6588 /// # use google_cloud_kms_v1::model::CryptoKey;
6589 /// use wkt::Timestamp;
6590 /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6591 /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6592 /// ```
6593 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6594 where
6595 T: std::convert::Into<wkt::Timestamp>,
6596 {
6597 self.create_time = v.map(|x| x.into());
6598 self
6599 }
6600
6601 /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6602 ///
6603 /// # Example
6604 /// ```ignore,no_run
6605 /// # use google_cloud_kms_v1::model::CryptoKey;
6606 /// use wkt::Timestamp;
6607 /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6608 /// ```
6609 pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6610 where
6611 T: std::convert::Into<wkt::Timestamp>,
6612 {
6613 self.next_rotation_time = std::option::Option::Some(v.into());
6614 self
6615 }
6616
6617 /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6618 ///
6619 /// # Example
6620 /// ```ignore,no_run
6621 /// # use google_cloud_kms_v1::model::CryptoKey;
6622 /// use wkt::Timestamp;
6623 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6624 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6625 /// ```
6626 pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6627 where
6628 T: std::convert::Into<wkt::Timestamp>,
6629 {
6630 self.next_rotation_time = v.map(|x| x.into());
6631 self
6632 }
6633
6634 /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6635 ///
6636 /// # Example
6637 /// ```ignore,no_run
6638 /// # use google_cloud_kms_v1::model::CryptoKey;
6639 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6640 /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6641 /// ```
6642 pub fn set_version_template<T>(mut self, v: T) -> Self
6643 where
6644 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6645 {
6646 self.version_template = std::option::Option::Some(v.into());
6647 self
6648 }
6649
6650 /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6651 ///
6652 /// # Example
6653 /// ```ignore,no_run
6654 /// # use google_cloud_kms_v1::model::CryptoKey;
6655 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6656 /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6657 /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6658 /// ```
6659 pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6660 where
6661 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6662 {
6663 self.version_template = v.map(|x| x.into());
6664 self
6665 }
6666
6667 /// Sets the value of [labels][crate::model::CryptoKey::labels].
6668 ///
6669 /// # Example
6670 /// ```ignore,no_run
6671 /// # use google_cloud_kms_v1::model::CryptoKey;
6672 /// let x = CryptoKey::new().set_labels([
6673 /// ("key0", "abc"),
6674 /// ("key1", "xyz"),
6675 /// ]);
6676 /// ```
6677 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6678 where
6679 T: std::iter::IntoIterator<Item = (K, V)>,
6680 K: std::convert::Into<std::string::String>,
6681 V: std::convert::Into<std::string::String>,
6682 {
6683 use std::iter::Iterator;
6684 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6685 self
6686 }
6687
6688 /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6689 ///
6690 /// # Example
6691 /// ```ignore,no_run
6692 /// # use google_cloud_kms_v1::model::CryptoKey;
6693 /// let x = CryptoKey::new().set_import_only(true);
6694 /// ```
6695 pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6696 self.import_only = v.into();
6697 self
6698 }
6699
6700 /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6701 ///
6702 /// # Example
6703 /// ```ignore,no_run
6704 /// # use google_cloud_kms_v1::model::CryptoKey;
6705 /// use wkt::Duration;
6706 /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6707 /// ```
6708 pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6709 where
6710 T: std::convert::Into<wkt::Duration>,
6711 {
6712 self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6713 self
6714 }
6715
6716 /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6717 ///
6718 /// # Example
6719 /// ```ignore,no_run
6720 /// # use google_cloud_kms_v1::model::CryptoKey;
6721 /// use wkt::Duration;
6722 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6723 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6724 /// ```
6725 pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
6726 where
6727 T: std::convert::Into<wkt::Duration>,
6728 {
6729 self.destroy_scheduled_duration = v.map(|x| x.into());
6730 self
6731 }
6732
6733 /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
6734 ///
6735 /// # Example
6736 /// ```ignore,no_run
6737 /// # use google_cloud_kms_v1::model::CryptoKey;
6738 /// let x = CryptoKey::new().set_crypto_key_backend("example");
6739 /// ```
6740 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
6741 mut self,
6742 v: T,
6743 ) -> Self {
6744 self.crypto_key_backend = v.into();
6745 self
6746 }
6747
6748 /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6749 ///
6750 /// # Example
6751 /// ```ignore,no_run
6752 /// # use google_cloud_kms_v1::model::CryptoKey;
6753 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6754 /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
6755 /// ```
6756 pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
6757 where
6758 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6759 {
6760 self.key_access_justifications_policy = std::option::Option::Some(v.into());
6761 self
6762 }
6763
6764 /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6765 ///
6766 /// # Example
6767 /// ```ignore,no_run
6768 /// # use google_cloud_kms_v1::model::CryptoKey;
6769 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6770 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
6771 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
6772 /// ```
6773 pub fn set_or_clear_key_access_justifications_policy<T>(
6774 mut self,
6775 v: std::option::Option<T>,
6776 ) -> Self
6777 where
6778 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6779 {
6780 self.key_access_justifications_policy = v.map(|x| x.into());
6781 self
6782 }
6783
6784 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
6785 ///
6786 /// Note that all the setters affecting `rotation_schedule` are mutually
6787 /// exclusive.
6788 ///
6789 /// # Example
6790 /// ```ignore,no_run
6791 /// # use google_cloud_kms_v1::model::CryptoKey;
6792 /// use wkt::Duration;
6793 /// let x = CryptoKey::new().set_rotation_schedule(Some(
6794 /// google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
6795 /// ```
6796 pub fn set_rotation_schedule<
6797 T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
6798 >(
6799 mut self,
6800 v: T,
6801 ) -> Self {
6802 self.rotation_schedule = v.into();
6803 self
6804 }
6805
6806 /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6807 /// if it holds a `RotationPeriod`, `None` if the field is not set or
6808 /// holds a different branch.
6809 pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6810 #[allow(unreachable_patterns)]
6811 self.rotation_schedule.as_ref().and_then(|v| match v {
6812 crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
6813 std::option::Option::Some(v)
6814 }
6815 _ => std::option::Option::None,
6816 })
6817 }
6818
6819 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6820 /// to hold a `RotationPeriod`.
6821 ///
6822 /// Note that all the setters affecting `rotation_schedule` are
6823 /// mutually exclusive.
6824 ///
6825 /// # Example
6826 /// ```ignore,no_run
6827 /// # use google_cloud_kms_v1::model::CryptoKey;
6828 /// use wkt::Duration;
6829 /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
6830 /// assert!(x.rotation_period().is_some());
6831 /// ```
6832 pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
6833 mut self,
6834 v: T,
6835 ) -> Self {
6836 self.rotation_schedule = std::option::Option::Some(
6837 crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
6838 );
6839 self
6840 }
6841}
6842
6843impl wkt::message::Message for CryptoKey {
6844 fn typename() -> &'static str {
6845 "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
6846 }
6847}
6848
6849/// Defines additional types related to [CryptoKey].
6850pub mod crypto_key {
6851 #[allow(unused_imports)]
6852 use super::*;
6853
6854 /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
6855 /// describes the cryptographic capabilities of a
6856 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
6857 /// for the operations allowed by its purpose. For more information, see [Key
6858 /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
6859 ///
6860 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6861 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
6862 ///
6863 /// # Working with unknown values
6864 ///
6865 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6866 /// additional enum variants at any time. Adding new variants is not considered
6867 /// a breaking change. Applications should write their code in anticipation of:
6868 ///
6869 /// - New values appearing in future releases of the client library, **and**
6870 /// - New values received dynamically, without application changes.
6871 ///
6872 /// Please consult the [Working with enums] section in the user guide for some
6873 /// guidelines.
6874 ///
6875 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6876 #[derive(Clone, Debug, PartialEq)]
6877 #[non_exhaustive]
6878 pub enum CryptoKeyPurpose {
6879 /// Not specified.
6880 Unspecified,
6881 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6882 /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
6883 /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
6884 ///
6885 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6886 /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
6887 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6888 EncryptDecrypt,
6889 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6890 /// with
6891 /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
6892 /// and
6893 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6894 ///
6895 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6896 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
6897 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6898 AsymmetricSign,
6899 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6900 /// with
6901 /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
6902 /// and
6903 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
6904 ///
6905 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6906 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
6907 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6908 AsymmetricDecrypt,
6909 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6910 /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
6911 /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
6912 /// This purpose is meant to be used for interoperable symmetric
6913 /// encryption and does not support automatic CryptoKey rotation.
6914 ///
6915 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6916 /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
6917 /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
6918 RawEncryptDecrypt,
6919 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6920 /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
6921 ///
6922 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6923 /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
6924 Mac,
6925 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
6926 /// with
6927 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
6928 /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
6929 ///
6930 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6931 /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
6932 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
6933 KeyEncapsulation,
6934 /// If set, the enum was initialized with an unknown value.
6935 ///
6936 /// Applications can examine the value using [CryptoKeyPurpose::value] or
6937 /// [CryptoKeyPurpose::name].
6938 UnknownValue(crypto_key_purpose::UnknownValue),
6939 }
6940
6941 #[doc(hidden)]
6942 pub mod crypto_key_purpose {
6943 #[allow(unused_imports)]
6944 use super::*;
6945 #[derive(Clone, Debug, PartialEq)]
6946 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6947 }
6948
6949 impl CryptoKeyPurpose {
6950 /// Gets the enum value.
6951 ///
6952 /// Returns `None` if the enum contains an unknown value deserialized from
6953 /// the string representation of enums.
6954 pub fn value(&self) -> std::option::Option<i32> {
6955 match self {
6956 Self::Unspecified => std::option::Option::Some(0),
6957 Self::EncryptDecrypt => std::option::Option::Some(1),
6958 Self::AsymmetricSign => std::option::Option::Some(5),
6959 Self::AsymmetricDecrypt => std::option::Option::Some(6),
6960 Self::RawEncryptDecrypt => std::option::Option::Some(7),
6961 Self::Mac => std::option::Option::Some(9),
6962 Self::KeyEncapsulation => std::option::Option::Some(10),
6963 Self::UnknownValue(u) => u.0.value(),
6964 }
6965 }
6966
6967 /// Gets the enum value as a string.
6968 ///
6969 /// Returns `None` if the enum contains an unknown value deserialized from
6970 /// the integer representation of enums.
6971 pub fn name(&self) -> std::option::Option<&str> {
6972 match self {
6973 Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
6974 Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
6975 Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
6976 Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
6977 Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
6978 Self::Mac => std::option::Option::Some("MAC"),
6979 Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
6980 Self::UnknownValue(u) => u.0.name(),
6981 }
6982 }
6983 }
6984
6985 impl std::default::Default for CryptoKeyPurpose {
6986 fn default() -> Self {
6987 use std::convert::From;
6988 Self::from(0)
6989 }
6990 }
6991
6992 impl std::fmt::Display for CryptoKeyPurpose {
6993 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6994 wkt::internal::display_enum(f, self.name(), self.value())
6995 }
6996 }
6997
6998 impl std::convert::From<i32> for CryptoKeyPurpose {
6999 fn from(value: i32) -> Self {
7000 match value {
7001 0 => Self::Unspecified,
7002 1 => Self::EncryptDecrypt,
7003 5 => Self::AsymmetricSign,
7004 6 => Self::AsymmetricDecrypt,
7005 7 => Self::RawEncryptDecrypt,
7006 9 => Self::Mac,
7007 10 => Self::KeyEncapsulation,
7008 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7009 wkt::internal::UnknownEnumValue::Integer(value),
7010 )),
7011 }
7012 }
7013 }
7014
7015 impl std::convert::From<&str> for CryptoKeyPurpose {
7016 fn from(value: &str) -> Self {
7017 use std::string::ToString;
7018 match value {
7019 "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
7020 "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
7021 "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
7022 "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
7023 "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
7024 "MAC" => Self::Mac,
7025 "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
7026 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7027 wkt::internal::UnknownEnumValue::String(value.to_string()),
7028 )),
7029 }
7030 }
7031 }
7032
7033 impl serde::ser::Serialize for CryptoKeyPurpose {
7034 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7035 where
7036 S: serde::Serializer,
7037 {
7038 match self {
7039 Self::Unspecified => serializer.serialize_i32(0),
7040 Self::EncryptDecrypt => serializer.serialize_i32(1),
7041 Self::AsymmetricSign => serializer.serialize_i32(5),
7042 Self::AsymmetricDecrypt => serializer.serialize_i32(6),
7043 Self::RawEncryptDecrypt => serializer.serialize_i32(7),
7044 Self::Mac => serializer.serialize_i32(9),
7045 Self::KeyEncapsulation => serializer.serialize_i32(10),
7046 Self::UnknownValue(u) => u.0.serialize(serializer),
7047 }
7048 }
7049 }
7050
7051 impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
7052 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7053 where
7054 D: serde::Deserializer<'de>,
7055 {
7056 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
7057 ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
7058 ))
7059 }
7060 }
7061
7062 /// Controls the rate of automatic rotation.
7063 #[derive(Clone, Debug, PartialEq)]
7064 #[non_exhaustive]
7065 pub enum RotationSchedule {
7066 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7067 /// will be advanced by this period when the service automatically rotates a
7068 /// key. Must be at least 24 hours and at most 876,000 hours.
7069 ///
7070 /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
7071 /// set,
7072 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7073 /// must also be set.
7074 ///
7075 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
7076 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
7077 /// support automatic rotation. For other keys, this field must be omitted.
7078 ///
7079 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7080 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
7081 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7082 /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
7083 RotationPeriod(std::boxed::Box<wkt::Duration>),
7084 }
7085}
7086
7087/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
7088/// specifies the properties to use when creating a new
7089/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
7090/// with
7091/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
7092/// or automatically as a result of auto-rotation.
7093///
7094/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7095/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
7096/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7097#[derive(Clone, Default, PartialEq)]
7098#[non_exhaustive]
7099pub struct CryptoKeyVersionTemplate {
7100 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
7101 /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7102 /// template. Immutable. Defaults to
7103 /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
7104 ///
7105 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7106 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7107 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7108 pub protection_level: crate::model::ProtectionLevel,
7109
7110 /// Required.
7111 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7112 /// to use when creating a
7113 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7114 /// template.
7115 ///
7116 /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
7117 /// this field is omitted and
7118 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
7119 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7120 ///
7121 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7122 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7123 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7124 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7125 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7126
7127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7128}
7129
7130impl CryptoKeyVersionTemplate {
7131 pub fn new() -> Self {
7132 std::default::Default::default()
7133 }
7134
7135 /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
7136 ///
7137 /// # Example
7138 /// ```ignore,no_run
7139 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7140 /// use google_cloud_kms_v1::model::ProtectionLevel;
7141 /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
7142 /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
7143 /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
7144 /// ```
7145 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7146 mut self,
7147 v: T,
7148 ) -> Self {
7149 self.protection_level = v.into();
7150 self
7151 }
7152
7153 /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
7154 ///
7155 /// # Example
7156 /// ```ignore,no_run
7157 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7158 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7159 /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7160 /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7161 /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7162 /// ```
7163 pub fn set_algorithm<
7164 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7165 >(
7166 mut self,
7167 v: T,
7168 ) -> Self {
7169 self.algorithm = v.into();
7170 self
7171 }
7172}
7173
7174impl wkt::message::Message for CryptoKeyVersionTemplate {
7175 fn typename() -> &'static str {
7176 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
7177 }
7178}
7179
7180/// Contains an HSM-generated attestation about a key operation. For more
7181/// information, see [Verifying attestations]
7182/// (<https://cloud.google.com/kms/docs/attest-key>).
7183#[derive(Clone, Default, PartialEq)]
7184#[non_exhaustive]
7185pub struct KeyOperationAttestation {
7186 /// Output only. The format of the attestation data.
7187 pub format: crate::model::key_operation_attestation::AttestationFormat,
7188
7189 /// Output only. The attestation data provided by the HSM when the key
7190 /// operation was performed.
7191 pub content: ::bytes::Bytes,
7192
7193 /// Output only. The certificate chains needed to validate the attestation
7194 pub cert_chains:
7195 std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
7196
7197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7198}
7199
7200impl KeyOperationAttestation {
7201 pub fn new() -> Self {
7202 std::default::Default::default()
7203 }
7204
7205 /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7206 ///
7207 /// # Example
7208 /// ```ignore,no_run
7209 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7210 /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7211 /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7212 /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7213 /// ```
7214 pub fn set_format<
7215 T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7216 >(
7217 mut self,
7218 v: T,
7219 ) -> Self {
7220 self.format = v.into();
7221 self
7222 }
7223
7224 /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7225 ///
7226 /// # Example
7227 /// ```ignore,no_run
7228 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7229 /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7230 /// ```
7231 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7232 self.content = v.into();
7233 self
7234 }
7235
7236 /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7237 ///
7238 /// # Example
7239 /// ```ignore,no_run
7240 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7241 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7242 /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7243 /// ```
7244 pub fn set_cert_chains<T>(mut self, v: T) -> Self
7245 where
7246 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7247 {
7248 self.cert_chains = std::option::Option::Some(v.into());
7249 self
7250 }
7251
7252 /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7253 ///
7254 /// # Example
7255 /// ```ignore,no_run
7256 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7257 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7258 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7259 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7260 /// ```
7261 pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7262 where
7263 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7264 {
7265 self.cert_chains = v.map(|x| x.into());
7266 self
7267 }
7268}
7269
7270impl wkt::message::Message for KeyOperationAttestation {
7271 fn typename() -> &'static str {
7272 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7273 }
7274}
7275
7276/// Defines additional types related to [KeyOperationAttestation].
7277pub mod key_operation_attestation {
7278 #[allow(unused_imports)]
7279 use super::*;
7280
7281 /// Certificate chains needed to verify the attestation.
7282 /// Certificates in chains are PEM-encoded and are ordered based on
7283 /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7284 #[derive(Clone, Default, PartialEq)]
7285 #[non_exhaustive]
7286 pub struct CertificateChains {
7287 /// Cavium certificate chain corresponding to the attestation.
7288 pub cavium_certs: std::vec::Vec<std::string::String>,
7289
7290 /// Google card certificate chain corresponding to the attestation.
7291 pub google_card_certs: std::vec::Vec<std::string::String>,
7292
7293 /// Google partition certificate chain corresponding to the attestation.
7294 pub google_partition_certs: std::vec::Vec<std::string::String>,
7295
7296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7297 }
7298
7299 impl CertificateChains {
7300 pub fn new() -> Self {
7301 std::default::Default::default()
7302 }
7303
7304 /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7305 ///
7306 /// # Example
7307 /// ```ignore,no_run
7308 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7309 /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7310 /// ```
7311 pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7312 where
7313 T: std::iter::IntoIterator<Item = V>,
7314 V: std::convert::Into<std::string::String>,
7315 {
7316 use std::iter::Iterator;
7317 self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7318 self
7319 }
7320
7321 /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7322 ///
7323 /// # Example
7324 /// ```ignore,no_run
7325 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7326 /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7327 /// ```
7328 pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7329 where
7330 T: std::iter::IntoIterator<Item = V>,
7331 V: std::convert::Into<std::string::String>,
7332 {
7333 use std::iter::Iterator;
7334 self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7335 self
7336 }
7337
7338 /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7339 ///
7340 /// # Example
7341 /// ```ignore,no_run
7342 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7343 /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7344 /// ```
7345 pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7346 where
7347 T: std::iter::IntoIterator<Item = V>,
7348 V: std::convert::Into<std::string::String>,
7349 {
7350 use std::iter::Iterator;
7351 self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7352 self
7353 }
7354 }
7355
7356 impl wkt::message::Message for CertificateChains {
7357 fn typename() -> &'static str {
7358 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7359 }
7360 }
7361
7362 /// Attestation formats provided by the HSM.
7363 ///
7364 /// # Working with unknown values
7365 ///
7366 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7367 /// additional enum variants at any time. Adding new variants is not considered
7368 /// a breaking change. Applications should write their code in anticipation of:
7369 ///
7370 /// - New values appearing in future releases of the client library, **and**
7371 /// - New values received dynamically, without application changes.
7372 ///
7373 /// Please consult the [Working with enums] section in the user guide for some
7374 /// guidelines.
7375 ///
7376 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7377 #[derive(Clone, Debug, PartialEq)]
7378 #[non_exhaustive]
7379 pub enum AttestationFormat {
7380 /// Not specified.
7381 Unspecified,
7382 /// Cavium HSM attestation compressed with gzip. Note that this format is
7383 /// defined by Cavium and subject to change at any time.
7384 ///
7385 /// See
7386 /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7387 CaviumV1Compressed,
7388 /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7389 /// introduced in Cavium's version 3.2-08.
7390 CaviumV2Compressed,
7391 /// If set, the enum was initialized with an unknown value.
7392 ///
7393 /// Applications can examine the value using [AttestationFormat::value] or
7394 /// [AttestationFormat::name].
7395 UnknownValue(attestation_format::UnknownValue),
7396 }
7397
7398 #[doc(hidden)]
7399 pub mod attestation_format {
7400 #[allow(unused_imports)]
7401 use super::*;
7402 #[derive(Clone, Debug, PartialEq)]
7403 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7404 }
7405
7406 impl AttestationFormat {
7407 /// Gets the enum value.
7408 ///
7409 /// Returns `None` if the enum contains an unknown value deserialized from
7410 /// the string representation of enums.
7411 pub fn value(&self) -> std::option::Option<i32> {
7412 match self {
7413 Self::Unspecified => std::option::Option::Some(0),
7414 Self::CaviumV1Compressed => std::option::Option::Some(3),
7415 Self::CaviumV2Compressed => std::option::Option::Some(4),
7416 Self::UnknownValue(u) => u.0.value(),
7417 }
7418 }
7419
7420 /// Gets the enum value as a string.
7421 ///
7422 /// Returns `None` if the enum contains an unknown value deserialized from
7423 /// the integer representation of enums.
7424 pub fn name(&self) -> std::option::Option<&str> {
7425 match self {
7426 Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7427 Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7428 Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7429 Self::UnknownValue(u) => u.0.name(),
7430 }
7431 }
7432 }
7433
7434 impl std::default::Default for AttestationFormat {
7435 fn default() -> Self {
7436 use std::convert::From;
7437 Self::from(0)
7438 }
7439 }
7440
7441 impl std::fmt::Display for AttestationFormat {
7442 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7443 wkt::internal::display_enum(f, self.name(), self.value())
7444 }
7445 }
7446
7447 impl std::convert::From<i32> for AttestationFormat {
7448 fn from(value: i32) -> Self {
7449 match value {
7450 0 => Self::Unspecified,
7451 3 => Self::CaviumV1Compressed,
7452 4 => Self::CaviumV2Compressed,
7453 _ => Self::UnknownValue(attestation_format::UnknownValue(
7454 wkt::internal::UnknownEnumValue::Integer(value),
7455 )),
7456 }
7457 }
7458 }
7459
7460 impl std::convert::From<&str> for AttestationFormat {
7461 fn from(value: &str) -> Self {
7462 use std::string::ToString;
7463 match value {
7464 "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7465 "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7466 "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7467 _ => Self::UnknownValue(attestation_format::UnknownValue(
7468 wkt::internal::UnknownEnumValue::String(value.to_string()),
7469 )),
7470 }
7471 }
7472 }
7473
7474 impl serde::ser::Serialize for AttestationFormat {
7475 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7476 where
7477 S: serde::Serializer,
7478 {
7479 match self {
7480 Self::Unspecified => serializer.serialize_i32(0),
7481 Self::CaviumV1Compressed => serializer.serialize_i32(3),
7482 Self::CaviumV2Compressed => serializer.serialize_i32(4),
7483 Self::UnknownValue(u) => u.0.serialize(serializer),
7484 }
7485 }
7486 }
7487
7488 impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7489 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7490 where
7491 D: serde::Deserializer<'de>,
7492 {
7493 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7494 ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7495 ))
7496 }
7497 }
7498}
7499
7500/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7501/// individual cryptographic key, and the associated key material.
7502///
7503/// An
7504/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7505/// version can be used for cryptographic operations.
7506///
7507/// For security reasons, the raw cryptographic key material represented by a
7508/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7509/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7510/// authorized user or application invokes Cloud KMS.
7511///
7512/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7513/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7514#[derive(Clone, Default, PartialEq)]
7515#[non_exhaustive]
7516pub struct CryptoKeyVersion {
7517 /// Output only. The resource name for this
7518 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7519 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7520 ///
7521 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7522 pub name: std::string::String,
7523
7524 /// The current state of the
7525 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7526 ///
7527 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7528 pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7529
7530 /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7531 /// describing how crypto operations are performed with this
7532 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7533 ///
7534 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7535 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7536 pub protection_level: crate::model::ProtectionLevel,
7537
7538 /// Output only. The
7539 /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7540 /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7541 /// supports.
7542 ///
7543 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7544 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7545 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7546
7547 /// Output only. Statement that was generated and signed by the HSM at key
7548 /// creation time. Use this statement to verify attributes of the key as stored
7549 /// on the HSM, independently of Google. Only provided for key versions with
7550 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7551 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7552 ///
7553 /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7554 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7555 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7556
7557 /// Output only. The time at which this
7558 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7559 ///
7560 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7561 pub create_time: std::option::Option<wkt::Timestamp>,
7562
7563 /// Output only. The time this
7564 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7565 /// generated.
7566 ///
7567 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7568 pub generate_time: std::option::Option<wkt::Timestamp>,
7569
7570 /// Output only. The time this
7571 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7572 /// scheduled for destruction. Only present if
7573 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7574 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7575 ///
7576 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7577 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7578 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7579 pub destroy_time: std::option::Option<wkt::Timestamp>,
7580
7581 /// Output only. The time this CryptoKeyVersion's key material was
7582 /// destroyed. Only present if
7583 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7584 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7585 ///
7586 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7587 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7588 pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7589
7590 /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7591 /// used in the most recent import of this
7592 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7593 /// the underlying key material was imported.
7594 ///
7595 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7596 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7597 pub import_job: std::string::String,
7598
7599 /// Output only. The time at which this
7600 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7601 /// most recently imported.
7602 ///
7603 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7604 pub import_time: std::option::Option<wkt::Timestamp>,
7605
7606 /// Output only. The root cause of the most recent import failure. Only present
7607 /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7608 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7609 ///
7610 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7611 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7612 pub import_failure_reason: std::string::String,
7613
7614 /// Output only. The root cause of the most recent generation failure. Only
7615 /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7616 /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7617 ///
7618 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7619 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7620 pub generation_failure_reason: std::string::String,
7621
7622 /// Output only. The root cause of the most recent external destruction
7623 /// failure. Only present if
7624 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7625 /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7626 ///
7627 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7628 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7629 pub external_destruction_failure_reason: std::string::String,
7630
7631 /// ExternalProtectionLevelOptions stores a group of additional fields for
7632 /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7633 /// are specific to the
7634 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7635 /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7636 /// protection levels.
7637 ///
7638 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7639 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7640 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7641 pub external_protection_level_options:
7642 std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7643
7644 /// Output only. Whether or not this key version is eligible for reimport, by
7645 /// being specified as a target in
7646 /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7647 ///
7648 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7649 pub reimport_eligible: bool,
7650
7651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7652}
7653
7654impl CryptoKeyVersion {
7655 pub fn new() -> Self {
7656 std::default::Default::default()
7657 }
7658
7659 /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7660 ///
7661 /// # Example
7662 /// ```ignore,no_run
7663 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7664 /// let x = CryptoKeyVersion::new().set_name("example");
7665 /// ```
7666 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7667 self.name = v.into();
7668 self
7669 }
7670
7671 /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7672 ///
7673 /// # Example
7674 /// ```ignore,no_run
7675 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7676 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7677 /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7678 /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7679 /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7680 /// ```
7681 pub fn set_state<
7682 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
7683 >(
7684 mut self,
7685 v: T,
7686 ) -> Self {
7687 self.state = v.into();
7688 self
7689 }
7690
7691 /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
7692 ///
7693 /// # Example
7694 /// ```ignore,no_run
7695 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7696 /// use google_cloud_kms_v1::model::ProtectionLevel;
7697 /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
7698 /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
7699 /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
7700 /// ```
7701 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7702 mut self,
7703 v: T,
7704 ) -> Self {
7705 self.protection_level = v.into();
7706 self
7707 }
7708
7709 /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
7710 ///
7711 /// # Example
7712 /// ```ignore,no_run
7713 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7714 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7715 /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7716 /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7717 /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7718 /// ```
7719 pub fn set_algorithm<
7720 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7721 >(
7722 mut self,
7723 v: T,
7724 ) -> Self {
7725 self.algorithm = v.into();
7726 self
7727 }
7728
7729 /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7730 ///
7731 /// # Example
7732 /// ```ignore,no_run
7733 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7734 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7735 /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
7736 /// ```
7737 pub fn set_attestation<T>(mut self, v: T) -> Self
7738 where
7739 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7740 {
7741 self.attestation = std::option::Option::Some(v.into());
7742 self
7743 }
7744
7745 /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7746 ///
7747 /// # Example
7748 /// ```ignore,no_run
7749 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7750 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7751 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
7752 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
7753 /// ```
7754 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
7755 where
7756 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7757 {
7758 self.attestation = v.map(|x| x.into());
7759 self
7760 }
7761
7762 /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7763 ///
7764 /// # Example
7765 /// ```ignore,no_run
7766 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7767 /// use wkt::Timestamp;
7768 /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
7769 /// ```
7770 pub fn set_create_time<T>(mut self, v: T) -> Self
7771 where
7772 T: std::convert::Into<wkt::Timestamp>,
7773 {
7774 self.create_time = std::option::Option::Some(v.into());
7775 self
7776 }
7777
7778 /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7779 ///
7780 /// # Example
7781 /// ```ignore,no_run
7782 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7783 /// use wkt::Timestamp;
7784 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7785 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
7786 /// ```
7787 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7788 where
7789 T: std::convert::Into<wkt::Timestamp>,
7790 {
7791 self.create_time = v.map(|x| x.into());
7792 self
7793 }
7794
7795 /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7796 ///
7797 /// # Example
7798 /// ```ignore,no_run
7799 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7800 /// use wkt::Timestamp;
7801 /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
7802 /// ```
7803 pub fn set_generate_time<T>(mut self, v: T) -> Self
7804 where
7805 T: std::convert::Into<wkt::Timestamp>,
7806 {
7807 self.generate_time = std::option::Option::Some(v.into());
7808 self
7809 }
7810
7811 /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7812 ///
7813 /// # Example
7814 /// ```ignore,no_run
7815 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7816 /// use wkt::Timestamp;
7817 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
7818 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
7819 /// ```
7820 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
7821 where
7822 T: std::convert::Into<wkt::Timestamp>,
7823 {
7824 self.generate_time = v.map(|x| x.into());
7825 self
7826 }
7827
7828 /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7829 ///
7830 /// # Example
7831 /// ```ignore,no_run
7832 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7833 /// use wkt::Timestamp;
7834 /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
7835 /// ```
7836 pub fn set_destroy_time<T>(mut self, v: T) -> Self
7837 where
7838 T: std::convert::Into<wkt::Timestamp>,
7839 {
7840 self.destroy_time = std::option::Option::Some(v.into());
7841 self
7842 }
7843
7844 /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7845 ///
7846 /// # Example
7847 /// ```ignore,no_run
7848 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7849 /// use wkt::Timestamp;
7850 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
7851 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
7852 /// ```
7853 pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
7854 where
7855 T: std::convert::Into<wkt::Timestamp>,
7856 {
7857 self.destroy_time = v.map(|x| x.into());
7858 self
7859 }
7860
7861 /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7862 ///
7863 /// # Example
7864 /// ```ignore,no_run
7865 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7866 /// use wkt::Timestamp;
7867 /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
7868 /// ```
7869 pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
7870 where
7871 T: std::convert::Into<wkt::Timestamp>,
7872 {
7873 self.destroy_event_time = std::option::Option::Some(v.into());
7874 self
7875 }
7876
7877 /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
7878 ///
7879 /// # Example
7880 /// ```ignore,no_run
7881 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7882 /// use wkt::Timestamp;
7883 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
7884 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
7885 /// ```
7886 pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
7887 where
7888 T: std::convert::Into<wkt::Timestamp>,
7889 {
7890 self.destroy_event_time = v.map(|x| x.into());
7891 self
7892 }
7893
7894 /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
7895 ///
7896 /// # Example
7897 /// ```ignore,no_run
7898 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7899 /// let x = CryptoKeyVersion::new().set_import_job("example");
7900 /// ```
7901 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7902 self.import_job = v.into();
7903 self
7904 }
7905
7906 /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7907 ///
7908 /// # Example
7909 /// ```ignore,no_run
7910 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7911 /// use wkt::Timestamp;
7912 /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
7913 /// ```
7914 pub fn set_import_time<T>(mut self, v: T) -> Self
7915 where
7916 T: std::convert::Into<wkt::Timestamp>,
7917 {
7918 self.import_time = std::option::Option::Some(v.into());
7919 self
7920 }
7921
7922 /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
7923 ///
7924 /// # Example
7925 /// ```ignore,no_run
7926 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7927 /// use wkt::Timestamp;
7928 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
7929 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
7930 /// ```
7931 pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
7932 where
7933 T: std::convert::Into<wkt::Timestamp>,
7934 {
7935 self.import_time = v.map(|x| x.into());
7936 self
7937 }
7938
7939 /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
7940 ///
7941 /// # Example
7942 /// ```ignore,no_run
7943 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7944 /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
7945 /// ```
7946 pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
7947 mut self,
7948 v: T,
7949 ) -> Self {
7950 self.import_failure_reason = v.into();
7951 self
7952 }
7953
7954 /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
7955 ///
7956 /// # Example
7957 /// ```ignore,no_run
7958 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7959 /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
7960 /// ```
7961 pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
7962 mut self,
7963 v: T,
7964 ) -> Self {
7965 self.generation_failure_reason = v.into();
7966 self
7967 }
7968
7969 /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
7970 ///
7971 /// # Example
7972 /// ```ignore,no_run
7973 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7974 /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
7975 /// ```
7976 pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
7977 mut self,
7978 v: T,
7979 ) -> Self {
7980 self.external_destruction_failure_reason = v.into();
7981 self
7982 }
7983
7984 /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
7985 ///
7986 /// # Example
7987 /// ```ignore,no_run
7988 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7989 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
7990 /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
7991 /// ```
7992 pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
7993 where
7994 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
7995 {
7996 self.external_protection_level_options = std::option::Option::Some(v.into());
7997 self
7998 }
7999
8000 /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8001 ///
8002 /// # Example
8003 /// ```ignore,no_run
8004 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8005 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8006 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
8007 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
8008 /// ```
8009 pub fn set_or_clear_external_protection_level_options<T>(
8010 mut self,
8011 v: std::option::Option<T>,
8012 ) -> Self
8013 where
8014 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8015 {
8016 self.external_protection_level_options = v.map(|x| x.into());
8017 self
8018 }
8019
8020 /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
8021 ///
8022 /// # Example
8023 /// ```ignore,no_run
8024 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8025 /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
8026 /// ```
8027 pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8028 self.reimport_eligible = v.into();
8029 self
8030 }
8031}
8032
8033impl wkt::message::Message for CryptoKeyVersion {
8034 fn typename() -> &'static str {
8035 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
8036 }
8037}
8038
8039/// Defines additional types related to [CryptoKeyVersion].
8040pub mod crypto_key_version {
8041 #[allow(unused_imports)]
8042 use super::*;
8043
8044 /// The algorithm of the
8045 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
8046 /// parameters must be used for each cryptographic operation.
8047 ///
8048 /// The
8049 /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
8050 /// algorithm is usable with
8051 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8052 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
8053 ///
8054 /// Algorithms beginning with `RSA_SIGN_` are usable with
8055 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8056 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8057 ///
8058 /// The fields in the name after `RSA_SIGN_` correspond to the following
8059 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8060 ///
8061 /// For PSS, the salt length used is equal to the length of digest
8062 /// algorithm. For example,
8063 /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
8064 /// will use PSS with a salt length of 256 bits or 32 bytes.
8065 ///
8066 /// Algorithms beginning with `RSA_DECRYPT_` are usable with
8067 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8068 /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
8069 ///
8070 /// The fields in the name after `RSA_DECRYPT_` correspond to the following
8071 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8072 ///
8073 /// Algorithms beginning with `EC_SIGN_` are usable with
8074 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8075 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8076 ///
8077 /// The fields in the name after `EC_SIGN_` correspond to the following
8078 /// parameters: elliptic curve, digest algorithm.
8079 ///
8080 /// Algorithms beginning with `HMAC_` are usable with
8081 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8082 /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
8083 ///
8084 /// The suffix following `HMAC_` corresponds to the hash algorithm being used
8085 /// (eg. SHA256).
8086 ///
8087 /// Algorithms beginning with `PQ_` are post-quantum.
8088 ///
8089 /// For more information, see [Key purposes and algorithms]
8090 /// (<https://cloud.google.com/kms/docs/algorithms>).
8091 ///
8092 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
8093 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
8094 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
8095 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
8096 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
8097 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8098 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
8099 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
8100 ///
8101 /// # Working with unknown values
8102 ///
8103 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8104 /// additional enum variants at any time. Adding new variants is not considered
8105 /// a breaking change. Applications should write their code in anticipation of:
8106 ///
8107 /// - New values appearing in future releases of the client library, **and**
8108 /// - New values received dynamically, without application changes.
8109 ///
8110 /// Please consult the [Working with enums] section in the user guide for some
8111 /// guidelines.
8112 ///
8113 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8114 #[derive(Clone, Debug, PartialEq)]
8115 #[non_exhaustive]
8116 pub enum CryptoKeyVersionAlgorithm {
8117 /// Not specified.
8118 Unspecified,
8119 /// Creates symmetric encryption keys.
8120 GoogleSymmetricEncryption,
8121 /// AES-GCM (Galois Counter Mode) using 128-bit keys.
8122 Aes128Gcm,
8123 /// AES-GCM (Galois Counter Mode) using 256-bit keys.
8124 Aes256Gcm,
8125 /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
8126 Aes128Cbc,
8127 /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
8128 Aes256Cbc,
8129 /// AES-CTR (Counter Mode) using 128-bit keys.
8130 Aes128Ctr,
8131 /// AES-CTR (Counter Mode) using 256-bit keys.
8132 Aes256Ctr,
8133 /// RSASSA-PSS 2048 bit key with a SHA256 digest.
8134 RsaSignPss2048Sha256,
8135 /// RSASSA-PSS 3072 bit key with a SHA256 digest.
8136 RsaSignPss3072Sha256,
8137 /// RSASSA-PSS 4096 bit key with a SHA256 digest.
8138 RsaSignPss4096Sha256,
8139 /// RSASSA-PSS 4096 bit key with a SHA512 digest.
8140 RsaSignPss4096Sha512,
8141 /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
8142 RsaSignPkcs12048Sha256,
8143 /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
8144 RsaSignPkcs13072Sha256,
8145 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
8146 RsaSignPkcs14096Sha256,
8147 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
8148 RsaSignPkcs14096Sha512,
8149 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
8150 RsaSignRawPkcs12048,
8151 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
8152 RsaSignRawPkcs13072,
8153 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
8154 RsaSignRawPkcs14096,
8155 /// RSAES-OAEP 2048 bit key with a SHA256 digest.
8156 RsaDecryptOaep2048Sha256,
8157 /// RSAES-OAEP 3072 bit key with a SHA256 digest.
8158 RsaDecryptOaep3072Sha256,
8159 /// RSAES-OAEP 4096 bit key with a SHA256 digest.
8160 RsaDecryptOaep4096Sha256,
8161 /// RSAES-OAEP 4096 bit key with a SHA512 digest.
8162 RsaDecryptOaep4096Sha512,
8163 /// RSAES-OAEP 2048 bit key with a SHA1 digest.
8164 RsaDecryptOaep2048Sha1,
8165 /// RSAES-OAEP 3072 bit key with a SHA1 digest.
8166 RsaDecryptOaep3072Sha1,
8167 /// RSAES-OAEP 4096 bit key with a SHA1 digest.
8168 RsaDecryptOaep4096Sha1,
8169 /// ECDSA on the NIST P-256 curve with a SHA256 digest.
8170 /// Other hash functions can also be used:
8171 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8172 EcSignP256Sha256,
8173 /// ECDSA on the NIST P-384 curve with a SHA384 digest.
8174 /// Other hash functions can also be used:
8175 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8176 EcSignP384Sha384,
8177 /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
8178 /// HSM protection level.
8179 /// Other hash functions can also be used:
8180 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8181 EcSignSecp256K1Sha256,
8182 /// EdDSA on the Curve25519 in pure mode (taking data as input).
8183 EcSignEd25519,
8184 /// HMAC-SHA256 signing with a 256 bit key.
8185 HmacSha256,
8186 /// HMAC-SHA1 signing with a 160 bit key.
8187 HmacSha1,
8188 /// HMAC-SHA384 signing with a 384 bit key.
8189 HmacSha384,
8190 /// HMAC-SHA512 signing with a 512 bit key.
8191 HmacSha512,
8192 /// HMAC-SHA224 signing with a 224 bit key.
8193 HmacSha224,
8194 /// Algorithm representing symmetric encryption by an external key manager.
8195 ExternalSymmetricEncryption,
8196 /// ML-KEM-768 (FIPS 203)
8197 MlKem768,
8198 /// ML-KEM-1024 (FIPS 203)
8199 MlKem1024,
8200 /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
8201 /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8202 KemXwing,
8203 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8204 /// security level 1. Randomized version.
8205 PqSignMlDsa44,
8206 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8207 /// security level 3. Randomized version.
8208 PqSignMlDsa65,
8209 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8210 /// security level 5. Randomized version.
8211 PqSignMlDsa87,
8212 /// The post-quantum stateless hash-based digital signature algorithm, at
8213 /// security level 1. Randomized version.
8214 PqSignSlhDsaSha2128S,
8215 /// The post-quantum stateless hash-based digital signature algorithm, at
8216 /// security level 1. Randomized pre-hash version supporting SHA256 digests.
8217 PqSignHashSlhDsaSha2128SSha256,
8218 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8219 /// security level 1. Randomized version supporting externally-computed
8220 /// message representatives.
8221 PqSignMlDsa44ExternalMu,
8222 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8223 /// security level 3. Randomized version supporting externally-computed
8224 /// message representatives.
8225 PqSignMlDsa65ExternalMu,
8226 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8227 /// security level 5. Randomized version supporting externally-computed
8228 /// message representatives.
8229 PqSignMlDsa87ExternalMu,
8230 /// If set, the enum was initialized with an unknown value.
8231 ///
8232 /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8233 /// [CryptoKeyVersionAlgorithm::name].
8234 UnknownValue(crypto_key_version_algorithm::UnknownValue),
8235 }
8236
8237 #[doc(hidden)]
8238 pub mod crypto_key_version_algorithm {
8239 #[allow(unused_imports)]
8240 use super::*;
8241 #[derive(Clone, Debug, PartialEq)]
8242 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8243 }
8244
8245 impl CryptoKeyVersionAlgorithm {
8246 /// Gets the enum value.
8247 ///
8248 /// Returns `None` if the enum contains an unknown value deserialized from
8249 /// the string representation of enums.
8250 pub fn value(&self) -> std::option::Option<i32> {
8251 match self {
8252 Self::Unspecified => std::option::Option::Some(0),
8253 Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8254 Self::Aes128Gcm => std::option::Option::Some(41),
8255 Self::Aes256Gcm => std::option::Option::Some(19),
8256 Self::Aes128Cbc => std::option::Option::Some(42),
8257 Self::Aes256Cbc => std::option::Option::Some(43),
8258 Self::Aes128Ctr => std::option::Option::Some(44),
8259 Self::Aes256Ctr => std::option::Option::Some(45),
8260 Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8261 Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8262 Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8263 Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8264 Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8265 Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8266 Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8267 Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8268 Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8269 Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8270 Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8271 Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8272 Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8273 Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8274 Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8275 Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8276 Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8277 Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8278 Self::EcSignP256Sha256 => std::option::Option::Some(12),
8279 Self::EcSignP384Sha384 => std::option::Option::Some(13),
8280 Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8281 Self::EcSignEd25519 => std::option::Option::Some(40),
8282 Self::HmacSha256 => std::option::Option::Some(32),
8283 Self::HmacSha1 => std::option::Option::Some(33),
8284 Self::HmacSha384 => std::option::Option::Some(34),
8285 Self::HmacSha512 => std::option::Option::Some(35),
8286 Self::HmacSha224 => std::option::Option::Some(36),
8287 Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8288 Self::MlKem768 => std::option::Option::Some(47),
8289 Self::MlKem1024 => std::option::Option::Some(48),
8290 Self::KemXwing => std::option::Option::Some(63),
8291 Self::PqSignMlDsa44 => std::option::Option::Some(68),
8292 Self::PqSignMlDsa65 => std::option::Option::Some(56),
8293 Self::PqSignMlDsa87 => std::option::Option::Some(69),
8294 Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8295 Self::PqSignHashSlhDsaSha2128SSha256 => std::option::Option::Some(60),
8296 Self::PqSignMlDsa44ExternalMu => std::option::Option::Some(70),
8297 Self::PqSignMlDsa65ExternalMu => std::option::Option::Some(67),
8298 Self::PqSignMlDsa87ExternalMu => std::option::Option::Some(71),
8299 Self::UnknownValue(u) => u.0.value(),
8300 }
8301 }
8302
8303 /// Gets the enum value as a string.
8304 ///
8305 /// Returns `None` if the enum contains an unknown value deserialized from
8306 /// the integer representation of enums.
8307 pub fn name(&self) -> std::option::Option<&str> {
8308 match self {
8309 Self::Unspecified => {
8310 std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8311 }
8312 Self::GoogleSymmetricEncryption => {
8313 std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8314 }
8315 Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8316 Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8317 Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8318 Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8319 Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8320 Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8321 Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8322 Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8323 Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8324 Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8325 Self::RsaSignPkcs12048Sha256 => {
8326 std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8327 }
8328 Self::RsaSignPkcs13072Sha256 => {
8329 std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8330 }
8331 Self::RsaSignPkcs14096Sha256 => {
8332 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8333 }
8334 Self::RsaSignPkcs14096Sha512 => {
8335 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8336 }
8337 Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8338 Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8339 Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8340 Self::RsaDecryptOaep2048Sha256 => {
8341 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8342 }
8343 Self::RsaDecryptOaep3072Sha256 => {
8344 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8345 }
8346 Self::RsaDecryptOaep4096Sha256 => {
8347 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8348 }
8349 Self::RsaDecryptOaep4096Sha512 => {
8350 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8351 }
8352 Self::RsaDecryptOaep2048Sha1 => {
8353 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8354 }
8355 Self::RsaDecryptOaep3072Sha1 => {
8356 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8357 }
8358 Self::RsaDecryptOaep4096Sha1 => {
8359 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8360 }
8361 Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8362 Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8363 Self::EcSignSecp256K1Sha256 => {
8364 std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8365 }
8366 Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8367 Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8368 Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8369 Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8370 Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8371 Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8372 Self::ExternalSymmetricEncryption => {
8373 std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8374 }
8375 Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8376 Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8377 Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8378 Self::PqSignMlDsa44 => std::option::Option::Some("PQ_SIGN_ML_DSA_44"),
8379 Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8380 Self::PqSignMlDsa87 => std::option::Option::Some("PQ_SIGN_ML_DSA_87"),
8381 Self::PqSignSlhDsaSha2128S => {
8382 std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8383 }
8384 Self::PqSignHashSlhDsaSha2128SSha256 => {
8385 std::option::Option::Some("PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256")
8386 }
8387 Self::PqSignMlDsa44ExternalMu => {
8388 std::option::Option::Some("PQ_SIGN_ML_DSA_44_EXTERNAL_MU")
8389 }
8390 Self::PqSignMlDsa65ExternalMu => {
8391 std::option::Option::Some("PQ_SIGN_ML_DSA_65_EXTERNAL_MU")
8392 }
8393 Self::PqSignMlDsa87ExternalMu => {
8394 std::option::Option::Some("PQ_SIGN_ML_DSA_87_EXTERNAL_MU")
8395 }
8396 Self::UnknownValue(u) => u.0.name(),
8397 }
8398 }
8399 }
8400
8401 impl std::default::Default for CryptoKeyVersionAlgorithm {
8402 fn default() -> Self {
8403 use std::convert::From;
8404 Self::from(0)
8405 }
8406 }
8407
8408 impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8409 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8410 wkt::internal::display_enum(f, self.name(), self.value())
8411 }
8412 }
8413
8414 impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8415 fn from(value: i32) -> Self {
8416 match value {
8417 0 => Self::Unspecified,
8418 1 => Self::GoogleSymmetricEncryption,
8419 2 => Self::RsaSignPss2048Sha256,
8420 3 => Self::RsaSignPss3072Sha256,
8421 4 => Self::RsaSignPss4096Sha256,
8422 5 => Self::RsaSignPkcs12048Sha256,
8423 6 => Self::RsaSignPkcs13072Sha256,
8424 7 => Self::RsaSignPkcs14096Sha256,
8425 8 => Self::RsaDecryptOaep2048Sha256,
8426 9 => Self::RsaDecryptOaep3072Sha256,
8427 10 => Self::RsaDecryptOaep4096Sha256,
8428 12 => Self::EcSignP256Sha256,
8429 13 => Self::EcSignP384Sha384,
8430 15 => Self::RsaSignPss4096Sha512,
8431 16 => Self::RsaSignPkcs14096Sha512,
8432 17 => Self::RsaDecryptOaep4096Sha512,
8433 18 => Self::ExternalSymmetricEncryption,
8434 19 => Self::Aes256Gcm,
8435 28 => Self::RsaSignRawPkcs12048,
8436 29 => Self::RsaSignRawPkcs13072,
8437 30 => Self::RsaSignRawPkcs14096,
8438 31 => Self::EcSignSecp256K1Sha256,
8439 32 => Self::HmacSha256,
8440 33 => Self::HmacSha1,
8441 34 => Self::HmacSha384,
8442 35 => Self::HmacSha512,
8443 36 => Self::HmacSha224,
8444 37 => Self::RsaDecryptOaep2048Sha1,
8445 38 => Self::RsaDecryptOaep3072Sha1,
8446 39 => Self::RsaDecryptOaep4096Sha1,
8447 40 => Self::EcSignEd25519,
8448 41 => Self::Aes128Gcm,
8449 42 => Self::Aes128Cbc,
8450 43 => Self::Aes256Cbc,
8451 44 => Self::Aes128Ctr,
8452 45 => Self::Aes256Ctr,
8453 47 => Self::MlKem768,
8454 48 => Self::MlKem1024,
8455 56 => Self::PqSignMlDsa65,
8456 57 => Self::PqSignSlhDsaSha2128S,
8457 60 => Self::PqSignHashSlhDsaSha2128SSha256,
8458 63 => Self::KemXwing,
8459 67 => Self::PqSignMlDsa65ExternalMu,
8460 68 => Self::PqSignMlDsa44,
8461 69 => Self::PqSignMlDsa87,
8462 70 => Self::PqSignMlDsa44ExternalMu,
8463 71 => Self::PqSignMlDsa87ExternalMu,
8464 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8465 wkt::internal::UnknownEnumValue::Integer(value),
8466 )),
8467 }
8468 }
8469 }
8470
8471 impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8472 fn from(value: &str) -> Self {
8473 use std::string::ToString;
8474 match value {
8475 "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8476 "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8477 "AES_128_GCM" => Self::Aes128Gcm,
8478 "AES_256_GCM" => Self::Aes256Gcm,
8479 "AES_128_CBC" => Self::Aes128Cbc,
8480 "AES_256_CBC" => Self::Aes256Cbc,
8481 "AES_128_CTR" => Self::Aes128Ctr,
8482 "AES_256_CTR" => Self::Aes256Ctr,
8483 "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8484 "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8485 "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8486 "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8487 "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8488 "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8489 "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8490 "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8491 "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8492 "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8493 "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8494 "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8495 "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8496 "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8497 "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8498 "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8499 "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8500 "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8501 "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8502 "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8503 "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8504 "EC_SIGN_ED25519" => Self::EcSignEd25519,
8505 "HMAC_SHA256" => Self::HmacSha256,
8506 "HMAC_SHA1" => Self::HmacSha1,
8507 "HMAC_SHA384" => Self::HmacSha384,
8508 "HMAC_SHA512" => Self::HmacSha512,
8509 "HMAC_SHA224" => Self::HmacSha224,
8510 "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8511 "ML_KEM_768" => Self::MlKem768,
8512 "ML_KEM_1024" => Self::MlKem1024,
8513 "KEM_XWING" => Self::KemXwing,
8514 "PQ_SIGN_ML_DSA_44" => Self::PqSignMlDsa44,
8515 "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8516 "PQ_SIGN_ML_DSA_87" => Self::PqSignMlDsa87,
8517 "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8518 "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256" => Self::PqSignHashSlhDsaSha2128SSha256,
8519 "PQ_SIGN_ML_DSA_44_EXTERNAL_MU" => Self::PqSignMlDsa44ExternalMu,
8520 "PQ_SIGN_ML_DSA_65_EXTERNAL_MU" => Self::PqSignMlDsa65ExternalMu,
8521 "PQ_SIGN_ML_DSA_87_EXTERNAL_MU" => Self::PqSignMlDsa87ExternalMu,
8522 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8523 wkt::internal::UnknownEnumValue::String(value.to_string()),
8524 )),
8525 }
8526 }
8527 }
8528
8529 impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8530 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8531 where
8532 S: serde::Serializer,
8533 {
8534 match self {
8535 Self::Unspecified => serializer.serialize_i32(0),
8536 Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8537 Self::Aes128Gcm => serializer.serialize_i32(41),
8538 Self::Aes256Gcm => serializer.serialize_i32(19),
8539 Self::Aes128Cbc => serializer.serialize_i32(42),
8540 Self::Aes256Cbc => serializer.serialize_i32(43),
8541 Self::Aes128Ctr => serializer.serialize_i32(44),
8542 Self::Aes256Ctr => serializer.serialize_i32(45),
8543 Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8544 Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8545 Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8546 Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8547 Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8548 Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8549 Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8550 Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8551 Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8552 Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8553 Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8554 Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8555 Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8556 Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8557 Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8558 Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8559 Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8560 Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8561 Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8562 Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8563 Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8564 Self::EcSignEd25519 => serializer.serialize_i32(40),
8565 Self::HmacSha256 => serializer.serialize_i32(32),
8566 Self::HmacSha1 => serializer.serialize_i32(33),
8567 Self::HmacSha384 => serializer.serialize_i32(34),
8568 Self::HmacSha512 => serializer.serialize_i32(35),
8569 Self::HmacSha224 => serializer.serialize_i32(36),
8570 Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8571 Self::MlKem768 => serializer.serialize_i32(47),
8572 Self::MlKem1024 => serializer.serialize_i32(48),
8573 Self::KemXwing => serializer.serialize_i32(63),
8574 Self::PqSignMlDsa44 => serializer.serialize_i32(68),
8575 Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8576 Self::PqSignMlDsa87 => serializer.serialize_i32(69),
8577 Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8578 Self::PqSignHashSlhDsaSha2128SSha256 => serializer.serialize_i32(60),
8579 Self::PqSignMlDsa44ExternalMu => serializer.serialize_i32(70),
8580 Self::PqSignMlDsa65ExternalMu => serializer.serialize_i32(67),
8581 Self::PqSignMlDsa87ExternalMu => serializer.serialize_i32(71),
8582 Self::UnknownValue(u) => u.0.serialize(serializer),
8583 }
8584 }
8585 }
8586
8587 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8588 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8589 where
8590 D: serde::Deserializer<'de>,
8591 {
8592 deserializer.deserialize_any(
8593 wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8594 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8595 ),
8596 )
8597 }
8598 }
8599
8600 /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8601 /// indicating if it can be used.
8602 ///
8603 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8604 ///
8605 /// # Working with unknown values
8606 ///
8607 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8608 /// additional enum variants at any time. Adding new variants is not considered
8609 /// a breaking change. Applications should write their code in anticipation of:
8610 ///
8611 /// - New values appearing in future releases of the client library, **and**
8612 /// - New values received dynamically, without application changes.
8613 ///
8614 /// Please consult the [Working with enums] section in the user guide for some
8615 /// guidelines.
8616 ///
8617 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8618 #[derive(Clone, Debug, PartialEq)]
8619 #[non_exhaustive]
8620 pub enum CryptoKeyVersionState {
8621 /// Not specified.
8622 Unspecified,
8623 /// This version is still being generated. It may not be used, enabled,
8624 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8625 /// version
8626 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8627 /// as soon as the version is ready.
8628 ///
8629 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8630 PendingGeneration,
8631 /// This version may be used for cryptographic operations.
8632 Enabled,
8633 /// This version may not be used, but the key material is still available,
8634 /// and the version can be placed back into the
8635 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8636 /// state.
8637 ///
8638 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8639 Disabled,
8640 /// The key material of this version is destroyed and no longer stored.
8641 /// This version may only become
8642 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8643 /// again if this version is
8644 /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8645 /// and the original key material is reimported with a call to
8646 /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8647 ///
8648 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8649 /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
8650 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8651 Destroyed,
8652 /// This version is scheduled for destruction, and will be destroyed soon.
8653 /// Call
8654 /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
8655 /// to put it back into the
8656 /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
8657 /// state.
8658 ///
8659 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
8660 /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8661 DestroyScheduled,
8662 /// This version is still being imported. It may not be used, enabled,
8663 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8664 /// version
8665 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8666 /// as soon as the version is ready.
8667 ///
8668 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8669 PendingImport,
8670 /// This version was not imported successfully. It may not be used, enabled,
8671 /// disabled, or destroyed. The submitted key material has been discarded.
8672 /// Additional details can be found in
8673 /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
8674 ///
8675 /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
8676 ImportFailed,
8677 /// This version was not generated successfully. It may not be used, enabled,
8678 /// disabled, or destroyed. Additional details can be found in
8679 /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
8680 ///
8681 /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
8682 GenerationFailed,
8683 /// This version was destroyed, and it may not be used or enabled again.
8684 /// Cloud KMS is waiting for the corresponding key material residing in an
8685 /// external key manager to be destroyed.
8686 PendingExternalDestruction,
8687 /// This version was destroyed, and it may not be used or enabled again.
8688 /// However, Cloud KMS could not confirm that the corresponding key material
8689 /// residing in an external key manager was destroyed. Additional details can
8690 /// be found in
8691 /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
8692 ///
8693 /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
8694 ExternalDestructionFailed,
8695 /// If set, the enum was initialized with an unknown value.
8696 ///
8697 /// Applications can examine the value using [CryptoKeyVersionState::value] or
8698 /// [CryptoKeyVersionState::name].
8699 UnknownValue(crypto_key_version_state::UnknownValue),
8700 }
8701
8702 #[doc(hidden)]
8703 pub mod crypto_key_version_state {
8704 #[allow(unused_imports)]
8705 use super::*;
8706 #[derive(Clone, Debug, PartialEq)]
8707 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8708 }
8709
8710 impl CryptoKeyVersionState {
8711 /// Gets the enum value.
8712 ///
8713 /// Returns `None` if the enum contains an unknown value deserialized from
8714 /// the string representation of enums.
8715 pub fn value(&self) -> std::option::Option<i32> {
8716 match self {
8717 Self::Unspecified => std::option::Option::Some(0),
8718 Self::PendingGeneration => std::option::Option::Some(5),
8719 Self::Enabled => std::option::Option::Some(1),
8720 Self::Disabled => std::option::Option::Some(2),
8721 Self::Destroyed => std::option::Option::Some(3),
8722 Self::DestroyScheduled => std::option::Option::Some(4),
8723 Self::PendingImport => std::option::Option::Some(6),
8724 Self::ImportFailed => std::option::Option::Some(7),
8725 Self::GenerationFailed => std::option::Option::Some(8),
8726 Self::PendingExternalDestruction => std::option::Option::Some(9),
8727 Self::ExternalDestructionFailed => std::option::Option::Some(10),
8728 Self::UnknownValue(u) => u.0.value(),
8729 }
8730 }
8731
8732 /// Gets the enum value as a string.
8733 ///
8734 /// Returns `None` if the enum contains an unknown value deserialized from
8735 /// the integer representation of enums.
8736 pub fn name(&self) -> std::option::Option<&str> {
8737 match self {
8738 Self::Unspecified => {
8739 std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
8740 }
8741 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
8742 Self::Enabled => std::option::Option::Some("ENABLED"),
8743 Self::Disabled => std::option::Option::Some("DISABLED"),
8744 Self::Destroyed => std::option::Option::Some("DESTROYED"),
8745 Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
8746 Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
8747 Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
8748 Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
8749 Self::PendingExternalDestruction => {
8750 std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
8751 }
8752 Self::ExternalDestructionFailed => {
8753 std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
8754 }
8755 Self::UnknownValue(u) => u.0.name(),
8756 }
8757 }
8758 }
8759
8760 impl std::default::Default for CryptoKeyVersionState {
8761 fn default() -> Self {
8762 use std::convert::From;
8763 Self::from(0)
8764 }
8765 }
8766
8767 impl std::fmt::Display for CryptoKeyVersionState {
8768 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8769 wkt::internal::display_enum(f, self.name(), self.value())
8770 }
8771 }
8772
8773 impl std::convert::From<i32> for CryptoKeyVersionState {
8774 fn from(value: i32) -> Self {
8775 match value {
8776 0 => Self::Unspecified,
8777 1 => Self::Enabled,
8778 2 => Self::Disabled,
8779 3 => Self::Destroyed,
8780 4 => Self::DestroyScheduled,
8781 5 => Self::PendingGeneration,
8782 6 => Self::PendingImport,
8783 7 => Self::ImportFailed,
8784 8 => Self::GenerationFailed,
8785 9 => Self::PendingExternalDestruction,
8786 10 => Self::ExternalDestructionFailed,
8787 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8788 wkt::internal::UnknownEnumValue::Integer(value),
8789 )),
8790 }
8791 }
8792 }
8793
8794 impl std::convert::From<&str> for CryptoKeyVersionState {
8795 fn from(value: &str) -> Self {
8796 use std::string::ToString;
8797 match value {
8798 "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
8799 "PENDING_GENERATION" => Self::PendingGeneration,
8800 "ENABLED" => Self::Enabled,
8801 "DISABLED" => Self::Disabled,
8802 "DESTROYED" => Self::Destroyed,
8803 "DESTROY_SCHEDULED" => Self::DestroyScheduled,
8804 "PENDING_IMPORT" => Self::PendingImport,
8805 "IMPORT_FAILED" => Self::ImportFailed,
8806 "GENERATION_FAILED" => Self::GenerationFailed,
8807 "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
8808 "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
8809 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8810 wkt::internal::UnknownEnumValue::String(value.to_string()),
8811 )),
8812 }
8813 }
8814 }
8815
8816 impl serde::ser::Serialize for CryptoKeyVersionState {
8817 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8818 where
8819 S: serde::Serializer,
8820 {
8821 match self {
8822 Self::Unspecified => serializer.serialize_i32(0),
8823 Self::PendingGeneration => serializer.serialize_i32(5),
8824 Self::Enabled => serializer.serialize_i32(1),
8825 Self::Disabled => serializer.serialize_i32(2),
8826 Self::Destroyed => serializer.serialize_i32(3),
8827 Self::DestroyScheduled => serializer.serialize_i32(4),
8828 Self::PendingImport => serializer.serialize_i32(6),
8829 Self::ImportFailed => serializer.serialize_i32(7),
8830 Self::GenerationFailed => serializer.serialize_i32(8),
8831 Self::PendingExternalDestruction => serializer.serialize_i32(9),
8832 Self::ExternalDestructionFailed => serializer.serialize_i32(10),
8833 Self::UnknownValue(u) => u.0.serialize(serializer),
8834 }
8835 }
8836 }
8837
8838 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
8839 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8840 where
8841 D: serde::Deserializer<'de>,
8842 {
8843 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
8844 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
8845 ))
8846 }
8847 }
8848
8849 /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
8850 /// Controls the level of detail returned for
8851 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
8852 /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
8853 /// and
8854 /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
8855 ///
8856 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8857 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
8858 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
8859 ///
8860 /// # Working with unknown values
8861 ///
8862 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8863 /// additional enum variants at any time. Adding new variants is not considered
8864 /// a breaking change. Applications should write their code in anticipation of:
8865 ///
8866 /// - New values appearing in future releases of the client library, **and**
8867 /// - New values received dynamically, without application changes.
8868 ///
8869 /// Please consult the [Working with enums] section in the user guide for some
8870 /// guidelines.
8871 ///
8872 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8873 #[derive(Clone, Debug, PartialEq)]
8874 #[non_exhaustive]
8875 pub enum CryptoKeyVersionView {
8876 /// Default view for each
8877 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
8878 /// include the
8879 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
8880 ///
8881 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8882 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8883 Unspecified,
8884 /// Provides all fields in each
8885 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
8886 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
8887 ///
8888 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8889 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
8890 Full,
8891 /// If set, the enum was initialized with an unknown value.
8892 ///
8893 /// Applications can examine the value using [CryptoKeyVersionView::value] or
8894 /// [CryptoKeyVersionView::name].
8895 UnknownValue(crypto_key_version_view::UnknownValue),
8896 }
8897
8898 #[doc(hidden)]
8899 pub mod crypto_key_version_view {
8900 #[allow(unused_imports)]
8901 use super::*;
8902 #[derive(Clone, Debug, PartialEq)]
8903 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8904 }
8905
8906 impl CryptoKeyVersionView {
8907 /// Gets the enum value.
8908 ///
8909 /// Returns `None` if the enum contains an unknown value deserialized from
8910 /// the string representation of enums.
8911 pub fn value(&self) -> std::option::Option<i32> {
8912 match self {
8913 Self::Unspecified => std::option::Option::Some(0),
8914 Self::Full => std::option::Option::Some(1),
8915 Self::UnknownValue(u) => u.0.value(),
8916 }
8917 }
8918
8919 /// Gets the enum value as a string.
8920 ///
8921 /// Returns `None` if the enum contains an unknown value deserialized from
8922 /// the integer representation of enums.
8923 pub fn name(&self) -> std::option::Option<&str> {
8924 match self {
8925 Self::Unspecified => {
8926 std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
8927 }
8928 Self::Full => std::option::Option::Some("FULL"),
8929 Self::UnknownValue(u) => u.0.name(),
8930 }
8931 }
8932 }
8933
8934 impl std::default::Default for CryptoKeyVersionView {
8935 fn default() -> Self {
8936 use std::convert::From;
8937 Self::from(0)
8938 }
8939 }
8940
8941 impl std::fmt::Display for CryptoKeyVersionView {
8942 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8943 wkt::internal::display_enum(f, self.name(), self.value())
8944 }
8945 }
8946
8947 impl std::convert::From<i32> for CryptoKeyVersionView {
8948 fn from(value: i32) -> Self {
8949 match value {
8950 0 => Self::Unspecified,
8951 1 => Self::Full,
8952 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8953 wkt::internal::UnknownEnumValue::Integer(value),
8954 )),
8955 }
8956 }
8957 }
8958
8959 impl std::convert::From<&str> for CryptoKeyVersionView {
8960 fn from(value: &str) -> Self {
8961 use std::string::ToString;
8962 match value {
8963 "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
8964 "FULL" => Self::Full,
8965 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
8966 wkt::internal::UnknownEnumValue::String(value.to_string()),
8967 )),
8968 }
8969 }
8970 }
8971
8972 impl serde::ser::Serialize for CryptoKeyVersionView {
8973 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8974 where
8975 S: serde::Serializer,
8976 {
8977 match self {
8978 Self::Unspecified => serializer.serialize_i32(0),
8979 Self::Full => serializer.serialize_i32(1),
8980 Self::UnknownValue(u) => u.0.serialize(serializer),
8981 }
8982 }
8983 }
8984
8985 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
8986 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8987 where
8988 D: serde::Deserializer<'de>,
8989 {
8990 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
8991 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
8992 ))
8993 }
8994 }
8995}
8996
8997/// Data with integrity verification field.
8998#[derive(Clone, Default, PartialEq)]
8999#[non_exhaustive]
9000pub struct ChecksummedData {
9001 /// Raw Data.
9002 pub data: ::bytes::Bytes,
9003
9004 /// Integrity verification field. A CRC32C
9005 /// checksum of the returned
9006 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
9007 /// integrity check of
9008 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
9009 /// performed by computing the CRC32C checksum of
9010 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
9011 /// comparing your results to this field. Discard the response in case of
9012 /// non-matching checksum values, and perform a limited number of retries. A
9013 /// persistent mismatch may indicate an issue in your computation of the CRC32C
9014 /// checksum. Note: This field is defined as int64 for reasons of compatibility
9015 /// across different languages. However, it is a non-negative integer, which
9016 /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
9017 /// languages that support this type.
9018 ///
9019 /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
9020 pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
9021
9022 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9023}
9024
9025impl ChecksummedData {
9026 pub fn new() -> Self {
9027 std::default::Default::default()
9028 }
9029
9030 /// Sets the value of [data][crate::model::ChecksummedData::data].
9031 ///
9032 /// # Example
9033 /// ```ignore,no_run
9034 /// # use google_cloud_kms_v1::model::ChecksummedData;
9035 /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
9036 /// ```
9037 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9038 self.data = v.into();
9039 self
9040 }
9041
9042 /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9043 ///
9044 /// # Example
9045 /// ```ignore,no_run
9046 /// # use google_cloud_kms_v1::model::ChecksummedData;
9047 /// use wkt::Int64Value;
9048 /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
9049 /// ```
9050 pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
9051 where
9052 T: std::convert::Into<wkt::Int64Value>,
9053 {
9054 self.crc32c_checksum = std::option::Option::Some(v.into());
9055 self
9056 }
9057
9058 /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9059 ///
9060 /// # Example
9061 /// ```ignore,no_run
9062 /// # use google_cloud_kms_v1::model::ChecksummedData;
9063 /// use wkt::Int64Value;
9064 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
9065 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
9066 /// ```
9067 pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
9068 where
9069 T: std::convert::Into<wkt::Int64Value>,
9070 {
9071 self.crc32c_checksum = v.map(|x| x.into());
9072 self
9073 }
9074}
9075
9076impl wkt::message::Message for ChecksummedData {
9077 fn typename() -> &'static str {
9078 "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
9079 }
9080}
9081
9082/// The public keys for a given
9083/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
9084/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
9085///
9086/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9087/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
9088#[derive(Clone, Default, PartialEq)]
9089#[non_exhaustive]
9090pub struct PublicKey {
9091 /// The public key, encoded in PEM format. For more information, see the
9092 /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
9093 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9094 /// [Textual Encoding of Subject Public Key Info]
9095 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9096 pub pem: std::string::String,
9097
9098 /// The
9099 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
9100 /// associated with this key.
9101 ///
9102 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
9103 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
9104
9105 /// Integrity verification field. A CRC32C checksum of the returned
9106 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
9107 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
9108 /// computing the CRC32C checksum of
9109 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
9110 /// results to this field. Discard the response in case of non-matching
9111 /// checksum values, and perform a limited number of retries. A persistent
9112 /// mismatch may indicate an issue in your computation of the CRC32C checksum.
9113 /// Note: This field is defined as int64 for reasons of compatibility across
9114 /// different languages. However, it is a non-negative integer, which will
9115 /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
9116 /// languages that support this type.
9117 ///
9118 /// NOTE: This field is in Beta.
9119 ///
9120 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9121 pub pem_crc32c: std::option::Option<wkt::Int64Value>,
9122
9123 /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
9124 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9125 /// Provided here for verification.
9126 ///
9127 /// NOTE: This field is in Beta.
9128 ///
9129 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9130 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
9131 pub name: std::string::String,
9132
9133 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9134 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9135 ///
9136 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9137 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9138 pub protection_level: crate::model::ProtectionLevel,
9139
9140 /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
9141 /// customer through the
9142 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9143 /// field.
9144 ///
9145 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9146 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9147 pub public_key_format: crate::model::public_key::PublicKeyFormat,
9148
9149 /// This field contains the public key (with integrity verification), formatted
9150 /// according to the
9151 /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
9152 ///
9153 /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
9154 pub public_key: std::option::Option<crate::model::ChecksummedData>,
9155
9156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9157}
9158
9159impl PublicKey {
9160 pub fn new() -> Self {
9161 std::default::Default::default()
9162 }
9163
9164 /// Sets the value of [pem][crate::model::PublicKey::pem].
9165 ///
9166 /// # Example
9167 /// ```ignore,no_run
9168 /// # use google_cloud_kms_v1::model::PublicKey;
9169 /// let x = PublicKey::new().set_pem("example");
9170 /// ```
9171 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9172 self.pem = v.into();
9173 self
9174 }
9175
9176 /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
9177 ///
9178 /// # Example
9179 /// ```ignore,no_run
9180 /// # use google_cloud_kms_v1::model::PublicKey;
9181 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
9182 /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
9183 /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
9184 /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
9185 /// ```
9186 pub fn set_algorithm<
9187 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
9188 >(
9189 mut self,
9190 v: T,
9191 ) -> Self {
9192 self.algorithm = v.into();
9193 self
9194 }
9195
9196 /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9197 ///
9198 /// # Example
9199 /// ```ignore,no_run
9200 /// # use google_cloud_kms_v1::model::PublicKey;
9201 /// use wkt::Int64Value;
9202 /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
9203 /// ```
9204 pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
9205 where
9206 T: std::convert::Into<wkt::Int64Value>,
9207 {
9208 self.pem_crc32c = std::option::Option::Some(v.into());
9209 self
9210 }
9211
9212 /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9213 ///
9214 /// # Example
9215 /// ```ignore,no_run
9216 /// # use google_cloud_kms_v1::model::PublicKey;
9217 /// use wkt::Int64Value;
9218 /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
9219 /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
9220 /// ```
9221 pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9222 where
9223 T: std::convert::Into<wkt::Int64Value>,
9224 {
9225 self.pem_crc32c = v.map(|x| x.into());
9226 self
9227 }
9228
9229 /// Sets the value of [name][crate::model::PublicKey::name].
9230 ///
9231 /// # Example
9232 /// ```ignore,no_run
9233 /// # use google_cloud_kms_v1::model::PublicKey;
9234 /// let x = PublicKey::new().set_name("example");
9235 /// ```
9236 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9237 self.name = v.into();
9238 self
9239 }
9240
9241 /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
9242 ///
9243 /// # Example
9244 /// ```ignore,no_run
9245 /// # use google_cloud_kms_v1::model::PublicKey;
9246 /// use google_cloud_kms_v1::model::ProtectionLevel;
9247 /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
9248 /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
9249 /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
9250 /// ```
9251 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9252 mut self,
9253 v: T,
9254 ) -> Self {
9255 self.protection_level = v.into();
9256 self
9257 }
9258
9259 /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
9260 ///
9261 /// # Example
9262 /// ```ignore,no_run
9263 /// # use google_cloud_kms_v1::model::PublicKey;
9264 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9265 /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9266 /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9267 /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9268 /// ```
9269 pub fn set_public_key_format<
9270 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9271 >(
9272 mut self,
9273 v: T,
9274 ) -> Self {
9275 self.public_key_format = v.into();
9276 self
9277 }
9278
9279 /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9280 ///
9281 /// # Example
9282 /// ```ignore,no_run
9283 /// # use google_cloud_kms_v1::model::PublicKey;
9284 /// use google_cloud_kms_v1::model::ChecksummedData;
9285 /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9286 /// ```
9287 pub fn set_public_key<T>(mut self, v: T) -> Self
9288 where
9289 T: std::convert::Into<crate::model::ChecksummedData>,
9290 {
9291 self.public_key = std::option::Option::Some(v.into());
9292 self
9293 }
9294
9295 /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9296 ///
9297 /// # Example
9298 /// ```ignore,no_run
9299 /// # use google_cloud_kms_v1::model::PublicKey;
9300 /// use google_cloud_kms_v1::model::ChecksummedData;
9301 /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9302 /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9303 /// ```
9304 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9305 where
9306 T: std::convert::Into<crate::model::ChecksummedData>,
9307 {
9308 self.public_key = v.map(|x| x.into());
9309 self
9310 }
9311}
9312
9313impl wkt::message::Message for PublicKey {
9314 fn typename() -> &'static str {
9315 "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9316 }
9317}
9318
9319/// Defines additional types related to [PublicKey].
9320pub mod public_key {
9321 #[allow(unused_imports)]
9322 use super::*;
9323
9324 /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9325 ///
9326 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9327 ///
9328 /// # Working with unknown values
9329 ///
9330 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9331 /// additional enum variants at any time. Adding new variants is not considered
9332 /// a breaking change. Applications should write their code in anticipation of:
9333 ///
9334 /// - New values appearing in future releases of the client library, **and**
9335 /// - New values received dynamically, without application changes.
9336 ///
9337 /// Please consult the [Working with enums] section in the user guide for some
9338 /// guidelines.
9339 ///
9340 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9341 #[derive(Clone, Debug, PartialEq)]
9342 #[non_exhaustive]
9343 pub enum PublicKeyFormat {
9344 /// If the
9345 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9346 /// field is not specified:
9347 ///
9348 /// - For PQC algorithms, an error will be returned.
9349 /// - For non-PQC algorithms, the default format is PEM, and the field
9350 /// [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9351 ///
9352 /// Otherwise, the public key will be exported through the
9353 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9354 /// requested format.
9355 ///
9356 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9357 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9358 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9359 Unspecified,
9360 /// The returned public key will be encoded in PEM format.
9361 /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9362 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9363 /// and [Textual Encoding of Subject Public Key Info]
9364 /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9365 Pem,
9366 /// The returned public key will be encoded in DER format (the
9367 /// PrivateKeyInfo structure from RFC 5208).
9368 Der,
9369 /// This is supported only for PQC algorithms.
9370 /// The key material is returned in the format defined by NIST PQC
9371 /// standards (FIPS 203, FIPS 204, and FIPS 205).
9372 NistPqc,
9373 /// The returned public key is in raw bytes format defined in its standard
9374 /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9375 XwingRawBytes,
9376 /// If set, the enum was initialized with an unknown value.
9377 ///
9378 /// Applications can examine the value using [PublicKeyFormat::value] or
9379 /// [PublicKeyFormat::name].
9380 UnknownValue(public_key_format::UnknownValue),
9381 }
9382
9383 #[doc(hidden)]
9384 pub mod public_key_format {
9385 #[allow(unused_imports)]
9386 use super::*;
9387 #[derive(Clone, Debug, PartialEq)]
9388 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9389 }
9390
9391 impl PublicKeyFormat {
9392 /// Gets the enum value.
9393 ///
9394 /// Returns `None` if the enum contains an unknown value deserialized from
9395 /// the string representation of enums.
9396 pub fn value(&self) -> std::option::Option<i32> {
9397 match self {
9398 Self::Unspecified => std::option::Option::Some(0),
9399 Self::Pem => std::option::Option::Some(1),
9400 Self::Der => std::option::Option::Some(2),
9401 Self::NistPqc => std::option::Option::Some(3),
9402 Self::XwingRawBytes => std::option::Option::Some(4),
9403 Self::UnknownValue(u) => u.0.value(),
9404 }
9405 }
9406
9407 /// Gets the enum value as a string.
9408 ///
9409 /// Returns `None` if the enum contains an unknown value deserialized from
9410 /// the integer representation of enums.
9411 pub fn name(&self) -> std::option::Option<&str> {
9412 match self {
9413 Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9414 Self::Pem => std::option::Option::Some("PEM"),
9415 Self::Der => std::option::Option::Some("DER"),
9416 Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9417 Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9418 Self::UnknownValue(u) => u.0.name(),
9419 }
9420 }
9421 }
9422
9423 impl std::default::Default for PublicKeyFormat {
9424 fn default() -> Self {
9425 use std::convert::From;
9426 Self::from(0)
9427 }
9428 }
9429
9430 impl std::fmt::Display for PublicKeyFormat {
9431 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9432 wkt::internal::display_enum(f, self.name(), self.value())
9433 }
9434 }
9435
9436 impl std::convert::From<i32> for PublicKeyFormat {
9437 fn from(value: i32) -> Self {
9438 match value {
9439 0 => Self::Unspecified,
9440 1 => Self::Pem,
9441 2 => Self::Der,
9442 3 => Self::NistPqc,
9443 4 => Self::XwingRawBytes,
9444 _ => Self::UnknownValue(public_key_format::UnknownValue(
9445 wkt::internal::UnknownEnumValue::Integer(value),
9446 )),
9447 }
9448 }
9449 }
9450
9451 impl std::convert::From<&str> for PublicKeyFormat {
9452 fn from(value: &str) -> Self {
9453 use std::string::ToString;
9454 match value {
9455 "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9456 "PEM" => Self::Pem,
9457 "DER" => Self::Der,
9458 "NIST_PQC" => Self::NistPqc,
9459 "XWING_RAW_BYTES" => Self::XwingRawBytes,
9460 _ => Self::UnknownValue(public_key_format::UnknownValue(
9461 wkt::internal::UnknownEnumValue::String(value.to_string()),
9462 )),
9463 }
9464 }
9465 }
9466
9467 impl serde::ser::Serialize for PublicKeyFormat {
9468 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9469 where
9470 S: serde::Serializer,
9471 {
9472 match self {
9473 Self::Unspecified => serializer.serialize_i32(0),
9474 Self::Pem => serializer.serialize_i32(1),
9475 Self::Der => serializer.serialize_i32(2),
9476 Self::NistPqc => serializer.serialize_i32(3),
9477 Self::XwingRawBytes => serializer.serialize_i32(4),
9478 Self::UnknownValue(u) => u.0.serialize(serializer),
9479 }
9480 }
9481 }
9482
9483 impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9484 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9485 where
9486 D: serde::Deserializer<'de>,
9487 {
9488 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9489 ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9490 ))
9491 }
9492 }
9493}
9494
9495/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9496/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9497/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9498/// key material, generated outside of Cloud KMS.
9499///
9500/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9501/// generate a "wrapping key", which is a public/private key pair. You use the
9502/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9503/// protect it during the import process. The nature of the wrapping key depends
9504/// on the choice of
9505/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9506/// wrapping key generation is complete, the
9507/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9508/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9509/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9510/// fetched public key can then be used to wrap your pre-existing key material.
9511///
9512/// Once the key material is wrapped, it can be imported into a new
9513/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9514/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9515/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9516/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9517/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9518/// uses the private key portion of the wrapping key to unwrap the key material.
9519/// Only Cloud KMS has access to the private key.
9520///
9521/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9522/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9523/// any key material that was wrapped with the
9524/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9525///
9526/// For more information, see
9527/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9528///
9529/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9530/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9531/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9532/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9533/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9534/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9535/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9536/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9537#[derive(Clone, Default, PartialEq)]
9538#[non_exhaustive]
9539pub struct ImportJob {
9540 /// Output only. The resource name for this
9541 /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9542 /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9543 ///
9544 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9545 pub name: std::string::String,
9546
9547 /// Required. Immutable. The wrapping method to be used for incoming key
9548 /// material.
9549 pub import_method: crate::model::import_job::ImportMethod,
9550
9551 /// Required. Immutable. The protection level of the
9552 /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9553 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9554 /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9555 /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9556 /// into.
9557 ///
9558 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9559 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9560 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9561 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9562 pub protection_level: crate::model::ProtectionLevel,
9563
9564 /// Output only. The time at which this
9565 /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9566 ///
9567 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9568 pub create_time: std::option::Option<wkt::Timestamp>,
9569
9570 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9571 /// material was generated.
9572 ///
9573 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9574 pub generate_time: std::option::Option<wkt::Timestamp>,
9575
9576 /// Output only. The time at which this
9577 /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9578 /// can no longer be used to import key material.
9579 ///
9580 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9581 pub expire_time: std::option::Option<wkt::Timestamp>,
9582
9583 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9584 /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9585 /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9586 ///
9587 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9588 /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9589 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9590 pub expire_event_time: std::option::Option<wkt::Timestamp>,
9591
9592 /// Output only. The current state of the
9593 /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9594 ///
9595 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9596 pub state: crate::model::import_job::ImportJobState,
9597
9598 /// Output only. The public key with which to wrap key material prior to
9599 /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9600 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9601 ///
9602 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9603 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9604 pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9605
9606 /// Output only. Statement that was generated and signed by the key creator
9607 /// (for example, an HSM) at key creation time. Use this statement to verify
9608 /// attributes of the key as stored on the HSM, independently of Google.
9609 /// Only present if the chosen
9610 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9611 /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9612 ///
9613 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9614 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9615 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9616
9617 /// Immutable. The resource name of the backend environment where the key
9618 /// material for the wrapping key resides and where all related cryptographic
9619 /// operations are performed. Currently, this field is only populated for keys
9620 /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9621 /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9622 /// in the future. Supported resources:
9623 ///
9624 /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9625 ///
9626 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9627 pub crypto_key_backend: std::string::String,
9628
9629 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9630}
9631
9632impl ImportJob {
9633 pub fn new() -> Self {
9634 std::default::Default::default()
9635 }
9636
9637 /// Sets the value of [name][crate::model::ImportJob::name].
9638 ///
9639 /// # Example
9640 /// ```ignore,no_run
9641 /// # use google_cloud_kms_v1::model::ImportJob;
9642 /// let x = ImportJob::new().set_name("example");
9643 /// ```
9644 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9645 self.name = v.into();
9646 self
9647 }
9648
9649 /// Sets the value of [import_method][crate::model::ImportJob::import_method].
9650 ///
9651 /// # Example
9652 /// ```ignore,no_run
9653 /// # use google_cloud_kms_v1::model::ImportJob;
9654 /// use google_cloud_kms_v1::model::import_job::ImportMethod;
9655 /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
9656 /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
9657 /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
9658 /// ```
9659 pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
9660 mut self,
9661 v: T,
9662 ) -> Self {
9663 self.import_method = v.into();
9664 self
9665 }
9666
9667 /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
9668 ///
9669 /// # Example
9670 /// ```ignore,no_run
9671 /// # use google_cloud_kms_v1::model::ImportJob;
9672 /// use google_cloud_kms_v1::model::ProtectionLevel;
9673 /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
9674 /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
9675 /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
9676 /// ```
9677 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9678 mut self,
9679 v: T,
9680 ) -> Self {
9681 self.protection_level = v.into();
9682 self
9683 }
9684
9685 /// Sets the value of [create_time][crate::model::ImportJob::create_time].
9686 ///
9687 /// # Example
9688 /// ```ignore,no_run
9689 /// # use google_cloud_kms_v1::model::ImportJob;
9690 /// use wkt::Timestamp;
9691 /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
9692 /// ```
9693 pub fn set_create_time<T>(mut self, v: T) -> Self
9694 where
9695 T: std::convert::Into<wkt::Timestamp>,
9696 {
9697 self.create_time = std::option::Option::Some(v.into());
9698 self
9699 }
9700
9701 /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
9702 ///
9703 /// # Example
9704 /// ```ignore,no_run
9705 /// # use google_cloud_kms_v1::model::ImportJob;
9706 /// use wkt::Timestamp;
9707 /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9708 /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
9709 /// ```
9710 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9711 where
9712 T: std::convert::Into<wkt::Timestamp>,
9713 {
9714 self.create_time = v.map(|x| x.into());
9715 self
9716 }
9717
9718 /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
9719 ///
9720 /// # Example
9721 /// ```ignore,no_run
9722 /// # use google_cloud_kms_v1::model::ImportJob;
9723 /// use wkt::Timestamp;
9724 /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
9725 /// ```
9726 pub fn set_generate_time<T>(mut self, v: T) -> Self
9727 where
9728 T: std::convert::Into<wkt::Timestamp>,
9729 {
9730 self.generate_time = std::option::Option::Some(v.into());
9731 self
9732 }
9733
9734 /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
9735 ///
9736 /// # Example
9737 /// ```ignore,no_run
9738 /// # use google_cloud_kms_v1::model::ImportJob;
9739 /// use wkt::Timestamp;
9740 /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
9741 /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
9742 /// ```
9743 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
9744 where
9745 T: std::convert::Into<wkt::Timestamp>,
9746 {
9747 self.generate_time = v.map(|x| x.into());
9748 self
9749 }
9750
9751 /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
9752 ///
9753 /// # Example
9754 /// ```ignore,no_run
9755 /// # use google_cloud_kms_v1::model::ImportJob;
9756 /// use wkt::Timestamp;
9757 /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
9758 /// ```
9759 pub fn set_expire_time<T>(mut self, v: T) -> Self
9760 where
9761 T: std::convert::Into<wkt::Timestamp>,
9762 {
9763 self.expire_time = std::option::Option::Some(v.into());
9764 self
9765 }
9766
9767 /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
9768 ///
9769 /// # Example
9770 /// ```ignore,no_run
9771 /// # use google_cloud_kms_v1::model::ImportJob;
9772 /// use wkt::Timestamp;
9773 /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9774 /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
9775 /// ```
9776 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9777 where
9778 T: std::convert::Into<wkt::Timestamp>,
9779 {
9780 self.expire_time = v.map(|x| x.into());
9781 self
9782 }
9783
9784 /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9785 ///
9786 /// # Example
9787 /// ```ignore,no_run
9788 /// # use google_cloud_kms_v1::model::ImportJob;
9789 /// use wkt::Timestamp;
9790 /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
9791 /// ```
9792 pub fn set_expire_event_time<T>(mut self, v: T) -> Self
9793 where
9794 T: std::convert::Into<wkt::Timestamp>,
9795 {
9796 self.expire_event_time = std::option::Option::Some(v.into());
9797 self
9798 }
9799
9800 /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9801 ///
9802 /// # Example
9803 /// ```ignore,no_run
9804 /// # use google_cloud_kms_v1::model::ImportJob;
9805 /// use wkt::Timestamp;
9806 /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
9807 /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
9808 /// ```
9809 pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
9810 where
9811 T: std::convert::Into<wkt::Timestamp>,
9812 {
9813 self.expire_event_time = v.map(|x| x.into());
9814 self
9815 }
9816
9817 /// Sets the value of [state][crate::model::ImportJob::state].
9818 ///
9819 /// # Example
9820 /// ```ignore,no_run
9821 /// # use google_cloud_kms_v1::model::ImportJob;
9822 /// use google_cloud_kms_v1::model::import_job::ImportJobState;
9823 /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
9824 /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
9825 /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
9826 /// ```
9827 pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
9828 mut self,
9829 v: T,
9830 ) -> Self {
9831 self.state = v.into();
9832 self
9833 }
9834
9835 /// Sets the value of [public_key][crate::model::ImportJob::public_key].
9836 ///
9837 /// # Example
9838 /// ```ignore,no_run
9839 /// # use google_cloud_kms_v1::model::ImportJob;
9840 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9841 /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
9842 /// ```
9843 pub fn set_public_key<T>(mut self, v: T) -> Self
9844 where
9845 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9846 {
9847 self.public_key = std::option::Option::Some(v.into());
9848 self
9849 }
9850
9851 /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
9852 ///
9853 /// # Example
9854 /// ```ignore,no_run
9855 /// # use google_cloud_kms_v1::model::ImportJob;
9856 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9857 /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
9858 /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
9859 /// ```
9860 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9861 where
9862 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
9863 {
9864 self.public_key = v.map(|x| x.into());
9865 self
9866 }
9867
9868 /// Sets the value of [attestation][crate::model::ImportJob::attestation].
9869 ///
9870 /// # Example
9871 /// ```ignore,no_run
9872 /// # use google_cloud_kms_v1::model::ImportJob;
9873 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9874 /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
9875 /// ```
9876 pub fn set_attestation<T>(mut self, v: T) -> Self
9877 where
9878 T: std::convert::Into<crate::model::KeyOperationAttestation>,
9879 {
9880 self.attestation = std::option::Option::Some(v.into());
9881 self
9882 }
9883
9884 /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
9885 ///
9886 /// # Example
9887 /// ```ignore,no_run
9888 /// # use google_cloud_kms_v1::model::ImportJob;
9889 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
9890 /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
9891 /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
9892 /// ```
9893 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
9894 where
9895 T: std::convert::Into<crate::model::KeyOperationAttestation>,
9896 {
9897 self.attestation = v.map(|x| x.into());
9898 self
9899 }
9900
9901 /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
9902 ///
9903 /// # Example
9904 /// ```ignore,no_run
9905 /// # use google_cloud_kms_v1::model::ImportJob;
9906 /// let x = ImportJob::new().set_crypto_key_backend("example");
9907 /// ```
9908 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
9909 mut self,
9910 v: T,
9911 ) -> Self {
9912 self.crypto_key_backend = v.into();
9913 self
9914 }
9915}
9916
9917impl wkt::message::Message for ImportJob {
9918 fn typename() -> &'static str {
9919 "type.googleapis.com/google.cloud.kms.v1.ImportJob"
9920 }
9921}
9922
9923/// Defines additional types related to [ImportJob].
9924pub mod import_job {
9925 #[allow(unused_imports)]
9926 use super::*;
9927
9928 /// The public key component of the wrapping key. For details of the type of
9929 /// key this public key corresponds to, see the
9930 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
9931 ///
9932 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9933 #[derive(Clone, Default, PartialEq)]
9934 #[non_exhaustive]
9935 pub struct WrappingPublicKey {
9936 /// The public key, encoded in PEM format. For more information, see the [RFC
9937 /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
9938 /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9939 /// [Textual Encoding of Subject Public Key Info]
9940 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9941 pub pem: std::string::String,
9942
9943 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9944 }
9945
9946 impl WrappingPublicKey {
9947 pub fn new() -> Self {
9948 std::default::Default::default()
9949 }
9950
9951 /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
9952 ///
9953 /// # Example
9954 /// ```ignore,no_run
9955 /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
9956 /// let x = WrappingPublicKey::new().set_pem("example");
9957 /// ```
9958 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9959 self.pem = v.into();
9960 self
9961 }
9962 }
9963
9964 impl wkt::message::Message for WrappingPublicKey {
9965 fn typename() -> &'static str {
9966 "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
9967 }
9968 }
9969
9970 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
9971 /// key wrapping method chosen for this
9972 /// [ImportJob][google.cloud.kms.v1.ImportJob].
9973 ///
9974 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9975 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9976 ///
9977 /// # Working with unknown values
9978 ///
9979 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9980 /// additional enum variants at any time. Adding new variants is not considered
9981 /// a breaking change. Applications should write their code in anticipation of:
9982 ///
9983 /// - New values appearing in future releases of the client library, **and**
9984 /// - New values received dynamically, without application changes.
9985 ///
9986 /// Please consult the [Working with enums] section in the user guide for some
9987 /// guidelines.
9988 ///
9989 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9990 #[derive(Clone, Debug, PartialEq)]
9991 #[non_exhaustive]
9992 pub enum ImportMethod {
9993 /// Not specified.
9994 Unspecified,
9995 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
9996 /// scheme defined in the PKCS #11 standard. In summary, this involves
9997 /// wrapping the raw key with an ephemeral AES key, and wrapping the
9998 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
9999 /// [RSA AES key wrap
10000 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10001 RsaOaep3072Sha1Aes256,
10002 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10003 /// scheme defined in the PKCS #11 standard. In summary, this involves
10004 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10005 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10006 /// [RSA AES key wrap
10007 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10008 RsaOaep4096Sha1Aes256,
10009 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10010 /// scheme defined in the PKCS #11 standard. In summary, this involves
10011 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10012 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10013 /// [RSA AES key wrap
10014 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10015 RsaOaep3072Sha256Aes256,
10016 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10017 /// scheme defined in the PKCS #11 standard. In summary, this involves
10018 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10019 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10020 /// [RSA AES key wrap
10021 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10022 RsaOaep4096Sha256Aes256,
10023 /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
10024 /// key material to be imported is wrapped directly with the RSA key. Due
10025 /// to technical limitations of RSA wrapping, this method cannot be used to
10026 /// wrap RSA keys for import.
10027 RsaOaep3072Sha256,
10028 /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
10029 /// key material to be imported is wrapped directly with the RSA key. Due
10030 /// to technical limitations of RSA wrapping, this method cannot be used to
10031 /// wrap RSA keys for import.
10032 RsaOaep4096Sha256,
10033 /// If set, the enum was initialized with an unknown value.
10034 ///
10035 /// Applications can examine the value using [ImportMethod::value] or
10036 /// [ImportMethod::name].
10037 UnknownValue(import_method::UnknownValue),
10038 }
10039
10040 #[doc(hidden)]
10041 pub mod import_method {
10042 #[allow(unused_imports)]
10043 use super::*;
10044 #[derive(Clone, Debug, PartialEq)]
10045 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10046 }
10047
10048 impl ImportMethod {
10049 /// Gets the enum value.
10050 ///
10051 /// Returns `None` if the enum contains an unknown value deserialized from
10052 /// the string representation of enums.
10053 pub fn value(&self) -> std::option::Option<i32> {
10054 match self {
10055 Self::Unspecified => std::option::Option::Some(0),
10056 Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
10057 Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
10058 Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
10059 Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
10060 Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
10061 Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
10062 Self::UnknownValue(u) => u.0.value(),
10063 }
10064 }
10065
10066 /// Gets the enum value as a string.
10067 ///
10068 /// Returns `None` if the enum contains an unknown value deserialized from
10069 /// the integer representation of enums.
10070 pub fn name(&self) -> std::option::Option<&str> {
10071 match self {
10072 Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
10073 Self::RsaOaep3072Sha1Aes256 => {
10074 std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
10075 }
10076 Self::RsaOaep4096Sha1Aes256 => {
10077 std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
10078 }
10079 Self::RsaOaep3072Sha256Aes256 => {
10080 std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
10081 }
10082 Self::RsaOaep4096Sha256Aes256 => {
10083 std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
10084 }
10085 Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
10086 Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
10087 Self::UnknownValue(u) => u.0.name(),
10088 }
10089 }
10090 }
10091
10092 impl std::default::Default for ImportMethod {
10093 fn default() -> Self {
10094 use std::convert::From;
10095 Self::from(0)
10096 }
10097 }
10098
10099 impl std::fmt::Display for ImportMethod {
10100 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10101 wkt::internal::display_enum(f, self.name(), self.value())
10102 }
10103 }
10104
10105 impl std::convert::From<i32> for ImportMethod {
10106 fn from(value: i32) -> Self {
10107 match value {
10108 0 => Self::Unspecified,
10109 1 => Self::RsaOaep3072Sha1Aes256,
10110 2 => Self::RsaOaep4096Sha1Aes256,
10111 3 => Self::RsaOaep3072Sha256Aes256,
10112 4 => Self::RsaOaep4096Sha256Aes256,
10113 5 => Self::RsaOaep3072Sha256,
10114 6 => Self::RsaOaep4096Sha256,
10115 _ => Self::UnknownValue(import_method::UnknownValue(
10116 wkt::internal::UnknownEnumValue::Integer(value),
10117 )),
10118 }
10119 }
10120 }
10121
10122 impl std::convert::From<&str> for ImportMethod {
10123 fn from(value: &str) -> Self {
10124 use std::string::ToString;
10125 match value {
10126 "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
10127 "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
10128 "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
10129 "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
10130 "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
10131 "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
10132 "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
10133 _ => Self::UnknownValue(import_method::UnknownValue(
10134 wkt::internal::UnknownEnumValue::String(value.to_string()),
10135 )),
10136 }
10137 }
10138 }
10139
10140 impl serde::ser::Serialize for ImportMethod {
10141 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10142 where
10143 S: serde::Serializer,
10144 {
10145 match self {
10146 Self::Unspecified => serializer.serialize_i32(0),
10147 Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
10148 Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
10149 Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
10150 Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
10151 Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
10152 Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
10153 Self::UnknownValue(u) => u.0.serialize(serializer),
10154 }
10155 }
10156 }
10157
10158 impl<'de> serde::de::Deserialize<'de> for ImportMethod {
10159 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10160 where
10161 D: serde::Deserializer<'de>,
10162 {
10163 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
10164 ".google.cloud.kms.v1.ImportJob.ImportMethod",
10165 ))
10166 }
10167 }
10168
10169 /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
10170 /// it can be used.
10171 ///
10172 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10173 ///
10174 /// # Working with unknown values
10175 ///
10176 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10177 /// additional enum variants at any time. Adding new variants is not considered
10178 /// a breaking change. Applications should write their code in anticipation of:
10179 ///
10180 /// - New values appearing in future releases of the client library, **and**
10181 /// - New values received dynamically, without application changes.
10182 ///
10183 /// Please consult the [Working with enums] section in the user guide for some
10184 /// guidelines.
10185 ///
10186 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10187 #[derive(Clone, Debug, PartialEq)]
10188 #[non_exhaustive]
10189 pub enum ImportJobState {
10190 /// Not specified.
10191 Unspecified,
10192 /// The wrapping key for this job is still being generated. It may not be
10193 /// used. Cloud KMS will automatically mark this job as
10194 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
10195 /// the wrapping key is generated.
10196 ///
10197 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
10198 PendingGeneration,
10199 /// This job may be used in
10200 /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
10201 /// and
10202 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
10203 /// requests.
10204 ///
10205 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
10206 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
10207 Active,
10208 /// This job can no longer be used and may not leave this state once entered.
10209 Expired,
10210 /// If set, the enum was initialized with an unknown value.
10211 ///
10212 /// Applications can examine the value using [ImportJobState::value] or
10213 /// [ImportJobState::name].
10214 UnknownValue(import_job_state::UnknownValue),
10215 }
10216
10217 #[doc(hidden)]
10218 pub mod import_job_state {
10219 #[allow(unused_imports)]
10220 use super::*;
10221 #[derive(Clone, Debug, PartialEq)]
10222 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10223 }
10224
10225 impl ImportJobState {
10226 /// Gets the enum value.
10227 ///
10228 /// Returns `None` if the enum contains an unknown value deserialized from
10229 /// the string representation of enums.
10230 pub fn value(&self) -> std::option::Option<i32> {
10231 match self {
10232 Self::Unspecified => std::option::Option::Some(0),
10233 Self::PendingGeneration => std::option::Option::Some(1),
10234 Self::Active => std::option::Option::Some(2),
10235 Self::Expired => std::option::Option::Some(3),
10236 Self::UnknownValue(u) => u.0.value(),
10237 }
10238 }
10239
10240 /// Gets the enum value as a string.
10241 ///
10242 /// Returns `None` if the enum contains an unknown value deserialized from
10243 /// the integer representation of enums.
10244 pub fn name(&self) -> std::option::Option<&str> {
10245 match self {
10246 Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
10247 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
10248 Self::Active => std::option::Option::Some("ACTIVE"),
10249 Self::Expired => std::option::Option::Some("EXPIRED"),
10250 Self::UnknownValue(u) => u.0.name(),
10251 }
10252 }
10253 }
10254
10255 impl std::default::Default for ImportJobState {
10256 fn default() -> Self {
10257 use std::convert::From;
10258 Self::from(0)
10259 }
10260 }
10261
10262 impl std::fmt::Display for ImportJobState {
10263 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10264 wkt::internal::display_enum(f, self.name(), self.value())
10265 }
10266 }
10267
10268 impl std::convert::From<i32> for ImportJobState {
10269 fn from(value: i32) -> Self {
10270 match value {
10271 0 => Self::Unspecified,
10272 1 => Self::PendingGeneration,
10273 2 => Self::Active,
10274 3 => Self::Expired,
10275 _ => Self::UnknownValue(import_job_state::UnknownValue(
10276 wkt::internal::UnknownEnumValue::Integer(value),
10277 )),
10278 }
10279 }
10280 }
10281
10282 impl std::convert::From<&str> for ImportJobState {
10283 fn from(value: &str) -> Self {
10284 use std::string::ToString;
10285 match value {
10286 "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10287 "PENDING_GENERATION" => Self::PendingGeneration,
10288 "ACTIVE" => Self::Active,
10289 "EXPIRED" => Self::Expired,
10290 _ => Self::UnknownValue(import_job_state::UnknownValue(
10291 wkt::internal::UnknownEnumValue::String(value.to_string()),
10292 )),
10293 }
10294 }
10295 }
10296
10297 impl serde::ser::Serialize for ImportJobState {
10298 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10299 where
10300 S: serde::Serializer,
10301 {
10302 match self {
10303 Self::Unspecified => serializer.serialize_i32(0),
10304 Self::PendingGeneration => serializer.serialize_i32(1),
10305 Self::Active => serializer.serialize_i32(2),
10306 Self::Expired => serializer.serialize_i32(3),
10307 Self::UnknownValue(u) => u.0.serialize(serializer),
10308 }
10309 }
10310 }
10311
10312 impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10313 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10314 where
10315 D: serde::Deserializer<'de>,
10316 {
10317 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10318 ".google.cloud.kms.v1.ImportJob.ImportJobState",
10319 ))
10320 }
10321 }
10322}
10323
10324/// ExternalProtectionLevelOptions stores a group of additional fields for
10325/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10326/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10327/// protection level and
10328/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10329/// levels.
10330///
10331/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10332/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10333/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10334#[derive(Clone, Default, PartialEq)]
10335#[non_exhaustive]
10336pub struct ExternalProtectionLevelOptions {
10337 /// The URI for an external resource that this
10338 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10339 ///
10340 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10341 pub external_key_uri: std::string::String,
10342
10343 /// The path to the external key material on the EKM when using
10344 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10345 /// this field instead of external_key_uri when using an
10346 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10347 ///
10348 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10349 pub ekm_connection_key_path: std::string::String,
10350
10351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10352}
10353
10354impl ExternalProtectionLevelOptions {
10355 pub fn new() -> Self {
10356 std::default::Default::default()
10357 }
10358
10359 /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10360 ///
10361 /// # Example
10362 /// ```ignore,no_run
10363 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10364 /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10365 /// ```
10366 pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10367 mut self,
10368 v: T,
10369 ) -> Self {
10370 self.external_key_uri = v.into();
10371 self
10372 }
10373
10374 /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10375 ///
10376 /// # Example
10377 /// ```ignore,no_run
10378 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10379 /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10380 /// ```
10381 pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10382 mut self,
10383 v: T,
10384 ) -> Self {
10385 self.ekm_connection_key_path = v.into();
10386 self
10387 }
10388}
10389
10390impl wkt::message::Message for ExternalProtectionLevelOptions {
10391 fn typename() -> &'static str {
10392 "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10393 }
10394}
10395
10396/// A
10397/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10398/// specifies zero or more allowed
10399/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10400/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey].
10401///
10402/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10403/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10404/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10405#[derive(Clone, Default, PartialEq)]
10406#[non_exhaustive]
10407pub struct KeyAccessJustificationsPolicy {
10408 /// The list of allowed reasons for access to a
10409 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Zero allowed access reasons
10410 /// means all encrypt, decrypt, and sign operations for the
10411 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with this policy will
10412 /// fail.
10413 ///
10414 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10415 pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10416
10417 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10418}
10419
10420impl KeyAccessJustificationsPolicy {
10421 pub fn new() -> Self {
10422 std::default::Default::default()
10423 }
10424
10425 /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10426 ///
10427 /// # Example
10428 /// ```ignore,no_run
10429 /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10430 /// use google_cloud_kms_v1::model::AccessReason;
10431 /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10432 /// AccessReason::CustomerInitiatedSupport,
10433 /// AccessReason::GoogleInitiatedService,
10434 /// AccessReason::ThirdPartyDataRequest,
10435 /// ]);
10436 /// ```
10437 pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10438 where
10439 T: std::iter::IntoIterator<Item = V>,
10440 V: std::convert::Into<crate::model::AccessReason>,
10441 {
10442 use std::iter::Iterator;
10443 self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10444 self
10445 }
10446}
10447
10448impl wkt::message::Message for KeyAccessJustificationsPolicy {
10449 fn typename() -> &'static str {
10450 "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10451 }
10452}
10453
10454/// A RetiredResource resource represents the record of a deleted
10455/// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Its purpose is to provide
10456/// visibility into retained user data and to prevent reuse of these names for
10457/// new [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10458///
10459/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10460#[derive(Clone, Default, PartialEq)]
10461#[non_exhaustive]
10462pub struct RetiredResource {
10463 /// Output only. Identifier. The resource name for this
10464 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] in the format
10465 /// `projects/*/locations/*/retiredResources/*`.
10466 ///
10467 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10468 pub name: std::string::String,
10469
10470 /// Output only. The full resource name of the original
10471 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] that was deleted in the format
10472 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10473 ///
10474 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10475 pub original_resource: std::string::String,
10476
10477 /// Output only. The resource type of the original deleted resource.
10478 pub resource_type: std::string::String,
10479
10480 /// Output only. The time at which the original resource was deleted and this
10481 /// RetiredResource record was created.
10482 pub delete_time: std::option::Option<wkt::Timestamp>,
10483
10484 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10485}
10486
10487impl RetiredResource {
10488 pub fn new() -> Self {
10489 std::default::Default::default()
10490 }
10491
10492 /// Sets the value of [name][crate::model::RetiredResource::name].
10493 ///
10494 /// # Example
10495 /// ```ignore,no_run
10496 /// # use google_cloud_kms_v1::model::RetiredResource;
10497 /// let x = RetiredResource::new().set_name("example");
10498 /// ```
10499 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10500 self.name = v.into();
10501 self
10502 }
10503
10504 /// Sets the value of [original_resource][crate::model::RetiredResource::original_resource].
10505 ///
10506 /// # Example
10507 /// ```ignore,no_run
10508 /// # use google_cloud_kms_v1::model::RetiredResource;
10509 /// let x = RetiredResource::new().set_original_resource("example");
10510 /// ```
10511 pub fn set_original_resource<T: std::convert::Into<std::string::String>>(
10512 mut self,
10513 v: T,
10514 ) -> Self {
10515 self.original_resource = v.into();
10516 self
10517 }
10518
10519 /// Sets the value of [resource_type][crate::model::RetiredResource::resource_type].
10520 ///
10521 /// # Example
10522 /// ```ignore,no_run
10523 /// # use google_cloud_kms_v1::model::RetiredResource;
10524 /// let x = RetiredResource::new().set_resource_type("example");
10525 /// ```
10526 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10527 self.resource_type = v.into();
10528 self
10529 }
10530
10531 /// Sets the value of [delete_time][crate::model::RetiredResource::delete_time].
10532 ///
10533 /// # Example
10534 /// ```ignore,no_run
10535 /// # use google_cloud_kms_v1::model::RetiredResource;
10536 /// use wkt::Timestamp;
10537 /// let x = RetiredResource::new().set_delete_time(Timestamp::default()/* use setters */);
10538 /// ```
10539 pub fn set_delete_time<T>(mut self, v: T) -> Self
10540 where
10541 T: std::convert::Into<wkt::Timestamp>,
10542 {
10543 self.delete_time = std::option::Option::Some(v.into());
10544 self
10545 }
10546
10547 /// Sets or clears the value of [delete_time][crate::model::RetiredResource::delete_time].
10548 ///
10549 /// # Example
10550 /// ```ignore,no_run
10551 /// # use google_cloud_kms_v1::model::RetiredResource;
10552 /// use wkt::Timestamp;
10553 /// let x = RetiredResource::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
10554 /// let x = RetiredResource::new().set_or_clear_delete_time(None::<Timestamp>);
10555 /// ```
10556 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
10557 where
10558 T: std::convert::Into<wkt::Timestamp>,
10559 {
10560 self.delete_time = v.map(|x| x.into());
10561 self
10562 }
10563}
10564
10565impl wkt::message::Message for RetiredResource {
10566 fn typename() -> &'static str {
10567 "type.googleapis.com/google.cloud.kms.v1.RetiredResource"
10568 }
10569}
10570
10571/// Request message for
10572/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10573///
10574/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10575#[derive(Clone, Default, PartialEq)]
10576#[non_exhaustive]
10577pub struct ListKeyRingsRequest {
10578 /// Required. The resource name of the location associated with the
10579 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
10580 /// `projects/*/locations/*`.
10581 ///
10582 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10583 pub parent: std::string::String,
10584
10585 /// Optional. Optional limit on the number of
10586 /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
10587 /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
10588 /// including the
10589 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
10590 /// in a subsequent request. If unspecified, the server will pick an
10591 /// appropriate default.
10592 ///
10593 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10594 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10595 pub page_size: i32,
10596
10597 /// Optional. Optional pagination token, returned earlier via
10598 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
10599 ///
10600 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10601 pub page_token: std::string::String,
10602
10603 /// Optional. Only include resources that match the filter in the response. For
10604 /// more information, see
10605 /// [Sorting and filtering list
10606 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10607 pub filter: std::string::String,
10608
10609 /// Optional. Specify how the results should be sorted. If not specified, the
10610 /// results will be sorted in the default order. For more information, see
10611 /// [Sorting and filtering list
10612 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10613 pub order_by: std::string::String,
10614
10615 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10616}
10617
10618impl ListKeyRingsRequest {
10619 pub fn new() -> Self {
10620 std::default::Default::default()
10621 }
10622
10623 /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
10624 ///
10625 /// # Example
10626 /// ```ignore,no_run
10627 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10628 /// let x = ListKeyRingsRequest::new().set_parent("example");
10629 /// ```
10630 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10631 self.parent = v.into();
10632 self
10633 }
10634
10635 /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
10636 ///
10637 /// # Example
10638 /// ```ignore,no_run
10639 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10640 /// let x = ListKeyRingsRequest::new().set_page_size(42);
10641 /// ```
10642 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10643 self.page_size = v.into();
10644 self
10645 }
10646
10647 /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
10648 ///
10649 /// # Example
10650 /// ```ignore,no_run
10651 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10652 /// let x = ListKeyRingsRequest::new().set_page_token("example");
10653 /// ```
10654 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10655 self.page_token = v.into();
10656 self
10657 }
10658
10659 /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
10660 ///
10661 /// # Example
10662 /// ```ignore,no_run
10663 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10664 /// let x = ListKeyRingsRequest::new().set_filter("example");
10665 /// ```
10666 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10667 self.filter = v.into();
10668 self
10669 }
10670
10671 /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
10672 ///
10673 /// # Example
10674 /// ```ignore,no_run
10675 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10676 /// let x = ListKeyRingsRequest::new().set_order_by("example");
10677 /// ```
10678 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10679 self.order_by = v.into();
10680 self
10681 }
10682}
10683
10684impl wkt::message::Message for ListKeyRingsRequest {
10685 fn typename() -> &'static str {
10686 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
10687 }
10688}
10689
10690/// Request message for
10691/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10692///
10693/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10694#[derive(Clone, Default, PartialEq)]
10695#[non_exhaustive]
10696pub struct ListCryptoKeysRequest {
10697 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10698 /// to list, in the format `projects/*/locations/*/keyRings/*`.
10699 ///
10700 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10701 pub parent: std::string::String,
10702
10703 /// Optional. Optional limit on the number of
10704 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
10705 /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
10706 /// obtained by including the
10707 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
10708 /// in a subsequent request. If unspecified, the server will pick an
10709 /// appropriate default.
10710 ///
10711 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10712 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10713 pub page_size: i32,
10714
10715 /// Optional. Optional pagination token, returned earlier via
10716 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
10717 ///
10718 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10719 pub page_token: std::string::String,
10720
10721 /// The fields of the primary version to include in the response.
10722 pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
10723
10724 /// Optional. Only include resources that match the filter in the response. For
10725 /// more information, see
10726 /// [Sorting and filtering list
10727 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10728 pub filter: std::string::String,
10729
10730 /// Optional. Specify how the results should be sorted. If not specified, the
10731 /// results will be sorted in the default order. For more information, see
10732 /// [Sorting and filtering list
10733 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10734 pub order_by: std::string::String,
10735
10736 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10737}
10738
10739impl ListCryptoKeysRequest {
10740 pub fn new() -> Self {
10741 std::default::Default::default()
10742 }
10743
10744 /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
10745 ///
10746 /// # Example
10747 /// ```ignore,no_run
10748 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10749 /// let x = ListCryptoKeysRequest::new().set_parent("example");
10750 /// ```
10751 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10752 self.parent = v.into();
10753 self
10754 }
10755
10756 /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
10757 ///
10758 /// # Example
10759 /// ```ignore,no_run
10760 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10761 /// let x = ListCryptoKeysRequest::new().set_page_size(42);
10762 /// ```
10763 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10764 self.page_size = v.into();
10765 self
10766 }
10767
10768 /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
10769 ///
10770 /// # Example
10771 /// ```ignore,no_run
10772 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10773 /// let x = ListCryptoKeysRequest::new().set_page_token("example");
10774 /// ```
10775 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10776 self.page_token = v.into();
10777 self
10778 }
10779
10780 /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
10781 ///
10782 /// # Example
10783 /// ```ignore,no_run
10784 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10785 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10786 /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
10787 /// ```
10788 pub fn set_version_view<
10789 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10790 >(
10791 mut self,
10792 v: T,
10793 ) -> Self {
10794 self.version_view = v.into();
10795 self
10796 }
10797
10798 /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
10799 ///
10800 /// # Example
10801 /// ```ignore,no_run
10802 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10803 /// let x = ListCryptoKeysRequest::new().set_filter("example");
10804 /// ```
10805 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10806 self.filter = v.into();
10807 self
10808 }
10809
10810 /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
10811 ///
10812 /// # Example
10813 /// ```ignore,no_run
10814 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10815 /// let x = ListCryptoKeysRequest::new().set_order_by("example");
10816 /// ```
10817 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10818 self.order_by = v.into();
10819 self
10820 }
10821}
10822
10823impl wkt::message::Message for ListCryptoKeysRequest {
10824 fn typename() -> &'static str {
10825 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
10826 }
10827}
10828
10829/// Request message for
10830/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
10831///
10832/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
10833#[derive(Clone, Default, PartialEq)]
10834#[non_exhaustive]
10835pub struct ListCryptoKeyVersionsRequest {
10836 /// Required. The resource name of the
10837 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
10838 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10839 ///
10840 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10841 pub parent: std::string::String,
10842
10843 /// Optional. Optional limit on the number of
10844 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
10845 /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
10846 /// can subsequently be obtained by including the
10847 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
10848 /// in a subsequent request. If unspecified, the server will pick an
10849 /// appropriate default.
10850 ///
10851 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10852 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10853 pub page_size: i32,
10854
10855 /// Optional. Optional pagination token, returned earlier via
10856 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
10857 ///
10858 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
10859 pub page_token: std::string::String,
10860
10861 /// The fields to include in the response.
10862 pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
10863
10864 /// Optional. Only include resources that match the filter in the response. For
10865 /// more information, see
10866 /// [Sorting and filtering list
10867 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10868 pub filter: std::string::String,
10869
10870 /// Optional. Specify how the results should be sorted. If not specified, the
10871 /// results will be sorted in the default order. For more information, see
10872 /// [Sorting and filtering list
10873 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10874 pub order_by: std::string::String,
10875
10876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10877}
10878
10879impl ListCryptoKeyVersionsRequest {
10880 pub fn new() -> Self {
10881 std::default::Default::default()
10882 }
10883
10884 /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
10885 ///
10886 /// # Example
10887 /// ```ignore,no_run
10888 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10889 /// let x = ListCryptoKeyVersionsRequest::new().set_parent("example");
10890 /// ```
10891 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10892 self.parent = v.into();
10893 self
10894 }
10895
10896 /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
10897 ///
10898 /// # Example
10899 /// ```ignore,no_run
10900 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10901 /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
10902 /// ```
10903 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10904 self.page_size = v.into();
10905 self
10906 }
10907
10908 /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
10909 ///
10910 /// # Example
10911 /// ```ignore,no_run
10912 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10913 /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
10914 /// ```
10915 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10916 self.page_token = v.into();
10917 self
10918 }
10919
10920 /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
10921 ///
10922 /// # Example
10923 /// ```ignore,no_run
10924 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10925 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10926 /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
10927 /// ```
10928 pub fn set_view<
10929 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10930 >(
10931 mut self,
10932 v: T,
10933 ) -> Self {
10934 self.view = v.into();
10935 self
10936 }
10937
10938 /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
10939 ///
10940 /// # Example
10941 /// ```ignore,no_run
10942 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10943 /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
10944 /// ```
10945 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10946 self.filter = v.into();
10947 self
10948 }
10949
10950 /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
10951 ///
10952 /// # Example
10953 /// ```ignore,no_run
10954 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
10955 /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
10956 /// ```
10957 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10958 self.order_by = v.into();
10959 self
10960 }
10961}
10962
10963impl wkt::message::Message for ListCryptoKeyVersionsRequest {
10964 fn typename() -> &'static str {
10965 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
10966 }
10967}
10968
10969/// Request message for
10970/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
10971///
10972/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
10973#[derive(Clone, Default, PartialEq)]
10974#[non_exhaustive]
10975pub struct ListImportJobsRequest {
10976 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10977 /// to list, in the format `projects/*/locations/*/keyRings/*`.
10978 ///
10979 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10980 pub parent: std::string::String,
10981
10982 /// Optional. Optional limit on the number of
10983 /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
10984 /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
10985 /// obtained by including the
10986 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
10987 /// in a subsequent request. If unspecified, the server will pick an
10988 /// appropriate default.
10989 ///
10990 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10991 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10992 pub page_size: i32,
10993
10994 /// Optional. Optional pagination token, returned earlier via
10995 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
10996 ///
10997 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
10998 pub page_token: std::string::String,
10999
11000 /// Optional. Only include resources that match the filter in the response. For
11001 /// more information, see
11002 /// [Sorting and filtering list
11003 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11004 pub filter: std::string::String,
11005
11006 /// Optional. Specify how the results should be sorted. If not specified, the
11007 /// results will be sorted in the default order. For more information, see
11008 /// [Sorting and filtering list
11009 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11010 pub order_by: std::string::String,
11011
11012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11013}
11014
11015impl ListImportJobsRequest {
11016 pub fn new() -> Self {
11017 std::default::Default::default()
11018 }
11019
11020 /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
11021 ///
11022 /// # Example
11023 /// ```ignore,no_run
11024 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11025 /// let x = ListImportJobsRequest::new().set_parent("example");
11026 /// ```
11027 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11028 self.parent = v.into();
11029 self
11030 }
11031
11032 /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
11033 ///
11034 /// # Example
11035 /// ```ignore,no_run
11036 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11037 /// let x = ListImportJobsRequest::new().set_page_size(42);
11038 /// ```
11039 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11040 self.page_size = v.into();
11041 self
11042 }
11043
11044 /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
11045 ///
11046 /// # Example
11047 /// ```ignore,no_run
11048 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11049 /// let x = ListImportJobsRequest::new().set_page_token("example");
11050 /// ```
11051 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11052 self.page_token = v.into();
11053 self
11054 }
11055
11056 /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
11057 ///
11058 /// # Example
11059 /// ```ignore,no_run
11060 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11061 /// let x = ListImportJobsRequest::new().set_filter("example");
11062 /// ```
11063 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11064 self.filter = v.into();
11065 self
11066 }
11067
11068 /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
11069 ///
11070 /// # Example
11071 /// ```ignore,no_run
11072 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11073 /// let x = ListImportJobsRequest::new().set_order_by("example");
11074 /// ```
11075 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11076 self.order_by = v.into();
11077 self
11078 }
11079}
11080
11081impl wkt::message::Message for ListImportJobsRequest {
11082 fn typename() -> &'static str {
11083 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
11084 }
11085}
11086
11087/// Request message for
11088/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11089///
11090/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11091#[derive(Clone, Default, PartialEq)]
11092#[non_exhaustive]
11093pub struct ListRetiredResourcesRequest {
11094 /// Required. The project-specific location holding the
11095 /// [RetiredResources][google.cloud.kms.v1.RetiredResource], in the format
11096 /// `projects/*/locations/*`.
11097 ///
11098 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11099 pub parent: std::string::String,
11100
11101 /// Optional. Optional limit on the number of
11102 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] to be included in
11103 /// the response. Further
11104 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] can subsequently be
11105 /// obtained by including the
11106 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]
11107 /// in a subsequent request. If unspecified, the server will pick an
11108 /// appropriate default.
11109 ///
11110 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11111 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11112 pub page_size: i32,
11113
11114 /// Optional. Optional pagination token, returned earlier via
11115 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token].
11116 ///
11117 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11118 pub page_token: std::string::String,
11119
11120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11121}
11122
11123impl ListRetiredResourcesRequest {
11124 pub fn new() -> Self {
11125 std::default::Default::default()
11126 }
11127
11128 /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
11129 ///
11130 /// # Example
11131 /// ```ignore,no_run
11132 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11133 /// let x = ListRetiredResourcesRequest::new().set_parent("example");
11134 /// ```
11135 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11136 self.parent = v.into();
11137 self
11138 }
11139
11140 /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
11141 ///
11142 /// # Example
11143 /// ```ignore,no_run
11144 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11145 /// let x = ListRetiredResourcesRequest::new().set_page_size(42);
11146 /// ```
11147 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11148 self.page_size = v.into();
11149 self
11150 }
11151
11152 /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
11153 ///
11154 /// # Example
11155 /// ```ignore,no_run
11156 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11157 /// let x = ListRetiredResourcesRequest::new().set_page_token("example");
11158 /// ```
11159 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11160 self.page_token = v.into();
11161 self
11162 }
11163}
11164
11165impl wkt::message::Message for ListRetiredResourcesRequest {
11166 fn typename() -> &'static str {
11167 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesRequest"
11168 }
11169}
11170
11171/// Response message for
11172/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
11173///
11174/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
11175#[derive(Clone, Default, PartialEq)]
11176#[non_exhaustive]
11177pub struct ListKeyRingsResponse {
11178 /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
11179 ///
11180 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11181 pub key_rings: std::vec::Vec<crate::model::KeyRing>,
11182
11183 /// A token to retrieve next page of results. Pass this value in
11184 /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
11185 /// to retrieve the next page of results.
11186 ///
11187 /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
11188 pub next_page_token: std::string::String,
11189
11190 /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
11191 /// the query.
11192 ///
11193 /// This field is not populated if
11194 /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
11195 /// is applied.
11196 ///
11197 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11198 /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
11199 pub total_size: i32,
11200
11201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11202}
11203
11204impl ListKeyRingsResponse {
11205 pub fn new() -> Self {
11206 std::default::Default::default()
11207 }
11208
11209 /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
11210 ///
11211 /// # Example
11212 /// ```ignore,no_run
11213 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11214 /// use google_cloud_kms_v1::model::KeyRing;
11215 /// let x = ListKeyRingsResponse::new()
11216 /// .set_key_rings([
11217 /// KeyRing::default()/* use setters */,
11218 /// KeyRing::default()/* use (different) setters */,
11219 /// ]);
11220 /// ```
11221 pub fn set_key_rings<T, V>(mut self, v: T) -> Self
11222 where
11223 T: std::iter::IntoIterator<Item = V>,
11224 V: std::convert::Into<crate::model::KeyRing>,
11225 {
11226 use std::iter::Iterator;
11227 self.key_rings = v.into_iter().map(|i| i.into()).collect();
11228 self
11229 }
11230
11231 /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
11232 ///
11233 /// # Example
11234 /// ```ignore,no_run
11235 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11236 /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
11237 /// ```
11238 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11239 self.next_page_token = v.into();
11240 self
11241 }
11242
11243 /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
11244 ///
11245 /// # Example
11246 /// ```ignore,no_run
11247 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11248 /// let x = ListKeyRingsResponse::new().set_total_size(42);
11249 /// ```
11250 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11251 self.total_size = v.into();
11252 self
11253 }
11254}
11255
11256impl wkt::message::Message for ListKeyRingsResponse {
11257 fn typename() -> &'static str {
11258 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
11259 }
11260}
11261
11262#[doc(hidden)]
11263impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
11264 type PageItem = crate::model::KeyRing;
11265
11266 fn items(self) -> std::vec::Vec<Self::PageItem> {
11267 self.key_rings
11268 }
11269
11270 fn next_page_token(&self) -> std::string::String {
11271 use std::clone::Clone;
11272 self.next_page_token.clone()
11273 }
11274}
11275
11276/// Response message for
11277/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11278///
11279/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11280#[derive(Clone, Default, PartialEq)]
11281#[non_exhaustive]
11282pub struct ListCryptoKeysResponse {
11283 /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11284 ///
11285 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11286 pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
11287
11288 /// A token to retrieve next page of results. Pass this value in
11289 /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
11290 /// to retrieve the next page of results.
11291 ///
11292 /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
11293 pub next_page_token: std::string::String,
11294
11295 /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
11296 /// matched the query.
11297 ///
11298 /// This field is not populated if
11299 /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
11300 /// is applied.
11301 ///
11302 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11303 /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
11304 pub total_size: i32,
11305
11306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11307}
11308
11309impl ListCryptoKeysResponse {
11310 pub fn new() -> Self {
11311 std::default::Default::default()
11312 }
11313
11314 /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
11315 ///
11316 /// # Example
11317 /// ```ignore,no_run
11318 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11319 /// use google_cloud_kms_v1::model::CryptoKey;
11320 /// let x = ListCryptoKeysResponse::new()
11321 /// .set_crypto_keys([
11322 /// CryptoKey::default()/* use setters */,
11323 /// CryptoKey::default()/* use (different) setters */,
11324 /// ]);
11325 /// ```
11326 pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
11327 where
11328 T: std::iter::IntoIterator<Item = V>,
11329 V: std::convert::Into<crate::model::CryptoKey>,
11330 {
11331 use std::iter::Iterator;
11332 self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
11333 self
11334 }
11335
11336 /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
11337 ///
11338 /// # Example
11339 /// ```ignore,no_run
11340 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11341 /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
11342 /// ```
11343 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11344 self.next_page_token = v.into();
11345 self
11346 }
11347
11348 /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
11349 ///
11350 /// # Example
11351 /// ```ignore,no_run
11352 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11353 /// let x = ListCryptoKeysResponse::new().set_total_size(42);
11354 /// ```
11355 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11356 self.total_size = v.into();
11357 self
11358 }
11359}
11360
11361impl wkt::message::Message for ListCryptoKeysResponse {
11362 fn typename() -> &'static str {
11363 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
11364 }
11365}
11366
11367#[doc(hidden)]
11368impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
11369 type PageItem = crate::model::CryptoKey;
11370
11371 fn items(self) -> std::vec::Vec<Self::PageItem> {
11372 self.crypto_keys
11373 }
11374
11375 fn next_page_token(&self) -> std::string::String {
11376 use std::clone::Clone;
11377 self.next_page_token.clone()
11378 }
11379}
11380
11381/// Response message for
11382/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11383///
11384/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11385#[derive(Clone, Default, PartialEq)]
11386#[non_exhaustive]
11387pub struct ListCryptoKeyVersionsResponse {
11388 /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11389 ///
11390 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11391 pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
11392
11393 /// A token to retrieve next page of results. Pass this value in
11394 /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
11395 /// to retrieve the next page of results.
11396 ///
11397 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
11398 pub next_page_token: std::string::String,
11399
11400 /// The total number of
11401 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
11402 /// query.
11403 ///
11404 /// This field is not populated if
11405 /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
11406 /// is applied.
11407 ///
11408 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11409 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
11410 pub total_size: i32,
11411
11412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11413}
11414
11415impl ListCryptoKeyVersionsResponse {
11416 pub fn new() -> Self {
11417 std::default::Default::default()
11418 }
11419
11420 /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
11421 ///
11422 /// # Example
11423 /// ```ignore,no_run
11424 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11425 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11426 /// let x = ListCryptoKeyVersionsResponse::new()
11427 /// .set_crypto_key_versions([
11428 /// CryptoKeyVersion::default()/* use setters */,
11429 /// CryptoKeyVersion::default()/* use (different) setters */,
11430 /// ]);
11431 /// ```
11432 pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
11433 where
11434 T: std::iter::IntoIterator<Item = V>,
11435 V: std::convert::Into<crate::model::CryptoKeyVersion>,
11436 {
11437 use std::iter::Iterator;
11438 self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
11439 self
11440 }
11441
11442 /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
11443 ///
11444 /// # Example
11445 /// ```ignore,no_run
11446 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11447 /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
11448 /// ```
11449 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11450 self.next_page_token = v.into();
11451 self
11452 }
11453
11454 /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
11455 ///
11456 /// # Example
11457 /// ```ignore,no_run
11458 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11459 /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
11460 /// ```
11461 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11462 self.total_size = v.into();
11463 self
11464 }
11465}
11466
11467impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11468 fn typename() -> &'static str {
11469 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11470 }
11471}
11472
11473#[doc(hidden)]
11474impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11475 type PageItem = crate::model::CryptoKeyVersion;
11476
11477 fn items(self) -> std::vec::Vec<Self::PageItem> {
11478 self.crypto_key_versions
11479 }
11480
11481 fn next_page_token(&self) -> std::string::String {
11482 use std::clone::Clone;
11483 self.next_page_token.clone()
11484 }
11485}
11486
11487/// Response message for
11488/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11489///
11490/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11491#[derive(Clone, Default, PartialEq)]
11492#[non_exhaustive]
11493pub struct ListImportJobsResponse {
11494 /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11495 ///
11496 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11497 pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
11498
11499 /// A token to retrieve next page of results. Pass this value in
11500 /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
11501 /// to retrieve the next page of results.
11502 ///
11503 /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
11504 pub next_page_token: std::string::String,
11505
11506 /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
11507 /// matched the query.
11508 ///
11509 /// This field is not populated if
11510 /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
11511 /// is applied.
11512 ///
11513 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11514 /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
11515 pub total_size: i32,
11516
11517 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11518}
11519
11520impl ListImportJobsResponse {
11521 pub fn new() -> Self {
11522 std::default::Default::default()
11523 }
11524
11525 /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
11526 ///
11527 /// # Example
11528 /// ```ignore,no_run
11529 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11530 /// use google_cloud_kms_v1::model::ImportJob;
11531 /// let x = ListImportJobsResponse::new()
11532 /// .set_import_jobs([
11533 /// ImportJob::default()/* use setters */,
11534 /// ImportJob::default()/* use (different) setters */,
11535 /// ]);
11536 /// ```
11537 pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
11538 where
11539 T: std::iter::IntoIterator<Item = V>,
11540 V: std::convert::Into<crate::model::ImportJob>,
11541 {
11542 use std::iter::Iterator;
11543 self.import_jobs = v.into_iter().map(|i| i.into()).collect();
11544 self
11545 }
11546
11547 /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
11548 ///
11549 /// # Example
11550 /// ```ignore,no_run
11551 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11552 /// let x = ListImportJobsResponse::new().set_next_page_token("example");
11553 /// ```
11554 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11555 self.next_page_token = v.into();
11556 self
11557 }
11558
11559 /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
11560 ///
11561 /// # Example
11562 /// ```ignore,no_run
11563 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11564 /// let x = ListImportJobsResponse::new().set_total_size(42);
11565 /// ```
11566 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11567 self.total_size = v.into();
11568 self
11569 }
11570}
11571
11572impl wkt::message::Message for ListImportJobsResponse {
11573 fn typename() -> &'static str {
11574 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
11575 }
11576}
11577
11578#[doc(hidden)]
11579impl google_cloud_gax::paginator::internal::PageableResponse for ListImportJobsResponse {
11580 type PageItem = crate::model::ImportJob;
11581
11582 fn items(self) -> std::vec::Vec<Self::PageItem> {
11583 self.import_jobs
11584 }
11585
11586 fn next_page_token(&self) -> std::string::String {
11587 use std::clone::Clone;
11588 self.next_page_token.clone()
11589 }
11590}
11591
11592/// Response message for
11593/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11594///
11595/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11596#[derive(Clone, Default, PartialEq)]
11597#[non_exhaustive]
11598pub struct ListRetiredResourcesResponse {
11599 /// The list of [RetiredResources][google.cloud.kms.v1.RetiredResource].
11600 ///
11601 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11602 pub retired_resources: std::vec::Vec<crate::model::RetiredResource>,
11603
11604 /// A token to retrieve the next page of results. Pass this value in
11605 /// [ListRetiredResourcesRequest.page_token][google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]
11606 /// to retrieve the next page of results.
11607 ///
11608 /// [google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]: crate::model::ListRetiredResourcesRequest::page_token
11609 pub next_page_token: std::string::String,
11610
11611 /// The total number of [RetiredResources][google.cloud.kms.v1.RetiredResource]
11612 /// that matched the query.
11613 ///
11614 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11615 pub total_size: i64,
11616
11617 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11618}
11619
11620impl ListRetiredResourcesResponse {
11621 pub fn new() -> Self {
11622 std::default::Default::default()
11623 }
11624
11625 /// Sets the value of [retired_resources][crate::model::ListRetiredResourcesResponse::retired_resources].
11626 ///
11627 /// # Example
11628 /// ```ignore,no_run
11629 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11630 /// use google_cloud_kms_v1::model::RetiredResource;
11631 /// let x = ListRetiredResourcesResponse::new()
11632 /// .set_retired_resources([
11633 /// RetiredResource::default()/* use setters */,
11634 /// RetiredResource::default()/* use (different) setters */,
11635 /// ]);
11636 /// ```
11637 pub fn set_retired_resources<T, V>(mut self, v: T) -> Self
11638 where
11639 T: std::iter::IntoIterator<Item = V>,
11640 V: std::convert::Into<crate::model::RetiredResource>,
11641 {
11642 use std::iter::Iterator;
11643 self.retired_resources = v.into_iter().map(|i| i.into()).collect();
11644 self
11645 }
11646
11647 /// Sets the value of [next_page_token][crate::model::ListRetiredResourcesResponse::next_page_token].
11648 ///
11649 /// # Example
11650 /// ```ignore,no_run
11651 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11652 /// let x = ListRetiredResourcesResponse::new().set_next_page_token("example");
11653 /// ```
11654 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11655 self.next_page_token = v.into();
11656 self
11657 }
11658
11659 /// Sets the value of [total_size][crate::model::ListRetiredResourcesResponse::total_size].
11660 ///
11661 /// # Example
11662 /// ```ignore,no_run
11663 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11664 /// let x = ListRetiredResourcesResponse::new().set_total_size(42);
11665 /// ```
11666 pub fn set_total_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11667 self.total_size = v.into();
11668 self
11669 }
11670}
11671
11672impl wkt::message::Message for ListRetiredResourcesResponse {
11673 fn typename() -> &'static str {
11674 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesResponse"
11675 }
11676}
11677
11678#[doc(hidden)]
11679impl google_cloud_gax::paginator::internal::PageableResponse for ListRetiredResourcesResponse {
11680 type PageItem = crate::model::RetiredResource;
11681
11682 fn items(self) -> std::vec::Vec<Self::PageItem> {
11683 self.retired_resources
11684 }
11685
11686 fn next_page_token(&self) -> std::string::String {
11687 use std::clone::Clone;
11688 self.next_page_token.clone()
11689 }
11690}
11691
11692/// Request message for
11693/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
11694///
11695/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
11696#[derive(Clone, Default, PartialEq)]
11697#[non_exhaustive]
11698pub struct GetKeyRingRequest {
11699 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
11700 /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
11701 ///
11702 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11703 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11704 pub name: std::string::String,
11705
11706 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11707}
11708
11709impl GetKeyRingRequest {
11710 pub fn new() -> Self {
11711 std::default::Default::default()
11712 }
11713
11714 /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
11715 ///
11716 /// # Example
11717 /// ```ignore,no_run
11718 /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
11719 /// let x = GetKeyRingRequest::new().set_name("example");
11720 /// ```
11721 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11722 self.name = v.into();
11723 self
11724 }
11725}
11726
11727impl wkt::message::Message for GetKeyRingRequest {
11728 fn typename() -> &'static str {
11729 "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
11730 }
11731}
11732
11733/// Request message for
11734/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
11735///
11736/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
11737#[derive(Clone, Default, PartialEq)]
11738#[non_exhaustive]
11739pub struct GetCryptoKeyRequest {
11740 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11741 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
11742 ///
11743 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11744 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11745 pub name: std::string::String,
11746
11747 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11748}
11749
11750impl GetCryptoKeyRequest {
11751 pub fn new() -> Self {
11752 std::default::Default::default()
11753 }
11754
11755 /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
11756 ///
11757 /// # Example
11758 /// ```ignore,no_run
11759 /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
11760 /// let x = GetCryptoKeyRequest::new().set_name("example");
11761 /// ```
11762 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11763 self.name = v.into();
11764 self
11765 }
11766}
11767
11768impl wkt::message::Message for GetCryptoKeyRequest {
11769 fn typename() -> &'static str {
11770 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
11771 }
11772}
11773
11774/// Request message for
11775/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
11776///
11777/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
11778#[derive(Clone, Default, PartialEq)]
11779#[non_exhaustive]
11780pub struct GetCryptoKeyVersionRequest {
11781 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11782 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
11783 ///
11784 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11785 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11786 pub name: std::string::String,
11787
11788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11789}
11790
11791impl GetCryptoKeyVersionRequest {
11792 pub fn new() -> Self {
11793 std::default::Default::default()
11794 }
11795
11796 /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
11797 ///
11798 /// # Example
11799 /// ```ignore,no_run
11800 /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
11801 /// let x = GetCryptoKeyVersionRequest::new().set_name("example");
11802 /// ```
11803 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11804 self.name = v.into();
11805 self
11806 }
11807}
11808
11809impl wkt::message::Message for GetCryptoKeyVersionRequest {
11810 fn typename() -> &'static str {
11811 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
11812 }
11813}
11814
11815/// Request message for
11816/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
11817///
11818/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
11819#[derive(Clone, Default, PartialEq)]
11820#[non_exhaustive]
11821pub struct GetPublicKeyRequest {
11822 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11823 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
11824 ///
11825 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11826 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11827 pub name: std::string::String,
11828
11829 /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
11830 /// by the user. This field is required for PQC algorithms. If specified, the
11831 /// public key will be exported through the
11832 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
11833 /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
11834 /// field will be populated for non-PQC algorithms, and an error will be
11835 /// returned for PQC algorithms.
11836 ///
11837 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
11838 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
11839 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
11840 pub public_key_format: crate::model::public_key::PublicKeyFormat,
11841
11842 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11843}
11844
11845impl GetPublicKeyRequest {
11846 pub fn new() -> Self {
11847 std::default::Default::default()
11848 }
11849
11850 /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
11851 ///
11852 /// # Example
11853 /// ```ignore,no_run
11854 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11855 /// let x = GetPublicKeyRequest::new().set_name("example");
11856 /// ```
11857 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11858 self.name = v.into();
11859 self
11860 }
11861
11862 /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
11863 ///
11864 /// # Example
11865 /// ```ignore,no_run
11866 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
11867 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
11868 /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
11869 /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
11870 /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
11871 /// ```
11872 pub fn set_public_key_format<
11873 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
11874 >(
11875 mut self,
11876 v: T,
11877 ) -> Self {
11878 self.public_key_format = v.into();
11879 self
11880 }
11881}
11882
11883impl wkt::message::Message for GetPublicKeyRequest {
11884 fn typename() -> &'static str {
11885 "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
11886 }
11887}
11888
11889/// Request message for
11890/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
11891///
11892/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
11893#[derive(Clone, Default, PartialEq)]
11894#[non_exhaustive]
11895pub struct GetImportJobRequest {
11896 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
11897 /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
11898 ///
11899 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11900 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
11901 pub name: std::string::String,
11902
11903 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11904}
11905
11906impl GetImportJobRequest {
11907 pub fn new() -> Self {
11908 std::default::Default::default()
11909 }
11910
11911 /// Sets the value of [name][crate::model::GetImportJobRequest::name].
11912 ///
11913 /// # Example
11914 /// ```ignore,no_run
11915 /// # use google_cloud_kms_v1::model::GetImportJobRequest;
11916 /// let x = GetImportJobRequest::new().set_name("example");
11917 /// ```
11918 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11919 self.name = v.into();
11920 self
11921 }
11922}
11923
11924impl wkt::message::Message for GetImportJobRequest {
11925 fn typename() -> &'static str {
11926 "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
11927 }
11928}
11929
11930/// Request message for
11931/// [KeyManagementService.GetRetiredResource][google.cloud.kms.v1.KeyManagementService.GetRetiredResource].
11932///
11933/// [google.cloud.kms.v1.KeyManagementService.GetRetiredResource]: crate::client::KeyManagementService::get_retired_resource
11934#[derive(Clone, Default, PartialEq)]
11935#[non_exhaustive]
11936pub struct GetRetiredResourceRequest {
11937 /// Required. The [name][google.cloud.kms.v1.RetiredResource.name] of the
11938 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] to get.
11939 ///
11940 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11941 /// [google.cloud.kms.v1.RetiredResource.name]: crate::model::RetiredResource::name
11942 pub name: std::string::String,
11943
11944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11945}
11946
11947impl GetRetiredResourceRequest {
11948 pub fn new() -> Self {
11949 std::default::Default::default()
11950 }
11951
11952 /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
11953 ///
11954 /// # Example
11955 /// ```ignore,no_run
11956 /// # use google_cloud_kms_v1::model::GetRetiredResourceRequest;
11957 /// let x = GetRetiredResourceRequest::new().set_name("example");
11958 /// ```
11959 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11960 self.name = v.into();
11961 self
11962 }
11963}
11964
11965impl wkt::message::Message for GetRetiredResourceRequest {
11966 fn typename() -> &'static str {
11967 "type.googleapis.com/google.cloud.kms.v1.GetRetiredResourceRequest"
11968 }
11969}
11970
11971/// Request message for
11972/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
11973///
11974/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
11975#[derive(Clone, Default, PartialEq)]
11976#[non_exhaustive]
11977pub struct CreateKeyRingRequest {
11978 /// Required. The resource name of the location associated with the
11979 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
11980 /// `projects/*/locations/*`.
11981 ///
11982 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11983 pub parent: std::string::String,
11984
11985 /// Required. It must be unique within a location and match the regular
11986 /// expression `[a-zA-Z0-9_-]{1,63}`
11987 pub key_ring_id: std::string::String,
11988
11989 /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
11990 /// values.
11991 ///
11992 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11993 pub key_ring: std::option::Option<crate::model::KeyRing>,
11994
11995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11996}
11997
11998impl CreateKeyRingRequest {
11999 pub fn new() -> Self {
12000 std::default::Default::default()
12001 }
12002
12003 /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
12004 ///
12005 /// # Example
12006 /// ```ignore,no_run
12007 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12008 /// let x = CreateKeyRingRequest::new().set_parent("example");
12009 /// ```
12010 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12011 self.parent = v.into();
12012 self
12013 }
12014
12015 /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
12016 ///
12017 /// # Example
12018 /// ```ignore,no_run
12019 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12020 /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
12021 /// ```
12022 pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12023 self.key_ring_id = v.into();
12024 self
12025 }
12026
12027 /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12028 ///
12029 /// # Example
12030 /// ```ignore,no_run
12031 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12032 /// use google_cloud_kms_v1::model::KeyRing;
12033 /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
12034 /// ```
12035 pub fn set_key_ring<T>(mut self, v: T) -> Self
12036 where
12037 T: std::convert::Into<crate::model::KeyRing>,
12038 {
12039 self.key_ring = std::option::Option::Some(v.into());
12040 self
12041 }
12042
12043 /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12044 ///
12045 /// # Example
12046 /// ```ignore,no_run
12047 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12048 /// use google_cloud_kms_v1::model::KeyRing;
12049 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
12050 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
12051 /// ```
12052 pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
12053 where
12054 T: std::convert::Into<crate::model::KeyRing>,
12055 {
12056 self.key_ring = v.map(|x| x.into());
12057 self
12058 }
12059}
12060
12061impl wkt::message::Message for CreateKeyRingRequest {
12062 fn typename() -> &'static str {
12063 "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
12064 }
12065}
12066
12067/// Request message for
12068/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
12069///
12070/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
12071#[derive(Clone, Default, PartialEq)]
12072#[non_exhaustive]
12073pub struct CreateCryptoKeyRequest {
12074 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
12075 /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
12076 ///
12077 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12078 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12079 pub parent: std::string::String,
12080
12081 /// Required. It must be unique within a KeyRing and match the regular
12082 /// expression `[a-zA-Z0-9_-]{1,63}`
12083 pub crypto_key_id: std::string::String,
12084
12085 /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
12086 /// values.
12087 ///
12088 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12089 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12090
12091 /// If set to true, the request will create a
12092 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
12093 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
12094 /// manually call
12095 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
12096 /// or
12097 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
12098 /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
12099 ///
12100 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12101 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12102 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12103 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12104 pub skip_initial_version_creation: bool,
12105
12106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12107}
12108
12109impl CreateCryptoKeyRequest {
12110 pub fn new() -> Self {
12111 std::default::Default::default()
12112 }
12113
12114 /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
12115 ///
12116 /// # Example
12117 /// ```ignore,no_run
12118 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12119 /// let x = CreateCryptoKeyRequest::new().set_parent("example");
12120 /// ```
12121 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12122 self.parent = v.into();
12123 self
12124 }
12125
12126 /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
12127 ///
12128 /// # Example
12129 /// ```ignore,no_run
12130 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12131 /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
12132 /// ```
12133 pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12134 self.crypto_key_id = v.into();
12135 self
12136 }
12137
12138 /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12139 ///
12140 /// # Example
12141 /// ```ignore,no_run
12142 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12143 /// use google_cloud_kms_v1::model::CryptoKey;
12144 /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12145 /// ```
12146 pub fn set_crypto_key<T>(mut self, v: T) -> Self
12147 where
12148 T: std::convert::Into<crate::model::CryptoKey>,
12149 {
12150 self.crypto_key = std::option::Option::Some(v.into());
12151 self
12152 }
12153
12154 /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12155 ///
12156 /// # Example
12157 /// ```ignore,no_run
12158 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12159 /// use google_cloud_kms_v1::model::CryptoKey;
12160 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12161 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12162 /// ```
12163 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12164 where
12165 T: std::convert::Into<crate::model::CryptoKey>,
12166 {
12167 self.crypto_key = v.map(|x| x.into());
12168 self
12169 }
12170
12171 /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
12172 ///
12173 /// # Example
12174 /// ```ignore,no_run
12175 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12176 /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
12177 /// ```
12178 pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12179 self.skip_initial_version_creation = v.into();
12180 self
12181 }
12182}
12183
12184impl wkt::message::Message for CreateCryptoKeyRequest {
12185 fn typename() -> &'static str {
12186 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
12187 }
12188}
12189
12190/// Request message for
12191/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
12192///
12193/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12194#[derive(Clone, Default, PartialEq)]
12195#[non_exhaustive]
12196pub struct CreateCryptoKeyVersionRequest {
12197 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12198 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
12199 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
12200 ///
12201 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12202 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12203 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12204 pub parent: std::string::String,
12205
12206 /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12207 /// initial field values.
12208 ///
12209 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12210 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12211
12212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12213}
12214
12215impl CreateCryptoKeyVersionRequest {
12216 pub fn new() -> Self {
12217 std::default::Default::default()
12218 }
12219
12220 /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
12221 ///
12222 /// # Example
12223 /// ```ignore,no_run
12224 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12225 /// let x = CreateCryptoKeyVersionRequest::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::CreateCryptoKeyVersionRequest::crypto_key_version].
12233 ///
12234 /// # Example
12235 /// ```ignore,no_run
12236 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12237 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12238 /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12239 /// ```
12240 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12241 where
12242 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12243 {
12244 self.crypto_key_version = std::option::Option::Some(v.into());
12245 self
12246 }
12247
12248 /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12249 ///
12250 /// # Example
12251 /// ```ignore,no_run
12252 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12253 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12254 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12255 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12256 /// ```
12257 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12258 where
12259 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12260 {
12261 self.crypto_key_version = v.map(|x| x.into());
12262 self
12263 }
12264}
12265
12266impl wkt::message::Message for CreateCryptoKeyVersionRequest {
12267 fn typename() -> &'static str {
12268 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
12269 }
12270}
12271
12272/// Request message for
12273/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey].
12274///
12275/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
12276#[derive(Clone, Default, PartialEq)]
12277#[non_exhaustive]
12278pub struct DeleteCryptoKeyRequest {
12279 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12280 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to delete.
12281 ///
12282 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12283 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12284 pub name: std::string::String,
12285
12286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12287}
12288
12289impl DeleteCryptoKeyRequest {
12290 pub fn new() -> Self {
12291 std::default::Default::default()
12292 }
12293
12294 /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
12295 ///
12296 /// # Example
12297 /// ```ignore,no_run
12298 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyRequest;
12299 /// let x = DeleteCryptoKeyRequest::new().set_name("example");
12300 /// ```
12301 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12302 self.name = v.into();
12303 self
12304 }
12305}
12306
12307impl wkt::message::Message for DeleteCryptoKeyRequest {
12308 fn typename() -> &'static str {
12309 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyRequest"
12310 }
12311}
12312
12313/// Request message for
12314/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion].
12315///
12316/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
12317#[derive(Clone, Default, PartialEq)]
12318#[non_exhaustive]
12319pub struct DeleteCryptoKeyVersionRequest {
12320 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12321 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to delete.
12322 ///
12323 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12324 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12325 pub name: std::string::String,
12326
12327 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12328}
12329
12330impl DeleteCryptoKeyVersionRequest {
12331 pub fn new() -> Self {
12332 std::default::Default::default()
12333 }
12334
12335 /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
12336 ///
12337 /// # Example
12338 /// ```ignore,no_run
12339 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyVersionRequest;
12340 /// let x = DeleteCryptoKeyVersionRequest::new().set_name("example");
12341 /// ```
12342 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12343 self.name = v.into();
12344 self
12345 }
12346}
12347
12348impl wkt::message::Message for DeleteCryptoKeyVersionRequest {
12349 fn typename() -> &'static str {
12350 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionRequest"
12351 }
12352}
12353
12354/// Request message for
12355/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
12356///
12357/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12358#[derive(Clone, Default, PartialEq)]
12359#[non_exhaustive]
12360pub struct ImportCryptoKeyVersionRequest {
12361 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12362 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
12363 ///
12364 /// The create permission is only required on this key when creating a new
12365 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
12366 ///
12367 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12368 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12369 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12370 pub parent: std::string::String,
12371
12372 /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
12373 /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
12374 /// target for an import operation. If this field is not present, a new
12375 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
12376 /// supplied key material is created.
12377 ///
12378 /// If this field is present, the supplied key material is imported into
12379 /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
12380 /// import into an existing
12381 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
12382 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
12383 /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
12384 /// have been previously created via
12385 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
12386 /// and be in
12387 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
12388 /// or
12389 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
12390 /// state. The key material and algorithm must match the previous
12391 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
12392 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
12393 /// key material.
12394 ///
12395 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12396 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
12397 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
12398 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12399 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
12400 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12401 pub crypto_key_version: std::string::String,
12402
12403 /// Required. The
12404 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
12405 /// of the key being imported. This does not need to match the
12406 /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
12407 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
12408 ///
12409 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12410 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
12411 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
12412 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
12413
12414 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12415 /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
12416 /// material.
12417 ///
12418 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12419 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12420 pub import_job: std::string::String,
12421
12422 /// Optional. The wrapped key material to import.
12423 ///
12424 /// Before wrapping, key material must be formatted. If importing symmetric key
12425 /// material, the expected key material format is plain bytes. If importing
12426 /// asymmetric key material, the expected key material format is PKCS#8-encoded
12427 /// DER (the PrivateKeyInfo structure from RFC 5208).
12428 ///
12429 /// When wrapping with import methods
12430 /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
12431 /// or
12432 /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
12433 /// or
12434 /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
12435 /// or
12436 /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
12437 ///
12438 /// this field must contain the concatenation of:
12439 ///
12440 /// This format is the same as the format produced by PKCS#11 mechanism
12441 /// CKM_RSA_AES_KEY_WRAP.
12442 ///
12443 /// When wrapping with import methods
12444 /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
12445 /// or
12446 /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
12447 ///
12448 /// this field must contain the formatted key to be imported, wrapped with the
12449 /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
12450 /// with SHA-256, MGF1 with SHA-256, and an empty label.
12451 ///
12452 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
12453 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
12454 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
12455 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
12456 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
12457 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
12458 /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
12459 pub wrapped_key: ::bytes::Bytes,
12460
12461 /// This field is legacy. Use the field
12462 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12463 /// instead.
12464 ///
12465 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12466 pub wrapped_key_material:
12467 std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
12468
12469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12470}
12471
12472impl ImportCryptoKeyVersionRequest {
12473 pub fn new() -> Self {
12474 std::default::Default::default()
12475 }
12476
12477 /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
12478 ///
12479 /// # Example
12480 /// ```ignore,no_run
12481 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12482 /// let x = ImportCryptoKeyVersionRequest::new().set_parent("example");
12483 /// ```
12484 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12485 self.parent = v.into();
12486 self
12487 }
12488
12489 /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
12490 ///
12491 /// # Example
12492 /// ```ignore,no_run
12493 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12494 /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version("example");
12495 /// ```
12496 pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
12497 mut self,
12498 v: T,
12499 ) -> Self {
12500 self.crypto_key_version = v.into();
12501 self
12502 }
12503
12504 /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
12505 ///
12506 /// # Example
12507 /// ```ignore,no_run
12508 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12509 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
12510 /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
12511 /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
12512 /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
12513 /// ```
12514 pub fn set_algorithm<
12515 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
12516 >(
12517 mut self,
12518 v: T,
12519 ) -> Self {
12520 self.algorithm = v.into();
12521 self
12522 }
12523
12524 /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
12525 ///
12526 /// # Example
12527 /// ```ignore,no_run
12528 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12529 /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
12530 /// ```
12531 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12532 self.import_job = v.into();
12533 self
12534 }
12535
12536 /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
12537 ///
12538 /// # Example
12539 /// ```ignore,no_run
12540 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12541 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
12542 /// ```
12543 pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12544 self.wrapped_key = v.into();
12545 self
12546 }
12547
12548 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
12549 ///
12550 /// Note that all the setters affecting `wrapped_key_material` are mutually
12551 /// exclusive.
12552 ///
12553 /// # Example
12554 /// ```ignore,no_run
12555 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12556 /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
12557 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
12558 /// ```
12559 pub fn set_wrapped_key_material<
12560 T: std::convert::Into<
12561 std::option::Option<
12562 crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
12563 >,
12564 >,
12565 >(
12566 mut self,
12567 v: T,
12568 ) -> Self {
12569 self.wrapped_key_material = v.into();
12570 self
12571 }
12572
12573 /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12574 /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
12575 /// holds a different branch.
12576 pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
12577 #[allow(unreachable_patterns)]
12578 self.wrapped_key_material.as_ref().and_then(|v| match v {
12579 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
12580 _ => std::option::Option::None,
12581 })
12582 }
12583
12584 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12585 /// to hold a `RsaAesWrappedKey`.
12586 ///
12587 /// Note that all the setters affecting `wrapped_key_material` are
12588 /// mutually exclusive.
12589 ///
12590 /// # Example
12591 /// ```ignore,no_run
12592 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12593 /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
12594 /// assert!(x.rsa_aes_wrapped_key().is_some());
12595 /// ```
12596 pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12597 self.wrapped_key_material = std::option::Option::Some(
12598 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
12599 v.into(),
12600 ),
12601 );
12602 self
12603 }
12604}
12605
12606impl wkt::message::Message for ImportCryptoKeyVersionRequest {
12607 fn typename() -> &'static str {
12608 "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
12609 }
12610}
12611
12612/// Defines additional types related to [ImportCryptoKeyVersionRequest].
12613pub mod import_crypto_key_version_request {
12614 #[allow(unused_imports)]
12615 use super::*;
12616
12617 /// This field is legacy. Use the field
12618 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12619 /// instead.
12620 ///
12621 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12622 #[derive(Clone, Debug, PartialEq)]
12623 #[non_exhaustive]
12624 pub enum WrappedKeyMaterial {
12625 /// Optional. This field has the same meaning as
12626 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
12627 /// Prefer to use that field in new work. Either that field or this field
12628 /// (but not both) must be specified.
12629 ///
12630 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12631 RsaAesWrappedKey(::bytes::Bytes),
12632 }
12633}
12634
12635/// Request message for
12636/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
12637///
12638/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
12639#[derive(Clone, Default, PartialEq)]
12640#[non_exhaustive]
12641pub struct CreateImportJobRequest {
12642 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
12643 /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
12644 /// [ImportJobs][google.cloud.kms.v1.ImportJob].
12645 ///
12646 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12647 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12648 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12649 pub parent: std::string::String,
12650
12651 /// Required. It must be unique within a KeyRing and match the regular
12652 /// expression `[a-zA-Z0-9_-]{1,63}`
12653 pub import_job_id: std::string::String,
12654
12655 /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
12656 /// values.
12657 ///
12658 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12659 pub import_job: std::option::Option<crate::model::ImportJob>,
12660
12661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12662}
12663
12664impl CreateImportJobRequest {
12665 pub fn new() -> Self {
12666 std::default::Default::default()
12667 }
12668
12669 /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
12670 ///
12671 /// # Example
12672 /// ```ignore,no_run
12673 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12674 /// let x = CreateImportJobRequest::new().set_parent("example");
12675 /// ```
12676 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12677 self.parent = v.into();
12678 self
12679 }
12680
12681 /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
12682 ///
12683 /// # Example
12684 /// ```ignore,no_run
12685 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12686 /// let x = CreateImportJobRequest::new().set_import_job_id("example");
12687 /// ```
12688 pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12689 self.import_job_id = v.into();
12690 self
12691 }
12692
12693 /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12694 ///
12695 /// # Example
12696 /// ```ignore,no_run
12697 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12698 /// use google_cloud_kms_v1::model::ImportJob;
12699 /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
12700 /// ```
12701 pub fn set_import_job<T>(mut self, v: T) -> Self
12702 where
12703 T: std::convert::Into<crate::model::ImportJob>,
12704 {
12705 self.import_job = std::option::Option::Some(v.into());
12706 self
12707 }
12708
12709 /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12710 ///
12711 /// # Example
12712 /// ```ignore,no_run
12713 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12714 /// use google_cloud_kms_v1::model::ImportJob;
12715 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
12716 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
12717 /// ```
12718 pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
12719 where
12720 T: std::convert::Into<crate::model::ImportJob>,
12721 {
12722 self.import_job = v.map(|x| x.into());
12723 self
12724 }
12725}
12726
12727impl wkt::message::Message for CreateImportJobRequest {
12728 fn typename() -> &'static str {
12729 "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
12730 }
12731}
12732
12733/// Request message for
12734/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
12735///
12736/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
12737#[derive(Clone, Default, PartialEq)]
12738#[non_exhaustive]
12739pub struct UpdateCryptoKeyRequest {
12740 /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
12741 ///
12742 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12743 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12744
12745 /// Required. List of fields to be updated in this request.
12746 pub update_mask: std::option::Option<wkt::FieldMask>,
12747
12748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12749}
12750
12751impl UpdateCryptoKeyRequest {
12752 pub fn new() -> Self {
12753 std::default::Default::default()
12754 }
12755
12756 /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12757 ///
12758 /// # Example
12759 /// ```ignore,no_run
12760 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12761 /// use google_cloud_kms_v1::model::CryptoKey;
12762 /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12763 /// ```
12764 pub fn set_crypto_key<T>(mut self, v: T) -> Self
12765 where
12766 T: std::convert::Into<crate::model::CryptoKey>,
12767 {
12768 self.crypto_key = std::option::Option::Some(v.into());
12769 self
12770 }
12771
12772 /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
12773 ///
12774 /// # Example
12775 /// ```ignore,no_run
12776 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12777 /// use google_cloud_kms_v1::model::CryptoKey;
12778 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12779 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12780 /// ```
12781 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12782 where
12783 T: std::convert::Into<crate::model::CryptoKey>,
12784 {
12785 self.crypto_key = v.map(|x| x.into());
12786 self
12787 }
12788
12789 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12790 ///
12791 /// # Example
12792 /// ```ignore,no_run
12793 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12794 /// use wkt::FieldMask;
12795 /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12796 /// ```
12797 pub fn set_update_mask<T>(mut self, v: T) -> Self
12798 where
12799 T: std::convert::Into<wkt::FieldMask>,
12800 {
12801 self.update_mask = std::option::Option::Some(v.into());
12802 self
12803 }
12804
12805 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
12806 ///
12807 /// # Example
12808 /// ```ignore,no_run
12809 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
12810 /// use wkt::FieldMask;
12811 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12812 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12813 /// ```
12814 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12815 where
12816 T: std::convert::Into<wkt::FieldMask>,
12817 {
12818 self.update_mask = v.map(|x| x.into());
12819 self
12820 }
12821}
12822
12823impl wkt::message::Message for UpdateCryptoKeyRequest {
12824 fn typename() -> &'static str {
12825 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
12826 }
12827}
12828
12829/// Request message for
12830/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
12831///
12832/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
12833#[derive(Clone, Default, PartialEq)]
12834#[non_exhaustive]
12835pub struct UpdateCryptoKeyVersionRequest {
12836 /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12837 /// updated values.
12838 ///
12839 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12840 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12841
12842 /// Required. List of fields to be updated in this request.
12843 pub update_mask: std::option::Option<wkt::FieldMask>,
12844
12845 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12846}
12847
12848impl UpdateCryptoKeyVersionRequest {
12849 pub fn new() -> Self {
12850 std::default::Default::default()
12851 }
12852
12853 /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12854 ///
12855 /// # Example
12856 /// ```ignore,no_run
12857 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12858 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12859 /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12860 /// ```
12861 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12862 where
12863 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12864 {
12865 self.crypto_key_version = std::option::Option::Some(v.into());
12866 self
12867 }
12868
12869 /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
12870 ///
12871 /// # Example
12872 /// ```ignore,no_run
12873 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12874 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12875 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12876 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12877 /// ```
12878 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12879 where
12880 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12881 {
12882 self.crypto_key_version = v.map(|x| x.into());
12883 self
12884 }
12885
12886 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12887 ///
12888 /// # Example
12889 /// ```ignore,no_run
12890 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12891 /// use wkt::FieldMask;
12892 /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
12893 /// ```
12894 pub fn set_update_mask<T>(mut self, v: T) -> Self
12895 where
12896 T: std::convert::Into<wkt::FieldMask>,
12897 {
12898 self.update_mask = std::option::Option::Some(v.into());
12899 self
12900 }
12901
12902 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
12903 ///
12904 /// # Example
12905 /// ```ignore,no_run
12906 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
12907 /// use wkt::FieldMask;
12908 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
12909 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
12910 /// ```
12911 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
12912 where
12913 T: std::convert::Into<wkt::FieldMask>,
12914 {
12915 self.update_mask = v.map(|x| x.into());
12916 self
12917 }
12918}
12919
12920impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
12921 fn typename() -> &'static str {
12922 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
12923 }
12924}
12925
12926/// Request message for
12927/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
12928///
12929/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
12930#[derive(Clone, Default, PartialEq)]
12931#[non_exhaustive]
12932pub struct UpdateCryptoKeyPrimaryVersionRequest {
12933 /// Required. The resource name of the
12934 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
12935 ///
12936 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12937 pub name: std::string::String,
12938
12939 /// Required. The id of the child
12940 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
12941 ///
12942 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12943 pub crypto_key_version_id: std::string::String,
12944
12945 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12946}
12947
12948impl UpdateCryptoKeyPrimaryVersionRequest {
12949 pub fn new() -> Self {
12950 std::default::Default::default()
12951 }
12952
12953 /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
12954 ///
12955 /// # Example
12956 /// ```ignore,no_run
12957 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12958 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name("example");
12959 /// ```
12960 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12961 self.name = v.into();
12962 self
12963 }
12964
12965 /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
12966 ///
12967 /// # Example
12968 /// ```ignore,no_run
12969 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
12970 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
12971 /// ```
12972 pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
12973 mut self,
12974 v: T,
12975 ) -> Self {
12976 self.crypto_key_version_id = v.into();
12977 self
12978 }
12979}
12980
12981impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
12982 fn typename() -> &'static str {
12983 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
12984 }
12985}
12986
12987/// Request message for
12988/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
12989///
12990/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
12991#[derive(Clone, Default, PartialEq)]
12992#[non_exhaustive]
12993pub struct DestroyCryptoKeyVersionRequest {
12994 /// Required. The resource name of the
12995 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
12996 ///
12997 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12998 pub name: std::string::String,
12999
13000 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13001}
13002
13003impl DestroyCryptoKeyVersionRequest {
13004 pub fn new() -> Self {
13005 std::default::Default::default()
13006 }
13007
13008 /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
13009 ///
13010 /// # Example
13011 /// ```ignore,no_run
13012 /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
13013 /// let x = DestroyCryptoKeyVersionRequest::new().set_name("example");
13014 /// ```
13015 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13016 self.name = v.into();
13017 self
13018 }
13019}
13020
13021impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
13022 fn typename() -> &'static str {
13023 "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
13024 }
13025}
13026
13027/// Request message for
13028/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
13029///
13030/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
13031#[derive(Clone, Default, PartialEq)]
13032#[non_exhaustive]
13033pub struct RestoreCryptoKeyVersionRequest {
13034 /// Required. The resource name of the
13035 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
13036 ///
13037 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13038 pub name: std::string::String,
13039
13040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13041}
13042
13043impl RestoreCryptoKeyVersionRequest {
13044 pub fn new() -> Self {
13045 std::default::Default::default()
13046 }
13047
13048 /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
13049 ///
13050 /// # Example
13051 /// ```ignore,no_run
13052 /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
13053 /// let x = RestoreCryptoKeyVersionRequest::new().set_name("example");
13054 /// ```
13055 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13056 self.name = v.into();
13057 self
13058 }
13059}
13060
13061impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
13062 fn typename() -> &'static str {
13063 "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
13064 }
13065}
13066
13067/// Request message for
13068/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
13069///
13070/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
13071#[derive(Clone, Default, PartialEq)]
13072#[non_exhaustive]
13073pub struct EncryptRequest {
13074 /// Required. The resource name of the
13075 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
13076 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13077 /// encryption.
13078 ///
13079 /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
13080 /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
13081 ///
13082 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13083 /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
13084 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13085 pub name: std::string::String,
13086
13087 /// Required. The data to encrypt. Must be no larger than 64KiB.
13088 ///
13089 /// The maximum size depends on the key version's
13090 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13091 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13092 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13093 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
13094 /// plaintext must be no larger than 64KiB. For
13095 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13096 /// the plaintext and additional_authenticated_data fields must be no larger
13097 /// than 8KiB.
13098 ///
13099 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13100 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13101 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13102 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13103 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13104 pub plaintext: ::bytes::Bytes,
13105
13106 /// Optional. Optional data that, if specified, must also be provided during
13107 /// decryption through
13108 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13109 ///
13110 /// The maximum size depends on the key version's
13111 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13112 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13113 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13114 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
13115 /// AAD must be no larger than 64KiB. For
13116 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13117 /// the plaintext and additional_authenticated_data fields must be no larger
13118 /// than 8KiB.
13119 ///
13120 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13121 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13122 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13123 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13124 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13125 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13126 pub additional_authenticated_data: ::bytes::Bytes,
13127
13128 /// Optional. An optional CRC32C checksum of the
13129 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
13130 /// If specified,
13131 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13132 /// verify the integrity of the received
13133 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
13134 /// using this checksum.
13135 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13136 /// report an error if the checksum verification fails. If you receive a
13137 /// checksum error, your client should verify that
13138 /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
13139 /// is equal to
13140 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
13141 /// and if so, perform a limited number of retries. A persistent mismatch may
13142 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13143 /// field is defined as int64 for reasons of compatibility across different
13144 /// languages. However, it is a non-negative integer, which will never exceed
13145 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13146 /// this type.
13147 ///
13148 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
13149 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
13150 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13151 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13152
13153 /// Optional. An optional CRC32C checksum of the
13154 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13155 /// If specified,
13156 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13157 /// verify the integrity of the received
13158 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
13159 /// using this checksum.
13160 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13161 /// report an error if the checksum verification fails. If you receive a
13162 /// checksum error, your client should verify that
13163 /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
13164 /// is equal to
13165 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
13166 /// and if so, perform a limited number of retries. A persistent mismatch may
13167 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13168 /// field is defined as int64 for reasons of compatibility across different
13169 /// languages. However, it is a non-negative integer, which will never exceed
13170 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13171 /// this type.
13172 ///
13173 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13174 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
13175 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13176 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13177
13178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13179}
13180
13181impl EncryptRequest {
13182 pub fn new() -> Self {
13183 std::default::Default::default()
13184 }
13185
13186 /// Sets the value of [name][crate::model::EncryptRequest::name].
13187 ///
13188 /// # Example
13189 /// ```ignore,no_run
13190 /// # use google_cloud_kms_v1::model::EncryptRequest;
13191 /// let x = EncryptRequest::new().set_name("example");
13192 /// ```
13193 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13194 self.name = v.into();
13195 self
13196 }
13197
13198 /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
13199 ///
13200 /// # Example
13201 /// ```ignore,no_run
13202 /// # use google_cloud_kms_v1::model::EncryptRequest;
13203 /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13204 /// ```
13205 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13206 self.plaintext = v.into();
13207 self
13208 }
13209
13210 /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
13211 ///
13212 /// # Example
13213 /// ```ignore,no_run
13214 /// # use google_cloud_kms_v1::model::EncryptRequest;
13215 /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13216 /// ```
13217 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13218 mut self,
13219 v: T,
13220 ) -> Self {
13221 self.additional_authenticated_data = v.into();
13222 self
13223 }
13224
13225 /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13226 ///
13227 /// # Example
13228 /// ```ignore,no_run
13229 /// # use google_cloud_kms_v1::model::EncryptRequest;
13230 /// use wkt::Int64Value;
13231 /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13232 /// ```
13233 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13234 where
13235 T: std::convert::Into<wkt::Int64Value>,
13236 {
13237 self.plaintext_crc32c = std::option::Option::Some(v.into());
13238 self
13239 }
13240
13241 /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13242 ///
13243 /// # Example
13244 /// ```ignore,no_run
13245 /// # use google_cloud_kms_v1::model::EncryptRequest;
13246 /// use wkt::Int64Value;
13247 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13248 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13249 /// ```
13250 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13251 where
13252 T: std::convert::Into<wkt::Int64Value>,
13253 {
13254 self.plaintext_crc32c = v.map(|x| x.into());
13255 self
13256 }
13257
13258 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13259 ///
13260 /// # Example
13261 /// ```ignore,no_run
13262 /// # use google_cloud_kms_v1::model::EncryptRequest;
13263 /// use wkt::Int64Value;
13264 /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13265 /// ```
13266 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13267 where
13268 T: std::convert::Into<wkt::Int64Value>,
13269 {
13270 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13271 self
13272 }
13273
13274 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13275 ///
13276 /// # Example
13277 /// ```ignore,no_run
13278 /// # use google_cloud_kms_v1::model::EncryptRequest;
13279 /// use wkt::Int64Value;
13280 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13281 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13282 /// ```
13283 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13284 mut self,
13285 v: std::option::Option<T>,
13286 ) -> Self
13287 where
13288 T: std::convert::Into<wkt::Int64Value>,
13289 {
13290 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13291 self
13292 }
13293}
13294
13295impl wkt::message::Message for EncryptRequest {
13296 fn typename() -> &'static str {
13297 "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
13298 }
13299}
13300
13301/// Request message for
13302/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
13303///
13304/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
13305#[derive(Clone, Default, PartialEq)]
13306#[non_exhaustive]
13307pub struct DecryptRequest {
13308 /// Required. The resource name of the
13309 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
13310 /// server will choose the appropriate version.
13311 ///
13312 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13313 pub name: std::string::String,
13314
13315 /// Required. The encrypted data originally returned in
13316 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
13317 ///
13318 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
13319 pub ciphertext: ::bytes::Bytes,
13320
13321 /// Optional. Optional data that must match the data originally supplied in
13322 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13323 ///
13324 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13325 pub additional_authenticated_data: ::bytes::Bytes,
13326
13327 /// Optional. An optional CRC32C checksum of the
13328 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
13329 /// If specified,
13330 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13331 /// verify the integrity of the received
13332 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
13333 /// using this checksum.
13334 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13335 /// report an error if the checksum verification fails. If you receive a
13336 /// checksum error, your client should verify that
13337 /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
13338 /// is equal to
13339 /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
13340 /// and if so, perform a limited number of retries. A persistent mismatch may
13341 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13342 /// field is defined as int64 for reasons of compatibility across different
13343 /// languages. However, it is a non-negative integer, which will never exceed
13344 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13345 /// this type.
13346 ///
13347 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
13348 /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
13349 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13350 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13351
13352 /// Optional. An optional CRC32C checksum of the
13353 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13354 /// If specified,
13355 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13356 /// verify the integrity of the received
13357 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
13358 /// using this checksum.
13359 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13360 /// report an error if the checksum verification fails. If you receive a
13361 /// checksum error, your client should verify that
13362 /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
13363 /// is equal to
13364 /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
13365 /// and if so, perform a limited number of retries. A persistent mismatch may
13366 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13367 /// field is defined as int64 for reasons of compatibility across different
13368 /// languages. However, it is a non-negative integer, which will never exceed
13369 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13370 /// this type.
13371 ///
13372 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13373 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
13374 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13375 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13376
13377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13378}
13379
13380impl DecryptRequest {
13381 pub fn new() -> Self {
13382 std::default::Default::default()
13383 }
13384
13385 /// Sets the value of [name][crate::model::DecryptRequest::name].
13386 ///
13387 /// # Example
13388 /// ```ignore,no_run
13389 /// # use google_cloud_kms_v1::model::DecryptRequest;
13390 /// let x = DecryptRequest::new().set_name("example");
13391 /// ```
13392 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13393 self.name = v.into();
13394 self
13395 }
13396
13397 /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
13398 ///
13399 /// # Example
13400 /// ```ignore,no_run
13401 /// # use google_cloud_kms_v1::model::DecryptRequest;
13402 /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13403 /// ```
13404 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13405 self.ciphertext = v.into();
13406 self
13407 }
13408
13409 /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
13410 ///
13411 /// # Example
13412 /// ```ignore,no_run
13413 /// # use google_cloud_kms_v1::model::DecryptRequest;
13414 /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13415 /// ```
13416 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13417 mut self,
13418 v: T,
13419 ) -> Self {
13420 self.additional_authenticated_data = v.into();
13421 self
13422 }
13423
13424 /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13425 ///
13426 /// # Example
13427 /// ```ignore,no_run
13428 /// # use google_cloud_kms_v1::model::DecryptRequest;
13429 /// use wkt::Int64Value;
13430 /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13431 /// ```
13432 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13433 where
13434 T: std::convert::Into<wkt::Int64Value>,
13435 {
13436 self.ciphertext_crc32c = std::option::Option::Some(v.into());
13437 self
13438 }
13439
13440 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13441 ///
13442 /// # Example
13443 /// ```ignore,no_run
13444 /// # use google_cloud_kms_v1::model::DecryptRequest;
13445 /// use wkt::Int64Value;
13446 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13447 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13448 /// ```
13449 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13450 where
13451 T: std::convert::Into<wkt::Int64Value>,
13452 {
13453 self.ciphertext_crc32c = v.map(|x| x.into());
13454 self
13455 }
13456
13457 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13458 ///
13459 /// # Example
13460 /// ```ignore,no_run
13461 /// # use google_cloud_kms_v1::model::DecryptRequest;
13462 /// use wkt::Int64Value;
13463 /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13464 /// ```
13465 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13466 where
13467 T: std::convert::Into<wkt::Int64Value>,
13468 {
13469 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13470 self
13471 }
13472
13473 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13474 ///
13475 /// # Example
13476 /// ```ignore,no_run
13477 /// # use google_cloud_kms_v1::model::DecryptRequest;
13478 /// use wkt::Int64Value;
13479 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13480 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13481 /// ```
13482 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13483 mut self,
13484 v: std::option::Option<T>,
13485 ) -> Self
13486 where
13487 T: std::convert::Into<wkt::Int64Value>,
13488 {
13489 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13490 self
13491 }
13492}
13493
13494impl wkt::message::Message for DecryptRequest {
13495 fn typename() -> &'static str {
13496 "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
13497 }
13498}
13499
13500/// Request message for
13501/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
13502///
13503/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
13504#[derive(Clone, Default, PartialEq)]
13505#[non_exhaustive]
13506pub struct RawEncryptRequest {
13507 /// Required. The resource name of the
13508 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13509 /// encryption.
13510 ///
13511 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13512 pub name: std::string::String,
13513
13514 /// Required. The data to encrypt. Must be no larger than 64KiB.
13515 ///
13516 /// The maximum size depends on the key version's
13517 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13518 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13519 /// plaintext must be no larger than 64KiB. For
13520 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13521 /// the plaintext and additional_authenticated_data fields must be no larger
13522 /// than 8KiB.
13523 ///
13524 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13525 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13526 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13527 pub plaintext: ::bytes::Bytes,
13528
13529 /// Optional. Optional data that, if specified, must also be provided during
13530 /// decryption through
13531 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13532 ///
13533 /// This field may only be used in conjunction with an
13534 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
13535 /// additional authenticated data (for example, AES-GCM).
13536 ///
13537 /// The maximum size depends on the key version's
13538 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13539 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13540 /// plaintext must be no larger than 64KiB. For
13541 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13542 /// the plaintext and additional_authenticated_data fields must be no larger
13543 /// than 8KiB.
13544 ///
13545 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13546 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13547 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13548 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13549 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13550 pub additional_authenticated_data: ::bytes::Bytes,
13551
13552 /// Optional. An optional CRC32C checksum of the
13553 /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
13554 /// If specified,
13555 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13556 /// verify the integrity of the received plaintext using this checksum.
13557 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13558 /// report an error if the checksum verification fails. If you receive a
13559 /// checksum error, your client should verify that CRC32C(plaintext) is equal
13560 /// to plaintext_crc32c, and if so, perform a limited number of retries. A
13561 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13562 /// checksum. Note: This field is defined as int64 for reasons of compatibility
13563 /// across different languages. However, it is a non-negative integer, which
13564 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13565 /// languages that support this type.
13566 ///
13567 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13568 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
13569 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13570
13571 /// Optional. An optional CRC32C checksum of the
13572 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13573 /// If specified,
13574 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13575 /// verify the integrity of the received additional_authenticated_data using
13576 /// this checksum.
13577 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13578 /// report an error if the checksum verification fails. If you receive a
13579 /// checksum error, your client should verify that
13580 /// CRC32C(additional_authenticated_data) is equal to
13581 /// additional_authenticated_data_crc32c, and if so, perform
13582 /// a limited number of retries. A persistent mismatch may indicate an issue in
13583 /// your computation of the CRC32C checksum.
13584 /// Note: This field is defined as int64 for reasons of compatibility across
13585 /// different languages. However, it is a non-negative integer, which will
13586 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13587 /// that support this type.
13588 ///
13589 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13590 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13591 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13592
13593 /// Optional. A customer-supplied initialization vector that will be used for
13594 /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
13595 /// generated. It will be returned in
13596 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13597 ///
13598 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13599 pub initialization_vector: ::bytes::Bytes,
13600
13601 /// Optional. An optional CRC32C checksum of the
13602 /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
13603 /// If specified,
13604 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13605 /// verify the integrity of the received initialization_vector using this
13606 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13607 /// will report an error if the checksum verification fails. If you receive a
13608 /// checksum error, your client should verify that
13609 /// CRC32C(initialization_vector) is equal to
13610 /// initialization_vector_crc32c, and if so, perform
13611 /// a limited number of retries. A persistent mismatch may indicate an issue in
13612 /// your computation of the CRC32C checksum.
13613 /// Note: This field is defined as int64 for reasons of compatibility across
13614 /// different languages. However, it is a non-negative integer, which will
13615 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13616 /// that support this type.
13617 ///
13618 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13619 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
13620 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13621
13622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13623}
13624
13625impl RawEncryptRequest {
13626 pub fn new() -> Self {
13627 std::default::Default::default()
13628 }
13629
13630 /// Sets the value of [name][crate::model::RawEncryptRequest::name].
13631 ///
13632 /// # Example
13633 /// ```ignore,no_run
13634 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13635 /// let x = RawEncryptRequest::new().set_name("example");
13636 /// ```
13637 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13638 self.name = v.into();
13639 self
13640 }
13641
13642 /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
13643 ///
13644 /// # Example
13645 /// ```ignore,no_run
13646 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13647 /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13648 /// ```
13649 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13650 self.plaintext = v.into();
13651 self
13652 }
13653
13654 /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
13655 ///
13656 /// # Example
13657 /// ```ignore,no_run
13658 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13659 /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13660 /// ```
13661 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13662 mut self,
13663 v: T,
13664 ) -> Self {
13665 self.additional_authenticated_data = v.into();
13666 self
13667 }
13668
13669 /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13670 ///
13671 /// # Example
13672 /// ```ignore,no_run
13673 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13674 /// use wkt::Int64Value;
13675 /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13676 /// ```
13677 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13678 where
13679 T: std::convert::Into<wkt::Int64Value>,
13680 {
13681 self.plaintext_crc32c = std::option::Option::Some(v.into());
13682 self
13683 }
13684
13685 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13686 ///
13687 /// # Example
13688 /// ```ignore,no_run
13689 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13690 /// use wkt::Int64Value;
13691 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13692 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13693 /// ```
13694 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13695 where
13696 T: std::convert::Into<wkt::Int64Value>,
13697 {
13698 self.plaintext_crc32c = v.map(|x| x.into());
13699 self
13700 }
13701
13702 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13703 ///
13704 /// # Example
13705 /// ```ignore,no_run
13706 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13707 /// use wkt::Int64Value;
13708 /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13709 /// ```
13710 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13711 where
13712 T: std::convert::Into<wkt::Int64Value>,
13713 {
13714 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13715 self
13716 }
13717
13718 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13719 ///
13720 /// # Example
13721 /// ```ignore,no_run
13722 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13723 /// use wkt::Int64Value;
13724 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13725 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13726 /// ```
13727 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13728 mut self,
13729 v: std::option::Option<T>,
13730 ) -> Self
13731 where
13732 T: std::convert::Into<wkt::Int64Value>,
13733 {
13734 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13735 self
13736 }
13737
13738 /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
13739 ///
13740 /// # Example
13741 /// ```ignore,no_run
13742 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13743 /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13744 /// ```
13745 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13746 mut self,
13747 v: T,
13748 ) -> Self {
13749 self.initialization_vector = v.into();
13750 self
13751 }
13752
13753 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13754 ///
13755 /// # Example
13756 /// ```ignore,no_run
13757 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13758 /// use wkt::Int64Value;
13759 /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
13760 /// ```
13761 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
13762 where
13763 T: std::convert::Into<wkt::Int64Value>,
13764 {
13765 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
13766 self
13767 }
13768
13769 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
13770 ///
13771 /// # Example
13772 /// ```ignore,no_run
13773 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13774 /// use wkt::Int64Value;
13775 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
13776 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
13777 /// ```
13778 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13779 where
13780 T: std::convert::Into<wkt::Int64Value>,
13781 {
13782 self.initialization_vector_crc32c = v.map(|x| x.into());
13783 self
13784 }
13785}
13786
13787impl wkt::message::Message for RawEncryptRequest {
13788 fn typename() -> &'static str {
13789 "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
13790 }
13791}
13792
13793/// Request message for
13794/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
13795///
13796/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
13797#[derive(Clone, Default, PartialEq)]
13798#[non_exhaustive]
13799pub struct RawDecryptRequest {
13800 /// Required. The resource name of the
13801 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13802 /// decryption.
13803 ///
13804 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13805 pub name: std::string::String,
13806
13807 /// Required. The encrypted data originally returned in
13808 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
13809 ///
13810 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
13811 pub ciphertext: ::bytes::Bytes,
13812
13813 /// Optional. Optional data that must match the data originally supplied in
13814 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13815 ///
13816 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13817 pub additional_authenticated_data: ::bytes::Bytes,
13818
13819 /// Required. The initialization vector (IV) used during encryption, which must
13820 /// match the data originally provided in
13821 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13822 ///
13823 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13824 pub initialization_vector: ::bytes::Bytes,
13825
13826 /// The length of the authentication tag that is appended to the end of
13827 /// the ciphertext. If unspecified (0), the default value for the key's
13828 /// algorithm will be used (for AES-GCM, the default value is 16).
13829 pub tag_length: i32,
13830
13831 /// Optional. An optional CRC32C checksum of the
13832 /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
13833 /// If specified,
13834 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13835 /// verify the integrity of the received ciphertext using this checksum.
13836 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13837 /// report an error if the checksum verification fails. If you receive a
13838 /// checksum error, your client should verify that CRC32C(ciphertext) is equal
13839 /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
13840 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13841 /// checksum. Note: This field is defined as int64 for reasons of compatibility
13842 /// across different languages. However, it is a non-negative integer, which
13843 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13844 /// languages that support this type.
13845 ///
13846 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13847 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
13848 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13849
13850 /// Optional. An optional CRC32C checksum of the
13851 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13852 /// If specified,
13853 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13854 /// verify the integrity of the received additional_authenticated_data using
13855 /// this checksum.
13856 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13857 /// report an error if the checksum verification fails. If you receive a
13858 /// checksum error, your client should verify that
13859 /// CRC32C(additional_authenticated_data) is equal to
13860 /// additional_authenticated_data_crc32c, and if so, perform
13861 /// a limited number of retries. A persistent mismatch may indicate an issue in
13862 /// your computation of the CRC32C checksum.
13863 /// Note: This field is defined as int64 for reasons of compatibility across
13864 /// different languages. However, it is a non-negative integer, which will
13865 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13866 /// that support this type.
13867 ///
13868 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13869 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13870 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13871
13872 /// Optional. An optional CRC32C checksum of the
13873 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
13874 /// If specified,
13875 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13876 /// verify the integrity of the received initialization_vector using this
13877 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13878 /// will report an error if the checksum verification fails. If you receive a
13879 /// checksum error, your client should verify that
13880 /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
13881 /// if so, perform a limited number of retries. A persistent mismatch may
13882 /// indicate an issue in your computation of the CRC32C checksum.
13883 /// Note: This field is defined as int64 for reasons of compatibility across
13884 /// different languages. However, it is a non-negative integer, which will
13885 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13886 /// that support this type.
13887 ///
13888 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13889 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
13890 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13891
13892 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13893}
13894
13895impl RawDecryptRequest {
13896 pub fn new() -> Self {
13897 std::default::Default::default()
13898 }
13899
13900 /// Sets the value of [name][crate::model::RawDecryptRequest::name].
13901 ///
13902 /// # Example
13903 /// ```ignore,no_run
13904 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13905 /// let x = RawDecryptRequest::new().set_name("example");
13906 /// ```
13907 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13908 self.name = v.into();
13909 self
13910 }
13911
13912 /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
13913 ///
13914 /// # Example
13915 /// ```ignore,no_run
13916 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13917 /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13918 /// ```
13919 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13920 self.ciphertext = v.into();
13921 self
13922 }
13923
13924 /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
13925 ///
13926 /// # Example
13927 /// ```ignore,no_run
13928 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13929 /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13930 /// ```
13931 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13932 mut self,
13933 v: T,
13934 ) -> Self {
13935 self.additional_authenticated_data = v.into();
13936 self
13937 }
13938
13939 /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
13940 ///
13941 /// # Example
13942 /// ```ignore,no_run
13943 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13944 /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
13945 /// ```
13946 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
13947 mut self,
13948 v: T,
13949 ) -> Self {
13950 self.initialization_vector = v.into();
13951 self
13952 }
13953
13954 /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
13955 ///
13956 /// # Example
13957 /// ```ignore,no_run
13958 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13959 /// let x = RawDecryptRequest::new().set_tag_length(42);
13960 /// ```
13961 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13962 self.tag_length = v.into();
13963 self
13964 }
13965
13966 /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13967 ///
13968 /// # Example
13969 /// ```ignore,no_run
13970 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13971 /// use wkt::Int64Value;
13972 /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13973 /// ```
13974 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13975 where
13976 T: std::convert::Into<wkt::Int64Value>,
13977 {
13978 self.ciphertext_crc32c = std::option::Option::Some(v.into());
13979 self
13980 }
13981
13982 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
13983 ///
13984 /// # Example
13985 /// ```ignore,no_run
13986 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
13987 /// use wkt::Int64Value;
13988 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13989 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13990 /// ```
13991 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13992 where
13993 T: std::convert::Into<wkt::Int64Value>,
13994 {
13995 self.ciphertext_crc32c = v.map(|x| x.into());
13996 self
13997 }
13998
13999 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14000 ///
14001 /// # Example
14002 /// ```ignore,no_run
14003 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14004 /// use wkt::Int64Value;
14005 /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14006 /// ```
14007 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14008 where
14009 T: std::convert::Into<wkt::Int64Value>,
14010 {
14011 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14012 self
14013 }
14014
14015 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14016 ///
14017 /// # Example
14018 /// ```ignore,no_run
14019 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14020 /// use wkt::Int64Value;
14021 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14022 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14023 /// ```
14024 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14025 mut self,
14026 v: std::option::Option<T>,
14027 ) -> Self
14028 where
14029 T: std::convert::Into<wkt::Int64Value>,
14030 {
14031 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14032 self
14033 }
14034
14035 /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14036 ///
14037 /// # Example
14038 /// ```ignore,no_run
14039 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14040 /// use wkt::Int64Value;
14041 /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14042 /// ```
14043 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14044 where
14045 T: std::convert::Into<wkt::Int64Value>,
14046 {
14047 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14048 self
14049 }
14050
14051 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14052 ///
14053 /// # Example
14054 /// ```ignore,no_run
14055 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14056 /// use wkt::Int64Value;
14057 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14058 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14059 /// ```
14060 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14061 where
14062 T: std::convert::Into<wkt::Int64Value>,
14063 {
14064 self.initialization_vector_crc32c = v.map(|x| x.into());
14065 self
14066 }
14067}
14068
14069impl wkt::message::Message for RawDecryptRequest {
14070 fn typename() -> &'static str {
14071 "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
14072 }
14073}
14074
14075/// Request message for
14076/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
14077///
14078/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
14079#[derive(Clone, Default, PartialEq)]
14080#[non_exhaustive]
14081pub struct AsymmetricSignRequest {
14082 /// Required. The resource name of the
14083 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14084 /// signing.
14085 ///
14086 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14087 pub name: std::string::String,
14088
14089 /// Optional. The digest of the data to sign. The digest must be produced with
14090 /// the same digest algorithm as specified by the key version's
14091 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
14092 ///
14093 /// This field may not be supplied if
14094 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14095 /// is supplied.
14096 ///
14097 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14098 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
14099 pub digest: std::option::Option<crate::model::Digest>,
14100
14101 /// Optional. An optional CRC32C checksum of the
14102 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
14103 /// If specified,
14104 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14105 /// verify the integrity of the received
14106 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14107 /// using this checksum.
14108 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14109 /// report an error if the checksum verification fails. If you receive a
14110 /// checksum error, your client should verify that
14111 /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
14112 /// is equal to
14113 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
14114 /// and if so, perform a limited number of retries. A persistent mismatch may
14115 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14116 /// field is defined as int64 for reasons of compatibility across different
14117 /// languages. However, it is a non-negative integer, which will never exceed
14118 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14119 /// this type.
14120 ///
14121 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14122 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
14123 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14124 pub digest_crc32c: std::option::Option<wkt::Int64Value>,
14125
14126 /// Optional. The data to sign.
14127 /// It can't be supplied if
14128 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14129 /// is supplied.
14130 ///
14131 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14132 pub data: ::bytes::Bytes,
14133
14134 /// Optional. An optional CRC32C checksum of the
14135 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
14136 /// If specified,
14137 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14138 /// verify the integrity of the received
14139 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14140 /// using this checksum.
14141 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14142 /// report an error if the checksum verification fails. If you receive a
14143 /// checksum error, your client should verify that
14144 /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
14145 /// is equal to
14146 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
14147 /// and if so, perform a limited number of retries. A persistent mismatch may
14148 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14149 /// field is defined as int64 for reasons of compatibility across different
14150 /// languages. However, it is a non-negative integer, which will never exceed
14151 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14152 /// this type.
14153 ///
14154 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14155 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
14156 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14157 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14158
14159 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14160}
14161
14162impl AsymmetricSignRequest {
14163 pub fn new() -> Self {
14164 std::default::Default::default()
14165 }
14166
14167 /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
14168 ///
14169 /// # Example
14170 /// ```ignore,no_run
14171 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14172 /// let x = AsymmetricSignRequest::new().set_name("example");
14173 /// ```
14174 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14175 self.name = v.into();
14176 self
14177 }
14178
14179 /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
14180 ///
14181 /// # Example
14182 /// ```ignore,no_run
14183 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14184 /// use google_cloud_kms_v1::model::Digest;
14185 /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
14186 /// ```
14187 pub fn set_digest<T>(mut self, v: T) -> Self
14188 where
14189 T: std::convert::Into<crate::model::Digest>,
14190 {
14191 self.digest = std::option::Option::Some(v.into());
14192 self
14193 }
14194
14195 /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
14196 ///
14197 /// # Example
14198 /// ```ignore,no_run
14199 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14200 /// use google_cloud_kms_v1::model::Digest;
14201 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
14202 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
14203 /// ```
14204 pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
14205 where
14206 T: std::convert::Into<crate::model::Digest>,
14207 {
14208 self.digest = v.map(|x| x.into());
14209 self
14210 }
14211
14212 /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14213 ///
14214 /// # Example
14215 /// ```ignore,no_run
14216 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14217 /// use wkt::Int64Value;
14218 /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
14219 /// ```
14220 pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
14221 where
14222 T: std::convert::Into<wkt::Int64Value>,
14223 {
14224 self.digest_crc32c = std::option::Option::Some(v.into());
14225 self
14226 }
14227
14228 /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14229 ///
14230 /// # Example
14231 /// ```ignore,no_run
14232 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14233 /// use wkt::Int64Value;
14234 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
14235 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
14236 /// ```
14237 pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14238 where
14239 T: std::convert::Into<wkt::Int64Value>,
14240 {
14241 self.digest_crc32c = v.map(|x| x.into());
14242 self
14243 }
14244
14245 /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
14246 ///
14247 /// # Example
14248 /// ```ignore,no_run
14249 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14250 /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14251 /// ```
14252 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14253 self.data = v.into();
14254 self
14255 }
14256
14257 /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14258 ///
14259 /// # Example
14260 /// ```ignore,no_run
14261 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14262 /// use wkt::Int64Value;
14263 /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14264 /// ```
14265 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14266 where
14267 T: std::convert::Into<wkt::Int64Value>,
14268 {
14269 self.data_crc32c = std::option::Option::Some(v.into());
14270 self
14271 }
14272
14273 /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14274 ///
14275 /// # Example
14276 /// ```ignore,no_run
14277 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14278 /// use wkt::Int64Value;
14279 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14280 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14281 /// ```
14282 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14283 where
14284 T: std::convert::Into<wkt::Int64Value>,
14285 {
14286 self.data_crc32c = v.map(|x| x.into());
14287 self
14288 }
14289}
14290
14291impl wkt::message::Message for AsymmetricSignRequest {
14292 fn typename() -> &'static str {
14293 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
14294 }
14295}
14296
14297/// Request message for
14298/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
14299///
14300/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
14301#[derive(Clone, Default, PartialEq)]
14302#[non_exhaustive]
14303pub struct AsymmetricDecryptRequest {
14304 /// Required. The resource name of the
14305 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14306 /// decryption.
14307 ///
14308 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14309 pub name: std::string::String,
14310
14311 /// Required. The data encrypted with the named
14312 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
14313 /// OAEP.
14314 ///
14315 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14316 pub ciphertext: ::bytes::Bytes,
14317
14318 /// Optional. An optional CRC32C checksum of the
14319 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
14320 /// If specified,
14321 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14322 /// verify the integrity of the received
14323 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
14324 /// using this checksum.
14325 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14326 /// report an error if the checksum verification fails. If you receive a
14327 /// checksum error, your client should verify that
14328 /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
14329 /// is equal to
14330 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
14331 /// and if so, perform a limited number of retries. A persistent mismatch may
14332 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14333 /// field is defined as int64 for reasons of compatibility across different
14334 /// languages. However, it is a non-negative integer, which will never exceed
14335 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14336 /// this type.
14337 ///
14338 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
14339 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
14340 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14341 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14342
14343 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14344}
14345
14346impl AsymmetricDecryptRequest {
14347 pub fn new() -> Self {
14348 std::default::Default::default()
14349 }
14350
14351 /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
14352 ///
14353 /// # Example
14354 /// ```ignore,no_run
14355 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14356 /// let x = AsymmetricDecryptRequest::new().set_name("example");
14357 /// ```
14358 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14359 self.name = v.into();
14360 self
14361 }
14362
14363 /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
14364 ///
14365 /// # Example
14366 /// ```ignore,no_run
14367 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14368 /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14369 /// ```
14370 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14371 self.ciphertext = v.into();
14372 self
14373 }
14374
14375 /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14376 ///
14377 /// # Example
14378 /// ```ignore,no_run
14379 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14380 /// use wkt::Int64Value;
14381 /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14382 /// ```
14383 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14384 where
14385 T: std::convert::Into<wkt::Int64Value>,
14386 {
14387 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14388 self
14389 }
14390
14391 /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14392 ///
14393 /// # Example
14394 /// ```ignore,no_run
14395 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14396 /// use wkt::Int64Value;
14397 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14398 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14399 /// ```
14400 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14401 where
14402 T: std::convert::Into<wkt::Int64Value>,
14403 {
14404 self.ciphertext_crc32c = v.map(|x| x.into());
14405 self
14406 }
14407}
14408
14409impl wkt::message::Message for AsymmetricDecryptRequest {
14410 fn typename() -> &'static str {
14411 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
14412 }
14413}
14414
14415/// Request message for
14416/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
14417///
14418/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
14419#[derive(Clone, Default, PartialEq)]
14420#[non_exhaustive]
14421pub struct MacSignRequest {
14422 /// Required. The resource name of the
14423 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14424 /// signing.
14425 ///
14426 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14427 pub name: std::string::String,
14428
14429 /// Required. The data to sign. The MAC tag is computed over this data field
14430 /// based on the specific algorithm.
14431 pub data: ::bytes::Bytes,
14432
14433 /// Optional. An optional CRC32C checksum of the
14434 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
14435 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14436 /// will verify the integrity of the received
14437 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
14438 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14439 /// will report an error if the checksum verification fails. If you receive a
14440 /// checksum error, your client should verify that
14441 /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
14442 /// equal to
14443 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
14444 /// and if so, perform a limited number of retries. A persistent mismatch may
14445 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14446 /// field is defined as int64 for reasons of compatibility across different
14447 /// languages. However, it is a non-negative integer, which will never exceed
14448 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14449 /// this type.
14450 ///
14451 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14452 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14453 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
14454 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14455
14456 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14457}
14458
14459impl MacSignRequest {
14460 pub fn new() -> Self {
14461 std::default::Default::default()
14462 }
14463
14464 /// Sets the value of [name][crate::model::MacSignRequest::name].
14465 ///
14466 /// # Example
14467 /// ```ignore,no_run
14468 /// # use google_cloud_kms_v1::model::MacSignRequest;
14469 /// let x = MacSignRequest::new().set_name("example");
14470 /// ```
14471 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14472 self.name = v.into();
14473 self
14474 }
14475
14476 /// Sets the value of [data][crate::model::MacSignRequest::data].
14477 ///
14478 /// # Example
14479 /// ```ignore,no_run
14480 /// # use google_cloud_kms_v1::model::MacSignRequest;
14481 /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14482 /// ```
14483 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14484 self.data = v.into();
14485 self
14486 }
14487
14488 /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14489 ///
14490 /// # Example
14491 /// ```ignore,no_run
14492 /// # use google_cloud_kms_v1::model::MacSignRequest;
14493 /// use wkt::Int64Value;
14494 /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14495 /// ```
14496 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14497 where
14498 T: std::convert::Into<wkt::Int64Value>,
14499 {
14500 self.data_crc32c = std::option::Option::Some(v.into());
14501 self
14502 }
14503
14504 /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14505 ///
14506 /// # Example
14507 /// ```ignore,no_run
14508 /// # use google_cloud_kms_v1::model::MacSignRequest;
14509 /// use wkt::Int64Value;
14510 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14511 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14512 /// ```
14513 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14514 where
14515 T: std::convert::Into<wkt::Int64Value>,
14516 {
14517 self.data_crc32c = v.map(|x| x.into());
14518 self
14519 }
14520}
14521
14522impl wkt::message::Message for MacSignRequest {
14523 fn typename() -> &'static str {
14524 "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
14525 }
14526}
14527
14528/// Request message for
14529/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
14530///
14531/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
14532#[derive(Clone, Default, PartialEq)]
14533#[non_exhaustive]
14534pub struct MacVerifyRequest {
14535 /// Required. The resource name of the
14536 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14537 /// verification.
14538 ///
14539 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14540 pub name: std::string::String,
14541
14542 /// Required. The data used previously as a
14543 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
14544 /// the MAC tag.
14545 ///
14546 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14547 pub data: ::bytes::Bytes,
14548
14549 /// Optional. An optional CRC32C checksum of the
14550 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
14551 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14552 /// will verify the integrity of the received
14553 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
14554 /// this checksum.
14555 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14556 /// report an error if the checksum verification fails. If you receive a
14557 /// checksum error, your client should verify that
14558 /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
14559 /// is equal to
14560 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
14561 /// and if so, perform a limited number of retries. A persistent mismatch may
14562 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14563 /// field is defined as int64 for reasons of compatibility across different
14564 /// languages. However, it is a non-negative integer, which will never exceed
14565 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14566 /// this type.
14567 ///
14568 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14569 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
14570 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
14571 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14572
14573 /// Required. The signature to verify.
14574 pub mac: ::bytes::Bytes,
14575
14576 /// Optional. An optional CRC32C checksum of the
14577 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
14578 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14579 /// will verify the integrity of the received
14580 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
14581 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14582 /// will report an error if the checksum verification fails. If you receive a
14583 /// checksum error, your client should verify that
14584 /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
14585 /// equal to
14586 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
14587 /// and if so, perform a limited number of retries. A persistent mismatch may
14588 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14589 /// field is defined as int64 for reasons of compatibility across different
14590 /// languages. However, it is a non-negative integer, which will never exceed
14591 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14592 /// this type.
14593 ///
14594 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14595 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
14596 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
14597 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
14598
14599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14600}
14601
14602impl MacVerifyRequest {
14603 pub fn new() -> Self {
14604 std::default::Default::default()
14605 }
14606
14607 /// Sets the value of [name][crate::model::MacVerifyRequest::name].
14608 ///
14609 /// # Example
14610 /// ```ignore,no_run
14611 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14612 /// let x = MacVerifyRequest::new().set_name("example");
14613 /// ```
14614 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14615 self.name = v.into();
14616 self
14617 }
14618
14619 /// Sets the value of [data][crate::model::MacVerifyRequest::data].
14620 ///
14621 /// # Example
14622 /// ```ignore,no_run
14623 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14624 /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14625 /// ```
14626 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14627 self.data = v.into();
14628 self
14629 }
14630
14631 /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14632 ///
14633 /// # Example
14634 /// ```ignore,no_run
14635 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14636 /// use wkt::Int64Value;
14637 /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14638 /// ```
14639 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14640 where
14641 T: std::convert::Into<wkt::Int64Value>,
14642 {
14643 self.data_crc32c = std::option::Option::Some(v.into());
14644 self
14645 }
14646
14647 /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14648 ///
14649 /// # Example
14650 /// ```ignore,no_run
14651 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14652 /// use wkt::Int64Value;
14653 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14654 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14655 /// ```
14656 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14657 where
14658 T: std::convert::Into<wkt::Int64Value>,
14659 {
14660 self.data_crc32c = v.map(|x| x.into());
14661 self
14662 }
14663
14664 /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
14665 ///
14666 /// # Example
14667 /// ```ignore,no_run
14668 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14669 /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
14670 /// ```
14671 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14672 self.mac = v.into();
14673 self
14674 }
14675
14676 /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14677 ///
14678 /// # Example
14679 /// ```ignore,no_run
14680 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14681 /// use wkt::Int64Value;
14682 /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
14683 /// ```
14684 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
14685 where
14686 T: std::convert::Into<wkt::Int64Value>,
14687 {
14688 self.mac_crc32c = std::option::Option::Some(v.into());
14689 self
14690 }
14691
14692 /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14693 ///
14694 /// # Example
14695 /// ```ignore,no_run
14696 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14697 /// use wkt::Int64Value;
14698 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
14699 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
14700 /// ```
14701 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14702 where
14703 T: std::convert::Into<wkt::Int64Value>,
14704 {
14705 self.mac_crc32c = v.map(|x| x.into());
14706 self
14707 }
14708}
14709
14710impl wkt::message::Message for MacVerifyRequest {
14711 fn typename() -> &'static str {
14712 "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
14713 }
14714}
14715
14716/// Request message for
14717/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
14718///
14719/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
14720#[derive(Clone, Default, PartialEq)]
14721#[non_exhaustive]
14722pub struct DecapsulateRequest {
14723 /// Required. The resource name of the
14724 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14725 /// decapsulation.
14726 ///
14727 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14728 pub name: std::string::String,
14729
14730 /// Required. The ciphertext produced from encapsulation with the
14731 /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
14732 /// key(s).
14733 ///
14734 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14735 pub ciphertext: ::bytes::Bytes,
14736
14737 /// Optional. A CRC32C checksum of the
14738 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
14739 /// If specified,
14740 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14741 /// verify the integrity of the received
14742 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
14743 /// using this checksum.
14744 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14745 /// report an error if the checksum verification fails. If you receive a
14746 /// checksum error, your client should verify that
14747 /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
14748 /// is equal to
14749 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
14750 /// and if so, perform a limited number of retries. A persistent mismatch may
14751 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14752 /// field is defined as int64 for reasons of compatibility across different
14753 /// languages. However, it is a non-negative integer, which will never exceed
14754 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14755 /// this type.
14756 ///
14757 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
14758 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
14759 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14760 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14761
14762 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14763}
14764
14765impl DecapsulateRequest {
14766 pub fn new() -> Self {
14767 std::default::Default::default()
14768 }
14769
14770 /// Sets the value of [name][crate::model::DecapsulateRequest::name].
14771 ///
14772 /// # Example
14773 /// ```ignore,no_run
14774 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14775 /// let x = DecapsulateRequest::new().set_name("example");
14776 /// ```
14777 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14778 self.name = v.into();
14779 self
14780 }
14781
14782 /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
14783 ///
14784 /// # Example
14785 /// ```ignore,no_run
14786 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14787 /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14788 /// ```
14789 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14790 self.ciphertext = v.into();
14791 self
14792 }
14793
14794 /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14795 ///
14796 /// # Example
14797 /// ```ignore,no_run
14798 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14799 /// use wkt::Int64Value;
14800 /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14801 /// ```
14802 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14803 where
14804 T: std::convert::Into<wkt::Int64Value>,
14805 {
14806 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14807 self
14808 }
14809
14810 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
14811 ///
14812 /// # Example
14813 /// ```ignore,no_run
14814 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
14815 /// use wkt::Int64Value;
14816 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14817 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14818 /// ```
14819 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14820 where
14821 T: std::convert::Into<wkt::Int64Value>,
14822 {
14823 self.ciphertext_crc32c = v.map(|x| x.into());
14824 self
14825 }
14826}
14827
14828impl wkt::message::Message for DecapsulateRequest {
14829 fn typename() -> &'static str {
14830 "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
14831 }
14832}
14833
14834/// Request message for
14835/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
14836///
14837/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
14838#[derive(Clone, Default, PartialEq)]
14839#[non_exhaustive]
14840pub struct GenerateRandomBytesRequest {
14841 /// The project-specific location in which to generate random bytes.
14842 /// For example, "projects/my-project/locations/us-central1".
14843 pub location: std::string::String,
14844
14845 /// The length in bytes of the amount of randomness to retrieve. Minimum 8
14846 /// bytes, maximum 1024 bytes.
14847 pub length_bytes: i32,
14848
14849 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
14850 /// generating the random data. Currently, only
14851 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
14852 /// supported.
14853 ///
14854 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14855 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
14856 pub protection_level: crate::model::ProtectionLevel,
14857
14858 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14859}
14860
14861impl GenerateRandomBytesRequest {
14862 pub fn new() -> Self {
14863 std::default::Default::default()
14864 }
14865
14866 /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
14867 ///
14868 /// # Example
14869 /// ```ignore,no_run
14870 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14871 /// let x = GenerateRandomBytesRequest::new().set_location("example");
14872 /// ```
14873 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14874 self.location = v.into();
14875 self
14876 }
14877
14878 /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
14879 ///
14880 /// # Example
14881 /// ```ignore,no_run
14882 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14883 /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
14884 /// ```
14885 pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14886 self.length_bytes = v.into();
14887 self
14888 }
14889
14890 /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
14891 ///
14892 /// # Example
14893 /// ```ignore,no_run
14894 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
14895 /// use google_cloud_kms_v1::model::ProtectionLevel;
14896 /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
14897 /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
14898 /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
14899 /// ```
14900 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
14901 mut self,
14902 v: T,
14903 ) -> Self {
14904 self.protection_level = v.into();
14905 self
14906 }
14907}
14908
14909impl wkt::message::Message for GenerateRandomBytesRequest {
14910 fn typename() -> &'static str {
14911 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
14912 }
14913}
14914
14915/// Response message for
14916/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
14917///
14918/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
14919#[derive(Clone, Default, PartialEq)]
14920#[non_exhaustive]
14921pub struct EncryptResponse {
14922 /// The resource name of the
14923 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14924 /// encryption. Check this field to verify that the intended resource was used
14925 /// for encryption.
14926 ///
14927 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14928 pub name: std::string::String,
14929
14930 /// The encrypted data.
14931 pub ciphertext: ::bytes::Bytes,
14932
14933 /// Integrity verification field. A CRC32C checksum of the returned
14934 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
14935 /// An integrity check of
14936 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14937 /// can be performed by computing the CRC32C checksum of
14938 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
14939 /// and comparing your results to this field. Discard the response in case of
14940 /// non-matching checksum values, and perform a limited number of retries. A
14941 /// persistent mismatch may indicate an issue in your computation of the CRC32C
14942 /// checksum. Note: This field is defined as int64 for reasons of compatibility
14943 /// across different languages. However, it is a non-negative integer, which
14944 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14945 /// languages that support this type.
14946 ///
14947 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
14948 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14949
14950 /// Integrity verification field. A flag indicating whether
14951 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14952 /// was received by
14953 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14954 /// for the integrity verification of the
14955 /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
14956 /// this field indicates either that
14957 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14958 /// was left unset or that it was not delivered to
14959 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14960 /// set
14961 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
14962 /// but this field is still false, discard the response and perform a limited
14963 /// number of retries.
14964 ///
14965 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
14966 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
14967 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14968 pub verified_plaintext_crc32c: bool,
14969
14970 /// Integrity verification field. A flag indicating whether
14971 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14972 /// was received by
14973 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
14974 /// for the integrity verification of the
14975 /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
14976 /// false value of this field indicates either that
14977 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14978 /// was left unset or that it was not delivered to
14979 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
14980 /// set
14981 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
14982 /// but this field is still false, discard the response and perform a limited
14983 /// number of retries.
14984 ///
14985 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
14986 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
14987 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14988 pub verified_additional_authenticated_data_crc32c: bool,
14989
14990 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
14991 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
14992 /// encryption.
14993 ///
14994 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14995 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
14996 pub protection_level: crate::model::ProtectionLevel,
14997
14998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14999}
15000
15001impl EncryptResponse {
15002 pub fn new() -> Self {
15003 std::default::Default::default()
15004 }
15005
15006 /// Sets the value of [name][crate::model::EncryptResponse::name].
15007 ///
15008 /// # Example
15009 /// ```ignore,no_run
15010 /// # use google_cloud_kms_v1::model::EncryptResponse;
15011 /// let x = EncryptResponse::new().set_name("example");
15012 /// ```
15013 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15014 self.name = v.into();
15015 self
15016 }
15017
15018 /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
15019 ///
15020 /// # Example
15021 /// ```ignore,no_run
15022 /// # use google_cloud_kms_v1::model::EncryptResponse;
15023 /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15024 /// ```
15025 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15026 self.ciphertext = v.into();
15027 self
15028 }
15029
15030 /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15031 ///
15032 /// # Example
15033 /// ```ignore,no_run
15034 /// # use google_cloud_kms_v1::model::EncryptResponse;
15035 /// use wkt::Int64Value;
15036 /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15037 /// ```
15038 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15039 where
15040 T: std::convert::Into<wkt::Int64Value>,
15041 {
15042 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15043 self
15044 }
15045
15046 /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15047 ///
15048 /// # Example
15049 /// ```ignore,no_run
15050 /// # use google_cloud_kms_v1::model::EncryptResponse;
15051 /// use wkt::Int64Value;
15052 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15053 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15054 /// ```
15055 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15056 where
15057 T: std::convert::Into<wkt::Int64Value>,
15058 {
15059 self.ciphertext_crc32c = v.map(|x| x.into());
15060 self
15061 }
15062
15063 /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
15064 ///
15065 /// # Example
15066 /// ```ignore,no_run
15067 /// # use google_cloud_kms_v1::model::EncryptResponse;
15068 /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
15069 /// ```
15070 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15071 self.verified_plaintext_crc32c = v.into();
15072 self
15073 }
15074
15075 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
15076 ///
15077 /// # Example
15078 /// ```ignore,no_run
15079 /// # use google_cloud_kms_v1::model::EncryptResponse;
15080 /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15081 /// ```
15082 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15083 mut self,
15084 v: T,
15085 ) -> Self {
15086 self.verified_additional_authenticated_data_crc32c = v.into();
15087 self
15088 }
15089
15090 /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
15091 ///
15092 /// # Example
15093 /// ```ignore,no_run
15094 /// # use google_cloud_kms_v1::model::EncryptResponse;
15095 /// use google_cloud_kms_v1::model::ProtectionLevel;
15096 /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15097 /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15098 /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
15099 /// ```
15100 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15101 mut self,
15102 v: T,
15103 ) -> Self {
15104 self.protection_level = v.into();
15105 self
15106 }
15107}
15108
15109impl wkt::message::Message for EncryptResponse {
15110 fn typename() -> &'static str {
15111 "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
15112 }
15113}
15114
15115/// Response message for
15116/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
15117///
15118/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
15119#[derive(Clone, Default, PartialEq)]
15120#[non_exhaustive]
15121pub struct DecryptResponse {
15122 /// The decrypted data originally supplied in
15123 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
15124 ///
15125 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15126 pub plaintext: ::bytes::Bytes,
15127
15128 /// Integrity verification field. A CRC32C checksum of the returned
15129 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
15130 /// An integrity check of
15131 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15132 /// can be performed by computing the CRC32C checksum of
15133 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15134 /// and comparing your results to this field. Discard the response in case of
15135 /// non-matching checksum values, and perform a limited number of retries. A
15136 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15137 /// checksum. Note: receiving this response message indicates that
15138 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15139 /// successfully decrypt the
15140 /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
15141 /// field is defined as int64 for reasons of compatibility across different
15142 /// languages. However, it is a non-negative integer, which will never exceed
15143 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15144 /// this type.
15145 ///
15146 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
15147 /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
15148 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15149 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15150
15151 /// Whether the Decryption was performed using the primary key version.
15152 pub used_primary: bool,
15153
15154 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15155 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15156 /// decryption.
15157 ///
15158 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15159 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15160 pub protection_level: crate::model::ProtectionLevel,
15161
15162 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15163}
15164
15165impl DecryptResponse {
15166 pub fn new() -> Self {
15167 std::default::Default::default()
15168 }
15169
15170 /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
15171 ///
15172 /// # Example
15173 /// ```ignore,no_run
15174 /// # use google_cloud_kms_v1::model::DecryptResponse;
15175 /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15176 /// ```
15177 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15178 self.plaintext = v.into();
15179 self
15180 }
15181
15182 /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15183 ///
15184 /// # Example
15185 /// ```ignore,no_run
15186 /// # use google_cloud_kms_v1::model::DecryptResponse;
15187 /// use wkt::Int64Value;
15188 /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15189 /// ```
15190 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15191 where
15192 T: std::convert::Into<wkt::Int64Value>,
15193 {
15194 self.plaintext_crc32c = std::option::Option::Some(v.into());
15195 self
15196 }
15197
15198 /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15199 ///
15200 /// # Example
15201 /// ```ignore,no_run
15202 /// # use google_cloud_kms_v1::model::DecryptResponse;
15203 /// use wkt::Int64Value;
15204 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15205 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15206 /// ```
15207 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15208 where
15209 T: std::convert::Into<wkt::Int64Value>,
15210 {
15211 self.plaintext_crc32c = v.map(|x| x.into());
15212 self
15213 }
15214
15215 /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
15216 ///
15217 /// # Example
15218 /// ```ignore,no_run
15219 /// # use google_cloud_kms_v1::model::DecryptResponse;
15220 /// let x = DecryptResponse::new().set_used_primary(true);
15221 /// ```
15222 pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15223 self.used_primary = v.into();
15224 self
15225 }
15226
15227 /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
15228 ///
15229 /// # Example
15230 /// ```ignore,no_run
15231 /// # use google_cloud_kms_v1::model::DecryptResponse;
15232 /// use google_cloud_kms_v1::model::ProtectionLevel;
15233 /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15234 /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15235 /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
15236 /// ```
15237 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15238 mut self,
15239 v: T,
15240 ) -> Self {
15241 self.protection_level = v.into();
15242 self
15243 }
15244}
15245
15246impl wkt::message::Message for DecryptResponse {
15247 fn typename() -> &'static str {
15248 "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
15249 }
15250}
15251
15252/// Response message for
15253/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
15254///
15255/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
15256#[derive(Clone, Default, PartialEq)]
15257#[non_exhaustive]
15258pub struct RawEncryptResponse {
15259 /// The encrypted data. In the case of AES-GCM, the authentication tag
15260 /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
15261 /// bytes at the end of this field.
15262 ///
15263 /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
15264 pub ciphertext: ::bytes::Bytes,
15265
15266 /// The initialization vector (IV) generated by the service during
15267 /// encryption. This value must be stored and provided in
15268 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
15269 /// at decryption time.
15270 ///
15271 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
15272 pub initialization_vector: ::bytes::Bytes,
15273
15274 /// The length of the authentication tag that is appended to
15275 /// the end of the ciphertext.
15276 pub tag_length: i32,
15277
15278 /// Integrity verification field. A CRC32C checksum of the returned
15279 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
15280 /// An integrity check of ciphertext can be performed by computing the CRC32C
15281 /// checksum of ciphertext and comparing your results to this field. Discard
15282 /// the response in case of non-matching checksum values, and perform a limited
15283 /// number of retries. A persistent mismatch may indicate an issue in your
15284 /// computation of the CRC32C checksum. Note: This field is defined as int64
15285 /// for reasons of compatibility across different languages. However, it is a
15286 /// non-negative integer, which will never exceed 2^32-1, and can be safely
15287 /// downconverted to uint32 in languages that support this type.
15288 ///
15289 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
15290 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15291
15292 /// Integrity verification field. A CRC32C checksum of the returned
15293 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
15294 /// An integrity check of initialization_vector can be performed by computing
15295 /// the CRC32C checksum of initialization_vector and comparing your results to
15296 /// this field. Discard the response in case of non-matching checksum values,
15297 /// and perform a limited number of retries. A persistent mismatch may indicate
15298 /// an issue in your computation of the CRC32C checksum. Note: This field is
15299 /// defined as int64 for reasons of compatibility across different languages.
15300 /// However, it is a non-negative integer, which will never exceed 2^32-1, and
15301 /// can be safely downconverted to uint32 in languages that support this type.
15302 ///
15303 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
15304 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
15305
15306 /// Integrity verification field. A flag indicating whether
15307 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15308 /// was received by
15309 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15310 /// for the integrity verification of the plaintext. A false value of this
15311 /// field indicates either that
15312 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15313 /// was left unset or that it was not delivered to
15314 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15315 /// set
15316 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15317 /// but this field is still false, discard the response and perform a limited
15318 /// number of retries.
15319 ///
15320 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15321 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
15322 pub verified_plaintext_crc32c: bool,
15323
15324 /// Integrity verification field. A flag indicating whether
15325 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15326 /// was received by
15327 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15328 /// for the integrity verification of additional_authenticated_data. A false
15329 /// value of this field indicates either that //
15330 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15331 /// was left unset or that it was not delivered to
15332 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15333 /// set
15334 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15335 /// but this field is still false, discard the response and perform a limited
15336 /// number of retries.
15337 ///
15338 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15339 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
15340 pub verified_additional_authenticated_data_crc32c: bool,
15341
15342 /// Integrity verification field. A flag indicating whether
15343 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15344 /// was received by
15345 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15346 /// for the integrity verification of initialization_vector. A false value of
15347 /// this field indicates either that
15348 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15349 /// was left unset or that it was not delivered to
15350 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15351 /// set
15352 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15353 /// but this field is still false, discard the response and perform a limited
15354 /// number of retries.
15355 ///
15356 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15357 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
15358 pub verified_initialization_vector_crc32c: bool,
15359
15360 /// The resource name of the
15361 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15362 /// encryption. Check this field to verify that the intended resource was used
15363 /// for encryption.
15364 ///
15365 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15366 pub name: std::string::String,
15367
15368 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15369 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15370 /// encryption.
15371 ///
15372 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15373 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15374 pub protection_level: crate::model::ProtectionLevel,
15375
15376 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15377}
15378
15379impl RawEncryptResponse {
15380 pub fn new() -> Self {
15381 std::default::Default::default()
15382 }
15383
15384 /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
15385 ///
15386 /// # Example
15387 /// ```ignore,no_run
15388 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15389 /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15390 /// ```
15391 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15392 self.ciphertext = v.into();
15393 self
15394 }
15395
15396 /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
15397 ///
15398 /// # Example
15399 /// ```ignore,no_run
15400 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15401 /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
15402 /// ```
15403 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
15404 mut self,
15405 v: T,
15406 ) -> Self {
15407 self.initialization_vector = v.into();
15408 self
15409 }
15410
15411 /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
15412 ///
15413 /// # Example
15414 /// ```ignore,no_run
15415 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15416 /// let x = RawEncryptResponse::new().set_tag_length(42);
15417 /// ```
15418 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15419 self.tag_length = v.into();
15420 self
15421 }
15422
15423 /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15424 ///
15425 /// # Example
15426 /// ```ignore,no_run
15427 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15428 /// use wkt::Int64Value;
15429 /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15430 /// ```
15431 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15432 where
15433 T: std::convert::Into<wkt::Int64Value>,
15434 {
15435 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15436 self
15437 }
15438
15439 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15440 ///
15441 /// # Example
15442 /// ```ignore,no_run
15443 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15444 /// use wkt::Int64Value;
15445 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15446 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15447 /// ```
15448 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15449 where
15450 T: std::convert::Into<wkt::Int64Value>,
15451 {
15452 self.ciphertext_crc32c = v.map(|x| x.into());
15453 self
15454 }
15455
15456 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15457 ///
15458 /// # Example
15459 /// ```ignore,no_run
15460 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15461 /// use wkt::Int64Value;
15462 /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
15463 /// ```
15464 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
15465 where
15466 T: std::convert::Into<wkt::Int64Value>,
15467 {
15468 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
15469 self
15470 }
15471
15472 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15473 ///
15474 /// # Example
15475 /// ```ignore,no_run
15476 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15477 /// use wkt::Int64Value;
15478 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
15479 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
15480 /// ```
15481 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15482 where
15483 T: std::convert::Into<wkt::Int64Value>,
15484 {
15485 self.initialization_vector_crc32c = v.map(|x| x.into());
15486 self
15487 }
15488
15489 /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
15490 ///
15491 /// # Example
15492 /// ```ignore,no_run
15493 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15494 /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
15495 /// ```
15496 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15497 self.verified_plaintext_crc32c = v.into();
15498 self
15499 }
15500
15501 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
15502 ///
15503 /// # Example
15504 /// ```ignore,no_run
15505 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15506 /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15507 /// ```
15508 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15509 mut self,
15510 v: T,
15511 ) -> Self {
15512 self.verified_additional_authenticated_data_crc32c = v.into();
15513 self
15514 }
15515
15516 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
15517 ///
15518 /// # Example
15519 /// ```ignore,no_run
15520 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15521 /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
15522 /// ```
15523 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15524 mut self,
15525 v: T,
15526 ) -> Self {
15527 self.verified_initialization_vector_crc32c = v.into();
15528 self
15529 }
15530
15531 /// Sets the value of [name][crate::model::RawEncryptResponse::name].
15532 ///
15533 /// # Example
15534 /// ```ignore,no_run
15535 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15536 /// let x = RawEncryptResponse::new().set_name("example");
15537 /// ```
15538 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15539 self.name = v.into();
15540 self
15541 }
15542
15543 /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
15544 ///
15545 /// # Example
15546 /// ```ignore,no_run
15547 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15548 /// use google_cloud_kms_v1::model::ProtectionLevel;
15549 /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15550 /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15551 /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
15552 /// ```
15553 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15554 mut self,
15555 v: T,
15556 ) -> Self {
15557 self.protection_level = v.into();
15558 self
15559 }
15560}
15561
15562impl wkt::message::Message for RawEncryptResponse {
15563 fn typename() -> &'static str {
15564 "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
15565 }
15566}
15567
15568/// Response message for
15569/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
15570///
15571/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
15572#[derive(Clone, Default, PartialEq)]
15573#[non_exhaustive]
15574pub struct RawDecryptResponse {
15575 /// The decrypted data.
15576 pub plaintext: ::bytes::Bytes,
15577
15578 /// Integrity verification field. A CRC32C checksum of the returned
15579 /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
15580 /// An integrity check of plaintext can be performed by computing the CRC32C
15581 /// checksum of plaintext and comparing your results to this field. Discard the
15582 /// response in case of non-matching checksum values, and perform a limited
15583 /// number of retries. A persistent mismatch may indicate an issue in your
15584 /// computation of the CRC32C checksum. Note: receiving this response message
15585 /// indicates that
15586 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15587 /// successfully decrypt the
15588 /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
15589 /// Note: This field is defined as int64 for reasons of compatibility across
15590 /// different languages. However, it is a non-negative integer, which will
15591 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
15592 /// that support this type.
15593 ///
15594 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15595 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
15596 /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
15597 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15598
15599 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15600 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15601 /// decryption.
15602 ///
15603 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15604 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15605 pub protection_level: crate::model::ProtectionLevel,
15606
15607 /// Integrity verification field. A flag indicating whether
15608 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15609 /// was received by
15610 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15611 /// for the integrity verification of the ciphertext. A false value of this
15612 /// field indicates either that
15613 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15614 /// was left unset or that it was not delivered to
15615 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15616 /// set
15617 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15618 /// but this field is still false, discard the response and perform a limited
15619 /// number of retries.
15620 ///
15621 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15622 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
15623 pub verified_ciphertext_crc32c: bool,
15624
15625 /// Integrity verification field. A flag indicating whether
15626 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15627 /// was received by
15628 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15629 /// for the integrity verification of additional_authenticated_data. A false
15630 /// value of this field indicates either that //
15631 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15632 /// was left unset or that it was not delivered to
15633 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15634 /// set
15635 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15636 /// but this field is still false, discard the response and perform a limited
15637 /// number of retries.
15638 ///
15639 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15640 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
15641 pub verified_additional_authenticated_data_crc32c: bool,
15642
15643 /// Integrity verification field. A flag indicating whether
15644 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15645 /// was received by
15646 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15647 /// for the integrity verification of initialization_vector. A false value of
15648 /// this field indicates either that
15649 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15650 /// was left unset or that it was not delivered to
15651 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15652 /// set
15653 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15654 /// but this field is still false, discard the response and perform a limited
15655 /// number of retries.
15656 ///
15657 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15658 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
15659 pub verified_initialization_vector_crc32c: bool,
15660
15661 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15662}
15663
15664impl RawDecryptResponse {
15665 pub fn new() -> Self {
15666 std::default::Default::default()
15667 }
15668
15669 /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
15670 ///
15671 /// # Example
15672 /// ```ignore,no_run
15673 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15674 /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15675 /// ```
15676 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15677 self.plaintext = v.into();
15678 self
15679 }
15680
15681 /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15682 ///
15683 /// # Example
15684 /// ```ignore,no_run
15685 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15686 /// use wkt::Int64Value;
15687 /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15688 /// ```
15689 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15690 where
15691 T: std::convert::Into<wkt::Int64Value>,
15692 {
15693 self.plaintext_crc32c = std::option::Option::Some(v.into());
15694 self
15695 }
15696
15697 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
15698 ///
15699 /// # Example
15700 /// ```ignore,no_run
15701 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15702 /// use wkt::Int64Value;
15703 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15704 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15705 /// ```
15706 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15707 where
15708 T: std::convert::Into<wkt::Int64Value>,
15709 {
15710 self.plaintext_crc32c = v.map(|x| x.into());
15711 self
15712 }
15713
15714 /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
15715 ///
15716 /// # Example
15717 /// ```ignore,no_run
15718 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15719 /// use google_cloud_kms_v1::model::ProtectionLevel;
15720 /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15721 /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15722 /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
15723 /// ```
15724 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15725 mut self,
15726 v: T,
15727 ) -> Self {
15728 self.protection_level = v.into();
15729 self
15730 }
15731
15732 /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
15733 ///
15734 /// # Example
15735 /// ```ignore,no_run
15736 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15737 /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
15738 /// ```
15739 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15740 self.verified_ciphertext_crc32c = v.into();
15741 self
15742 }
15743
15744 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
15745 ///
15746 /// # Example
15747 /// ```ignore,no_run
15748 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15749 /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15750 /// ```
15751 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15752 mut self,
15753 v: T,
15754 ) -> Self {
15755 self.verified_additional_authenticated_data_crc32c = v.into();
15756 self
15757 }
15758
15759 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
15760 ///
15761 /// # Example
15762 /// ```ignore,no_run
15763 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
15764 /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
15765 /// ```
15766 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15767 mut self,
15768 v: T,
15769 ) -> Self {
15770 self.verified_initialization_vector_crc32c = v.into();
15771 self
15772 }
15773}
15774
15775impl wkt::message::Message for RawDecryptResponse {
15776 fn typename() -> &'static str {
15777 "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
15778 }
15779}
15780
15781/// Response message for
15782/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
15783///
15784/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
15785#[derive(Clone, Default, PartialEq)]
15786#[non_exhaustive]
15787pub struct AsymmetricSignResponse {
15788 /// The created signature.
15789 pub signature: ::bytes::Bytes,
15790
15791 /// Integrity verification field. A CRC32C checksum of the returned
15792 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
15793 /// An integrity check of
15794 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15795 /// can be performed by computing the CRC32C checksum of
15796 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
15797 /// and comparing your results to this field. Discard the response in case of
15798 /// non-matching checksum values, and perform a limited number of retries. A
15799 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15800 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15801 /// across different languages. However, it is a non-negative integer, which
15802 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15803 /// languages that support this type.
15804 ///
15805 /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
15806 pub signature_crc32c: std::option::Option<wkt::Int64Value>,
15807
15808 /// Integrity verification field. A flag indicating whether
15809 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15810 /// was received by
15811 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15812 /// for the integrity verification of the
15813 /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
15814 /// of this field indicates either that
15815 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15816 /// was left unset or that it was not delivered to
15817 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15818 /// set
15819 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
15820 /// but this field is still false, discard the response and perform a limited
15821 /// number of retries.
15822 ///
15823 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
15824 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
15825 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15826 pub verified_digest_crc32c: bool,
15827
15828 /// The resource name of the
15829 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15830 /// Check this field to verify that the intended resource was used for signing.
15831 ///
15832 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15833 pub name: std::string::String,
15834
15835 /// Integrity verification field. A flag indicating whether
15836 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15837 /// was received by
15838 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15839 /// for the integrity verification of the
15840 /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
15841 /// this field indicates either that
15842 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15843 /// was left unset or that it was not delivered to
15844 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15845 /// set
15846 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
15847 /// but this field is still false, discard the response and perform a limited
15848 /// number of retries.
15849 ///
15850 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
15851 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
15852 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15853 pub verified_data_crc32c: bool,
15854
15855 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15856 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
15857 ///
15858 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15859 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15860 pub protection_level: crate::model::ProtectionLevel,
15861
15862 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15863}
15864
15865impl AsymmetricSignResponse {
15866 pub fn new() -> Self {
15867 std::default::Default::default()
15868 }
15869
15870 /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
15871 ///
15872 /// # Example
15873 /// ```ignore,no_run
15874 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15875 /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
15876 /// ```
15877 pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15878 self.signature = v.into();
15879 self
15880 }
15881
15882 /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15883 ///
15884 /// # Example
15885 /// ```ignore,no_run
15886 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15887 /// use wkt::Int64Value;
15888 /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
15889 /// ```
15890 pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
15891 where
15892 T: std::convert::Into<wkt::Int64Value>,
15893 {
15894 self.signature_crc32c = std::option::Option::Some(v.into());
15895 self
15896 }
15897
15898 /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
15899 ///
15900 /// # Example
15901 /// ```ignore,no_run
15902 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15903 /// use wkt::Int64Value;
15904 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
15905 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
15906 /// ```
15907 pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15908 where
15909 T: std::convert::Into<wkt::Int64Value>,
15910 {
15911 self.signature_crc32c = v.map(|x| x.into());
15912 self
15913 }
15914
15915 /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
15916 ///
15917 /// # Example
15918 /// ```ignore,no_run
15919 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15920 /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
15921 /// ```
15922 pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15923 self.verified_digest_crc32c = v.into();
15924 self
15925 }
15926
15927 /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
15928 ///
15929 /// # Example
15930 /// ```ignore,no_run
15931 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15932 /// let x = AsymmetricSignResponse::new().set_name("example");
15933 /// ```
15934 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15935 self.name = v.into();
15936 self
15937 }
15938
15939 /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
15940 ///
15941 /// # Example
15942 /// ```ignore,no_run
15943 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15944 /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
15945 /// ```
15946 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15947 self.verified_data_crc32c = v.into();
15948 self
15949 }
15950
15951 /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
15952 ///
15953 /// # Example
15954 /// ```ignore,no_run
15955 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
15956 /// use google_cloud_kms_v1::model::ProtectionLevel;
15957 /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
15958 /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
15959 /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
15960 /// ```
15961 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15962 mut self,
15963 v: T,
15964 ) -> Self {
15965 self.protection_level = v.into();
15966 self
15967 }
15968}
15969
15970impl wkt::message::Message for AsymmetricSignResponse {
15971 fn typename() -> &'static str {
15972 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
15973 }
15974}
15975
15976/// Response message for
15977/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
15978///
15979/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
15980#[derive(Clone, Default, PartialEq)]
15981#[non_exhaustive]
15982pub struct AsymmetricDecryptResponse {
15983 /// The decrypted data originally encrypted with the matching public key.
15984 pub plaintext: ::bytes::Bytes,
15985
15986 /// Integrity verification field. A CRC32C checksum of the returned
15987 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
15988 /// An integrity check of
15989 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15990 /// can be performed by computing the CRC32C checksum of
15991 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
15992 /// and comparing your results to this field. Discard the response in case of
15993 /// non-matching checksum values, and perform a limited number of retries. A
15994 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15995 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15996 /// across different languages. However, it is a non-negative integer, which
15997 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15998 /// languages that support this type.
15999 ///
16000 /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
16001 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16002
16003 /// Integrity verification field. A flag indicating whether
16004 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16005 /// was received by
16006 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16007 /// for the integrity verification of the
16008 /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
16009 /// false value of this field indicates either that
16010 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16011 /// was left unset or that it was not delivered to
16012 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16013 /// set
16014 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16015 /// but this field is still false, discard the response and perform a limited
16016 /// number of retries.
16017 ///
16018 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
16019 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
16020 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16021 pub verified_ciphertext_crc32c: bool,
16022
16023 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16024 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16025 /// decryption.
16026 ///
16027 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16028 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16029 pub protection_level: crate::model::ProtectionLevel,
16030
16031 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16032}
16033
16034impl AsymmetricDecryptResponse {
16035 pub fn new() -> Self {
16036 std::default::Default::default()
16037 }
16038
16039 /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
16040 ///
16041 /// # Example
16042 /// ```ignore,no_run
16043 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16044 /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16045 /// ```
16046 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16047 self.plaintext = v.into();
16048 self
16049 }
16050
16051 /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16052 ///
16053 /// # Example
16054 /// ```ignore,no_run
16055 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16056 /// use wkt::Int64Value;
16057 /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16058 /// ```
16059 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16060 where
16061 T: std::convert::Into<wkt::Int64Value>,
16062 {
16063 self.plaintext_crc32c = std::option::Option::Some(v.into());
16064 self
16065 }
16066
16067 /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16068 ///
16069 /// # Example
16070 /// ```ignore,no_run
16071 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16072 /// use wkt::Int64Value;
16073 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16074 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16075 /// ```
16076 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16077 where
16078 T: std::convert::Into<wkt::Int64Value>,
16079 {
16080 self.plaintext_crc32c = v.map(|x| x.into());
16081 self
16082 }
16083
16084 /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
16085 ///
16086 /// # Example
16087 /// ```ignore,no_run
16088 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16089 /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16090 /// ```
16091 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16092 self.verified_ciphertext_crc32c = v.into();
16093 self
16094 }
16095
16096 /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
16097 ///
16098 /// # Example
16099 /// ```ignore,no_run
16100 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16101 /// use google_cloud_kms_v1::model::ProtectionLevel;
16102 /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16103 /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16104 /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16105 /// ```
16106 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16107 mut self,
16108 v: T,
16109 ) -> Self {
16110 self.protection_level = v.into();
16111 self
16112 }
16113}
16114
16115impl wkt::message::Message for AsymmetricDecryptResponse {
16116 fn typename() -> &'static str {
16117 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
16118 }
16119}
16120
16121/// Response message for
16122/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
16123///
16124/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
16125#[derive(Clone, Default, PartialEq)]
16126#[non_exhaustive]
16127pub struct MacSignResponse {
16128 /// The resource name of the
16129 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16130 /// Check this field to verify that the intended resource was used for signing.
16131 ///
16132 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16133 pub name: std::string::String,
16134
16135 /// The created signature.
16136 pub mac: ::bytes::Bytes,
16137
16138 /// Integrity verification field. A CRC32C checksum of the returned
16139 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
16140 /// integrity check of
16141 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
16142 /// performed by computing the CRC32C checksum of
16143 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
16144 /// comparing your results to this field. Discard the response in case of
16145 /// non-matching checksum values, and perform a limited number of retries. A
16146 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16147 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16148 /// across different languages. However, it is a non-negative integer, which
16149 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16150 /// languages that support this type.
16151 ///
16152 /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
16153 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
16154
16155 /// Integrity verification field. A flag indicating whether
16156 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16157 /// was received by
16158 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16159 /// for the integrity verification of the
16160 /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
16161 /// field indicates either that
16162 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16163 /// was left unset or that it was not delivered to
16164 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16165 /// set
16166 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16167 /// but this field is still false, discard the response and perform a limited
16168 /// number of retries.
16169 ///
16170 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16171 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
16172 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
16173 pub verified_data_crc32c: bool,
16174
16175 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16176 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16177 ///
16178 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16179 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16180 pub protection_level: crate::model::ProtectionLevel,
16181
16182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16183}
16184
16185impl MacSignResponse {
16186 pub fn new() -> Self {
16187 std::default::Default::default()
16188 }
16189
16190 /// Sets the value of [name][crate::model::MacSignResponse::name].
16191 ///
16192 /// # Example
16193 /// ```ignore,no_run
16194 /// # use google_cloud_kms_v1::model::MacSignResponse;
16195 /// let x = MacSignResponse::new().set_name("example");
16196 /// ```
16197 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16198 self.name = v.into();
16199 self
16200 }
16201
16202 /// Sets the value of [mac][crate::model::MacSignResponse::mac].
16203 ///
16204 /// # Example
16205 /// ```ignore,no_run
16206 /// # use google_cloud_kms_v1::model::MacSignResponse;
16207 /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
16208 /// ```
16209 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16210 self.mac = v.into();
16211 self
16212 }
16213
16214 /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16215 ///
16216 /// # Example
16217 /// ```ignore,no_run
16218 /// # use google_cloud_kms_v1::model::MacSignResponse;
16219 /// use wkt::Int64Value;
16220 /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
16221 /// ```
16222 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
16223 where
16224 T: std::convert::Into<wkt::Int64Value>,
16225 {
16226 self.mac_crc32c = std::option::Option::Some(v.into());
16227 self
16228 }
16229
16230 /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16231 ///
16232 /// # Example
16233 /// ```ignore,no_run
16234 /// # use google_cloud_kms_v1::model::MacSignResponse;
16235 /// use wkt::Int64Value;
16236 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
16237 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
16238 /// ```
16239 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16240 where
16241 T: std::convert::Into<wkt::Int64Value>,
16242 {
16243 self.mac_crc32c = v.map(|x| x.into());
16244 self
16245 }
16246
16247 /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
16248 ///
16249 /// # Example
16250 /// ```ignore,no_run
16251 /// # use google_cloud_kms_v1::model::MacSignResponse;
16252 /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
16253 /// ```
16254 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16255 self.verified_data_crc32c = v.into();
16256 self
16257 }
16258
16259 /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
16260 ///
16261 /// # Example
16262 /// ```ignore,no_run
16263 /// # use google_cloud_kms_v1::model::MacSignResponse;
16264 /// use google_cloud_kms_v1::model::ProtectionLevel;
16265 /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
16266 /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16267 /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
16268 /// ```
16269 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16270 mut self,
16271 v: T,
16272 ) -> Self {
16273 self.protection_level = v.into();
16274 self
16275 }
16276}
16277
16278impl wkt::message::Message for MacSignResponse {
16279 fn typename() -> &'static str {
16280 "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
16281 }
16282}
16283
16284/// Response message for
16285/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
16286///
16287/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
16288#[derive(Clone, Default, PartialEq)]
16289#[non_exhaustive]
16290pub struct MacVerifyResponse {
16291 /// The resource name of the
16292 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16293 /// verification. Check this field to verify that the intended resource was
16294 /// used for verification.
16295 ///
16296 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16297 pub name: std::string::String,
16298
16299 /// This field indicates whether or not the verification operation for
16300 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
16301 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
16302 /// successful.
16303 ///
16304 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16305 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16306 pub success: bool,
16307
16308 /// Integrity verification field. A flag indicating whether
16309 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16310 /// was received by
16311 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16312 /// for the integrity verification of the
16313 /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
16314 /// field indicates either that
16315 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16316 /// was left unset or that it was not delivered to
16317 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16318 /// set
16319 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16320 /// but this field is still false, discard the response and perform a limited
16321 /// number of retries.
16322 ///
16323 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16324 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16325 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
16326 pub verified_data_crc32c: bool,
16327
16328 /// Integrity verification field. A flag indicating whether
16329 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16330 /// was received by
16331 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16332 /// for the integrity verification of the
16333 /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
16334 /// field indicates either that
16335 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16336 /// was left unset or that it was not delivered to
16337 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16338 /// set
16339 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16340 /// but this field is still false, discard the response and perform a limited
16341 /// number of retries.
16342 ///
16343 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16344 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16345 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
16346 pub verified_mac_crc32c: bool,
16347
16348 /// Integrity verification field. This value is used for the integrity
16349 /// verification of [MacVerifyResponse.success]. If the value of this field
16350 /// contradicts the value of [MacVerifyResponse.success], discard the response
16351 /// and perform a limited number of retries.
16352 pub verified_success_integrity: bool,
16353
16354 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16355 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16356 /// verification.
16357 ///
16358 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16359 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16360 pub protection_level: crate::model::ProtectionLevel,
16361
16362 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16363}
16364
16365impl MacVerifyResponse {
16366 pub fn new() -> Self {
16367 std::default::Default::default()
16368 }
16369
16370 /// Sets the value of [name][crate::model::MacVerifyResponse::name].
16371 ///
16372 /// # Example
16373 /// ```ignore,no_run
16374 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16375 /// let x = MacVerifyResponse::new().set_name("example");
16376 /// ```
16377 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16378 self.name = v.into();
16379 self
16380 }
16381
16382 /// Sets the value of [success][crate::model::MacVerifyResponse::success].
16383 ///
16384 /// # Example
16385 /// ```ignore,no_run
16386 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16387 /// let x = MacVerifyResponse::new().set_success(true);
16388 /// ```
16389 pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16390 self.success = v.into();
16391 self
16392 }
16393
16394 /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
16395 ///
16396 /// # Example
16397 /// ```ignore,no_run
16398 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16399 /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
16400 /// ```
16401 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16402 self.verified_data_crc32c = v.into();
16403 self
16404 }
16405
16406 /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
16407 ///
16408 /// # Example
16409 /// ```ignore,no_run
16410 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16411 /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
16412 /// ```
16413 pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16414 self.verified_mac_crc32c = v.into();
16415 self
16416 }
16417
16418 /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
16419 ///
16420 /// # Example
16421 /// ```ignore,no_run
16422 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16423 /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
16424 /// ```
16425 pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16426 self.verified_success_integrity = v.into();
16427 self
16428 }
16429
16430 /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
16431 ///
16432 /// # Example
16433 /// ```ignore,no_run
16434 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16435 /// use google_cloud_kms_v1::model::ProtectionLevel;
16436 /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
16437 /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
16438 /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
16439 /// ```
16440 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16441 mut self,
16442 v: T,
16443 ) -> Self {
16444 self.protection_level = v.into();
16445 self
16446 }
16447}
16448
16449impl wkt::message::Message for MacVerifyResponse {
16450 fn typename() -> &'static str {
16451 "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
16452 }
16453}
16454
16455/// Response message for
16456/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
16457///
16458/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
16459#[derive(Clone, Default, PartialEq)]
16460#[non_exhaustive]
16461pub struct DecapsulateResponse {
16462 /// The resource name of the
16463 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16464 /// decapsulation. Check this field to verify that the intended resource was
16465 /// used for decapsulation.
16466 ///
16467 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16468 pub name: std::string::String,
16469
16470 /// The decapsulated shared_secret originally encapsulated with the matching
16471 /// public key.
16472 pub shared_secret: ::bytes::Bytes,
16473
16474 /// Integrity verification field. A CRC32C checksum of the returned
16475 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
16476 /// An integrity check of
16477 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16478 /// can be performed by computing the CRC32C checksum of
16479 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16480 /// and comparing your results to this field. Discard the response in case of
16481 /// non-matching checksum values, and perform a limited number of retries. A
16482 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16483 /// checksum. Note: receiving this response message indicates that
16484 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16485 /// successfully decrypt the
16486 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
16487 /// field is defined as int64 for reasons of compatibility across different
16488 /// languages. However, it is a non-negative integer, which will never exceed
16489 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
16490 /// this type.
16491 ///
16492 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16493 /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
16494 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16495 pub shared_secret_crc32c: std::option::Option<i64>,
16496
16497 /// Integrity verification field. A flag indicating whether
16498 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16499 /// was received by
16500 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16501 /// for the integrity verification of the
16502 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
16503 /// value of this field indicates either that
16504 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16505 /// was left unset or that it was not delivered to
16506 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16507 /// set
16508 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16509 /// but this field is still false, discard the response and perform a limited
16510 /// number of retries.
16511 ///
16512 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16513 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
16514 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16515 pub verified_ciphertext_crc32c: bool,
16516
16517 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16518 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16519 /// decapsulation.
16520 ///
16521 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16522 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16523 pub protection_level: crate::model::ProtectionLevel,
16524
16525 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16526}
16527
16528impl DecapsulateResponse {
16529 pub fn new() -> Self {
16530 std::default::Default::default()
16531 }
16532
16533 /// Sets the value of [name][crate::model::DecapsulateResponse::name].
16534 ///
16535 /// # Example
16536 /// ```ignore,no_run
16537 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16538 /// let x = DecapsulateResponse::new().set_name("example");
16539 /// ```
16540 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16541 self.name = v.into();
16542 self
16543 }
16544
16545 /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
16546 ///
16547 /// # Example
16548 /// ```ignore,no_run
16549 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16550 /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
16551 /// ```
16552 pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16553 self.shared_secret = v.into();
16554 self
16555 }
16556
16557 /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16558 ///
16559 /// # Example
16560 /// ```ignore,no_run
16561 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16562 /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
16563 /// ```
16564 pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
16565 where
16566 T: std::convert::Into<i64>,
16567 {
16568 self.shared_secret_crc32c = std::option::Option::Some(v.into());
16569 self
16570 }
16571
16572 /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16573 ///
16574 /// # Example
16575 /// ```ignore,no_run
16576 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16577 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
16578 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
16579 /// ```
16580 pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16581 where
16582 T: std::convert::Into<i64>,
16583 {
16584 self.shared_secret_crc32c = v.map(|x| x.into());
16585 self
16586 }
16587
16588 /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
16589 ///
16590 /// # Example
16591 /// ```ignore,no_run
16592 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16593 /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
16594 /// ```
16595 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16596 self.verified_ciphertext_crc32c = v.into();
16597 self
16598 }
16599
16600 /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
16601 ///
16602 /// # Example
16603 /// ```ignore,no_run
16604 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16605 /// use google_cloud_kms_v1::model::ProtectionLevel;
16606 /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
16607 /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
16608 /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
16609 /// ```
16610 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16611 mut self,
16612 v: T,
16613 ) -> Self {
16614 self.protection_level = v.into();
16615 self
16616 }
16617}
16618
16619impl wkt::message::Message for DecapsulateResponse {
16620 fn typename() -> &'static str {
16621 "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
16622 }
16623}
16624
16625/// Response message for
16626/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
16627///
16628/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
16629#[derive(Clone, Default, PartialEq)]
16630#[non_exhaustive]
16631pub struct GenerateRandomBytesResponse {
16632 /// The generated data.
16633 pub data: ::bytes::Bytes,
16634
16635 /// Integrity verification field. A CRC32C checksum of the returned
16636 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
16637 /// An integrity check of
16638 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16639 /// can be performed by computing the CRC32C checksum of
16640 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16641 /// and comparing your results to this field. Discard the response in case of
16642 /// non-matching checksum values, and perform a limited number of retries. A
16643 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16644 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16645 /// across different languages. However, it is a non-negative integer, which
16646 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16647 /// languages that support this type.
16648 ///
16649 /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
16650 pub data_crc32c: std::option::Option<wkt::Int64Value>,
16651
16652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16653}
16654
16655impl GenerateRandomBytesResponse {
16656 pub fn new() -> Self {
16657 std::default::Default::default()
16658 }
16659
16660 /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
16661 ///
16662 /// # Example
16663 /// ```ignore,no_run
16664 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16665 /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
16666 /// ```
16667 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16668 self.data = v.into();
16669 self
16670 }
16671
16672 /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16673 ///
16674 /// # Example
16675 /// ```ignore,no_run
16676 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16677 /// use wkt::Int64Value;
16678 /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
16679 /// ```
16680 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
16681 where
16682 T: std::convert::Into<wkt::Int64Value>,
16683 {
16684 self.data_crc32c = std::option::Option::Some(v.into());
16685 self
16686 }
16687
16688 /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
16689 ///
16690 /// # Example
16691 /// ```ignore,no_run
16692 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16693 /// use wkt::Int64Value;
16694 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
16695 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
16696 /// ```
16697 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16698 where
16699 T: std::convert::Into<wkt::Int64Value>,
16700 {
16701 self.data_crc32c = v.map(|x| x.into());
16702 self
16703 }
16704}
16705
16706impl wkt::message::Message for GenerateRandomBytesResponse {
16707 fn typename() -> &'static str {
16708 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
16709 }
16710}
16711
16712/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
16713///
16714/// [google.cloud.kms.v1.Digest]: crate::model::Digest
16715#[derive(Clone, Default, PartialEq)]
16716#[non_exhaustive]
16717pub struct Digest {
16718 /// Required. The message digest.
16719 pub digest: std::option::Option<crate::model::digest::Digest>,
16720
16721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16722}
16723
16724impl Digest {
16725 pub fn new() -> Self {
16726 std::default::Default::default()
16727 }
16728
16729 /// Sets the value of [digest][crate::model::Digest::digest].
16730 ///
16731 /// Note that all the setters affecting `digest` are mutually
16732 /// exclusive.
16733 ///
16734 /// # Example
16735 /// ```ignore,no_run
16736 /// # use google_cloud_kms_v1::model::Digest;
16737 /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
16738 /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
16739 /// ```
16740 pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
16741 mut self,
16742 v: T,
16743 ) -> Self {
16744 self.digest = v.into();
16745 self
16746 }
16747
16748 /// The value of [digest][crate::model::Digest::digest]
16749 /// if it holds a `Sha256`, `None` if the field is not set or
16750 /// holds a different branch.
16751 pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
16752 #[allow(unreachable_patterns)]
16753 self.digest.as_ref().and_then(|v| match v {
16754 crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
16755 _ => std::option::Option::None,
16756 })
16757 }
16758
16759 /// Sets the value of [digest][crate::model::Digest::digest]
16760 /// to hold a `Sha256`.
16761 ///
16762 /// Note that all the setters affecting `digest` are
16763 /// mutually exclusive.
16764 ///
16765 /// # Example
16766 /// ```ignore,no_run
16767 /// # use google_cloud_kms_v1::model::Digest;
16768 /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
16769 /// assert!(x.sha256().is_some());
16770 /// assert!(x.sha384().is_none());
16771 /// assert!(x.sha512().is_none());
16772 /// ```
16773 pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16774 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
16775 self
16776 }
16777
16778 /// The value of [digest][crate::model::Digest::digest]
16779 /// if it holds a `Sha384`, `None` if the field is not set or
16780 /// holds a different branch.
16781 pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
16782 #[allow(unreachable_patterns)]
16783 self.digest.as_ref().and_then(|v| match v {
16784 crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
16785 _ => std::option::Option::None,
16786 })
16787 }
16788
16789 /// Sets the value of [digest][crate::model::Digest::digest]
16790 /// to hold a `Sha384`.
16791 ///
16792 /// Note that all the setters affecting `digest` are
16793 /// mutually exclusive.
16794 ///
16795 /// # Example
16796 /// ```ignore,no_run
16797 /// # use google_cloud_kms_v1::model::Digest;
16798 /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
16799 /// assert!(x.sha384().is_some());
16800 /// assert!(x.sha256().is_none());
16801 /// assert!(x.sha512().is_none());
16802 /// ```
16803 pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16804 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
16805 self
16806 }
16807
16808 /// The value of [digest][crate::model::Digest::digest]
16809 /// if it holds a `Sha512`, `None` if the field is not set or
16810 /// holds a different branch.
16811 pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
16812 #[allow(unreachable_patterns)]
16813 self.digest.as_ref().and_then(|v| match v {
16814 crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
16815 _ => std::option::Option::None,
16816 })
16817 }
16818
16819 /// Sets the value of [digest][crate::model::Digest::digest]
16820 /// to hold a `Sha512`.
16821 ///
16822 /// Note that all the setters affecting `digest` are
16823 /// mutually exclusive.
16824 ///
16825 /// # Example
16826 /// ```ignore,no_run
16827 /// # use google_cloud_kms_v1::model::Digest;
16828 /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
16829 /// assert!(x.sha512().is_some());
16830 /// assert!(x.sha256().is_none());
16831 /// assert!(x.sha384().is_none());
16832 /// ```
16833 pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16834 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
16835 self
16836 }
16837}
16838
16839impl wkt::message::Message for Digest {
16840 fn typename() -> &'static str {
16841 "type.googleapis.com/google.cloud.kms.v1.Digest"
16842 }
16843}
16844
16845/// Defines additional types related to [Digest].
16846pub mod digest {
16847 #[allow(unused_imports)]
16848 use super::*;
16849
16850 /// Required. The message digest.
16851 #[derive(Clone, Debug, PartialEq)]
16852 #[non_exhaustive]
16853 pub enum Digest {
16854 /// A message digest produced with the SHA-256 algorithm.
16855 Sha256(::bytes::Bytes),
16856 /// A message digest produced with the SHA-384 algorithm.
16857 Sha384(::bytes::Bytes),
16858 /// A message digest produced with the SHA-512 algorithm.
16859 Sha512(::bytes::Bytes),
16860 }
16861}
16862
16863/// Cloud KMS metadata for the given
16864/// [google.cloud.location.Location][google.cloud.location.Location].
16865///
16866/// [google.cloud.location.Location]: google_cloud_location::model::Location
16867#[derive(Clone, Default, PartialEq)]
16868#[non_exhaustive]
16869pub struct LocationMetadata {
16870 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16871 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16872 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
16873 /// location.
16874 ///
16875 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16876 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16877 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
16878 pub hsm_available: bool,
16879
16880 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16881 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16882 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
16883 /// this location.
16884 ///
16885 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16886 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16887 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
16888 pub ekm_available: bool,
16889
16890 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
16891 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
16892 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
16893 /// can be created in this location.
16894 ///
16895 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
16896 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
16897 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
16898 pub hsm_single_tenant_available: bool,
16899
16900 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16901}
16902
16903impl LocationMetadata {
16904 pub fn new() -> Self {
16905 std::default::Default::default()
16906 }
16907
16908 /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
16909 ///
16910 /// # Example
16911 /// ```ignore,no_run
16912 /// # use google_cloud_kms_v1::model::LocationMetadata;
16913 /// let x = LocationMetadata::new().set_hsm_available(true);
16914 /// ```
16915 pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16916 self.hsm_available = v.into();
16917 self
16918 }
16919
16920 /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
16921 ///
16922 /// # Example
16923 /// ```ignore,no_run
16924 /// # use google_cloud_kms_v1::model::LocationMetadata;
16925 /// let x = LocationMetadata::new().set_ekm_available(true);
16926 /// ```
16927 pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16928 self.ekm_available = v.into();
16929 self
16930 }
16931
16932 /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
16933 ///
16934 /// # Example
16935 /// ```ignore,no_run
16936 /// # use google_cloud_kms_v1::model::LocationMetadata;
16937 /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
16938 /// ```
16939 pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16940 self.hsm_single_tenant_available = v.into();
16941 self
16942 }
16943}
16944
16945impl wkt::message::Message for LocationMetadata {
16946 fn typename() -> &'static str {
16947 "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
16948 }
16949}
16950
16951/// Represents the metadata of the
16952/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]
16953/// long-running operation.
16954///
16955/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
16956#[derive(Clone, Default, PartialEq)]
16957#[non_exhaustive]
16958pub struct DeleteCryptoKeyMetadata {
16959 /// Output only. The resource name of the
16960 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] created as a result
16961 /// of this operation, in the format
16962 /// `projects/*/locations/*/retiredResources/*`.
16963 ///
16964 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
16965 pub retired_resource: std::string::String,
16966
16967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16968}
16969
16970impl DeleteCryptoKeyMetadata {
16971 pub fn new() -> Self {
16972 std::default::Default::default()
16973 }
16974
16975 /// Sets the value of [retired_resource][crate::model::DeleteCryptoKeyMetadata::retired_resource].
16976 ///
16977 /// # Example
16978 /// ```ignore,no_run
16979 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyMetadata;
16980 /// let x = DeleteCryptoKeyMetadata::new().set_retired_resource("example");
16981 /// ```
16982 pub fn set_retired_resource<T: std::convert::Into<std::string::String>>(
16983 mut self,
16984 v: T,
16985 ) -> Self {
16986 self.retired_resource = v.into();
16987 self
16988 }
16989}
16990
16991impl wkt::message::Message for DeleteCryptoKeyMetadata {
16992 fn typename() -> &'static str {
16993 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyMetadata"
16994 }
16995}
16996
16997/// Represents the metadata of the
16998/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]
16999/// long-running operation.
17000///
17001/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
17002#[derive(Clone, Default, PartialEq)]
17003#[non_exhaustive]
17004pub struct DeleteCryptoKeyVersionMetadata {
17005 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17006}
17007
17008impl DeleteCryptoKeyVersionMetadata {
17009 pub fn new() -> Self {
17010 std::default::Default::default()
17011 }
17012}
17013
17014impl wkt::message::Message for DeleteCryptoKeyVersionMetadata {
17015 fn typename() -> &'static str {
17016 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionMetadata"
17017 }
17018}
17019
17020/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
17021/// cryptographic operations are performed. For more information, see [Protection
17022/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
17023///
17024/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17025///
17026/// # Working with unknown values
17027///
17028/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17029/// additional enum variants at any time. Adding new variants is not considered
17030/// a breaking change. Applications should write their code in anticipation of:
17031///
17032/// - New values appearing in future releases of the client library, **and**
17033/// - New values received dynamically, without application changes.
17034///
17035/// Please consult the [Working with enums] section in the user guide for some
17036/// guidelines.
17037///
17038/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17039#[derive(Clone, Debug, PartialEq)]
17040#[non_exhaustive]
17041pub enum ProtectionLevel {
17042 /// Not specified.
17043 Unspecified,
17044 /// Crypto operations are performed in software.
17045 Software,
17046 /// Crypto operations are performed in a Hardware Security Module.
17047 Hsm,
17048 /// Crypto operations are performed by an external key manager.
17049 External,
17050 /// Crypto operations are performed in an EKM-over-VPC backend.
17051 ExternalVpc,
17052 /// Crypto operations are performed in a single-tenant HSM.
17053 HsmSingleTenant,
17054 /// If set, the enum was initialized with an unknown value.
17055 ///
17056 /// Applications can examine the value using [ProtectionLevel::value] or
17057 /// [ProtectionLevel::name].
17058 UnknownValue(protection_level::UnknownValue),
17059}
17060
17061#[doc(hidden)]
17062pub mod protection_level {
17063 #[allow(unused_imports)]
17064 use super::*;
17065 #[derive(Clone, Debug, PartialEq)]
17066 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17067}
17068
17069impl ProtectionLevel {
17070 /// Gets the enum value.
17071 ///
17072 /// Returns `None` if the enum contains an unknown value deserialized from
17073 /// the string representation of enums.
17074 pub fn value(&self) -> std::option::Option<i32> {
17075 match self {
17076 Self::Unspecified => std::option::Option::Some(0),
17077 Self::Software => std::option::Option::Some(1),
17078 Self::Hsm => std::option::Option::Some(2),
17079 Self::External => std::option::Option::Some(3),
17080 Self::ExternalVpc => std::option::Option::Some(4),
17081 Self::HsmSingleTenant => std::option::Option::Some(5),
17082 Self::UnknownValue(u) => u.0.value(),
17083 }
17084 }
17085
17086 /// Gets the enum value as a string.
17087 ///
17088 /// Returns `None` if the enum contains an unknown value deserialized from
17089 /// the integer representation of enums.
17090 pub fn name(&self) -> std::option::Option<&str> {
17091 match self {
17092 Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
17093 Self::Software => std::option::Option::Some("SOFTWARE"),
17094 Self::Hsm => std::option::Option::Some("HSM"),
17095 Self::External => std::option::Option::Some("EXTERNAL"),
17096 Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
17097 Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
17098 Self::UnknownValue(u) => u.0.name(),
17099 }
17100 }
17101}
17102
17103impl std::default::Default for ProtectionLevel {
17104 fn default() -> Self {
17105 use std::convert::From;
17106 Self::from(0)
17107 }
17108}
17109
17110impl std::fmt::Display for ProtectionLevel {
17111 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17112 wkt::internal::display_enum(f, self.name(), self.value())
17113 }
17114}
17115
17116impl std::convert::From<i32> for ProtectionLevel {
17117 fn from(value: i32) -> Self {
17118 match value {
17119 0 => Self::Unspecified,
17120 1 => Self::Software,
17121 2 => Self::Hsm,
17122 3 => Self::External,
17123 4 => Self::ExternalVpc,
17124 5 => Self::HsmSingleTenant,
17125 _ => Self::UnknownValue(protection_level::UnknownValue(
17126 wkt::internal::UnknownEnumValue::Integer(value),
17127 )),
17128 }
17129 }
17130}
17131
17132impl std::convert::From<&str> for ProtectionLevel {
17133 fn from(value: &str) -> Self {
17134 use std::string::ToString;
17135 match value {
17136 "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
17137 "SOFTWARE" => Self::Software,
17138 "HSM" => Self::Hsm,
17139 "EXTERNAL" => Self::External,
17140 "EXTERNAL_VPC" => Self::ExternalVpc,
17141 "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
17142 _ => Self::UnknownValue(protection_level::UnknownValue(
17143 wkt::internal::UnknownEnumValue::String(value.to_string()),
17144 )),
17145 }
17146 }
17147}
17148
17149impl serde::ser::Serialize for ProtectionLevel {
17150 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17151 where
17152 S: serde::Serializer,
17153 {
17154 match self {
17155 Self::Unspecified => serializer.serialize_i32(0),
17156 Self::Software => serializer.serialize_i32(1),
17157 Self::Hsm => serializer.serialize_i32(2),
17158 Self::External => serializer.serialize_i32(3),
17159 Self::ExternalVpc => serializer.serialize_i32(4),
17160 Self::HsmSingleTenant => serializer.serialize_i32(5),
17161 Self::UnknownValue(u) => u.0.serialize(serializer),
17162 }
17163 }
17164}
17165
17166impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
17167 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17168 where
17169 D: serde::Deserializer<'de>,
17170 {
17171 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
17172 ".google.cloud.kms.v1.ProtectionLevel",
17173 ))
17174 }
17175}
17176
17177/// Describes the reason for a data access. Please refer to
17178/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
17179/// for the detailed semantic meaning of justification reason codes.
17180///
17181/// # Working with unknown values
17182///
17183/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17184/// additional enum variants at any time. Adding new variants is not considered
17185/// a breaking change. Applications should write their code in anticipation of:
17186///
17187/// - New values appearing in future releases of the client library, **and**
17188/// - New values received dynamically, without application changes.
17189///
17190/// Please consult the [Working with enums] section in the user guide for some
17191/// guidelines.
17192///
17193/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17194#[derive(Clone, Debug, PartialEq)]
17195#[non_exhaustive]
17196pub enum AccessReason {
17197 /// Unspecified access reason.
17198 ReasonUnspecified,
17199 /// Customer-initiated support.
17200 CustomerInitiatedSupport,
17201 /// Google-initiated access for system management and troubleshooting.
17202 GoogleInitiatedService,
17203 /// Google-initiated access in response to a legal request or legal process.
17204 ThirdPartyDataRequest,
17205 /// Google-initiated access for security, fraud, abuse, or compliance purposes.
17206 GoogleInitiatedReview,
17207 /// Customer uses their account to perform any access to their own data which
17208 /// their IAM policy authorizes.
17209 CustomerInitiatedAccess,
17210 /// Google systems access customer data to help optimize the structure of the
17211 /// data or quality for future uses by the customer.
17212 GoogleInitiatedSystemOperation,
17213 /// No reason is expected for this key request.
17214 ReasonNotExpected,
17215 /// Deprecated: This code is no longer generated by
17216 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17217 /// available in both Key Access Justifications and Access Transparency logs
17218 /// provide customer-visible signals of emergency access in more precise
17219 /// contexts.
17220 ///
17221 /// Customer uses their account to perform any access to their own data which
17222 /// their IAM policy authorizes, and one of the following is true:
17223 ///
17224 /// * A Google administrator has reset the root-access account associated with
17225 /// the user's organization within the past 7 days.
17226 /// * A Google-initiated emergency access operation has interacted with a
17227 /// resource in the same project or folder as the currently accessed resource
17228 /// within the past 7 days.
17229 #[deprecated]
17230 ModifiedCustomerInitiatedAccess,
17231 /// Deprecated: This code is no longer generated by
17232 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17233 /// available in both Key Access Justifications and Access Transparency logs
17234 /// provide customer-visible signals of emergency access in more precise
17235 /// contexts.
17236 ///
17237 /// Google systems access customer data to help optimize the structure of the
17238 /// data or quality for future uses by the customer, and one of the following
17239 /// is true:
17240 ///
17241 /// * A Google administrator has reset the root-access account associated with
17242 /// the user's organization within the past 7 days.
17243 /// * A Google-initiated emergency access operation has interacted with a
17244 /// resource in the same project or folder as the currently accessed resource
17245 /// within the past 7 days.
17246 #[deprecated]
17247 ModifiedGoogleInitiatedSystemOperation,
17248 /// Google-initiated access to maintain system reliability.
17249 GoogleResponseToProductionAlert,
17250 /// One of the following operations is being executed while simultaneously
17251 /// encountering an internal technical issue which prevented a more precise
17252 /// justification code from being generated:
17253 ///
17254 /// * Your account has been used to perform any access to your own data which
17255 /// your IAM policy authorizes.
17256 /// * An automated Google system operates on encrypted customer data which your
17257 /// IAM policy authorizes.
17258 /// * Customer-initiated Google support access.
17259 /// * Google-initiated support access to protect system reliability.
17260 CustomerAuthorizedWorkflowServicing,
17261 /// If set, the enum was initialized with an unknown value.
17262 ///
17263 /// Applications can examine the value using [AccessReason::value] or
17264 /// [AccessReason::name].
17265 UnknownValue(access_reason::UnknownValue),
17266}
17267
17268#[doc(hidden)]
17269pub mod access_reason {
17270 #[allow(unused_imports)]
17271 use super::*;
17272 #[derive(Clone, Debug, PartialEq)]
17273 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17274}
17275
17276impl AccessReason {
17277 /// Gets the enum value.
17278 ///
17279 /// Returns `None` if the enum contains an unknown value deserialized from
17280 /// the string representation of enums.
17281 pub fn value(&self) -> std::option::Option<i32> {
17282 match self {
17283 Self::ReasonUnspecified => std::option::Option::Some(0),
17284 Self::CustomerInitiatedSupport => std::option::Option::Some(1),
17285 Self::GoogleInitiatedService => std::option::Option::Some(2),
17286 Self::ThirdPartyDataRequest => std::option::Option::Some(3),
17287 Self::GoogleInitiatedReview => std::option::Option::Some(4),
17288 Self::CustomerInitiatedAccess => std::option::Option::Some(5),
17289 Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
17290 Self::ReasonNotExpected => std::option::Option::Some(7),
17291 Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
17292 Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
17293 Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
17294 Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
17295 Self::UnknownValue(u) => u.0.value(),
17296 }
17297 }
17298
17299 /// Gets the enum value as a string.
17300 ///
17301 /// Returns `None` if the enum contains an unknown value deserialized from
17302 /// the integer representation of enums.
17303 pub fn name(&self) -> std::option::Option<&str> {
17304 match self {
17305 Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
17306 Self::CustomerInitiatedSupport => {
17307 std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
17308 }
17309 Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
17310 Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
17311 Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
17312 Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
17313 Self::GoogleInitiatedSystemOperation => {
17314 std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
17315 }
17316 Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
17317 Self::ModifiedCustomerInitiatedAccess => {
17318 std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
17319 }
17320 Self::ModifiedGoogleInitiatedSystemOperation => {
17321 std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
17322 }
17323 Self::GoogleResponseToProductionAlert => {
17324 std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
17325 }
17326 Self::CustomerAuthorizedWorkflowServicing => {
17327 std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
17328 }
17329 Self::UnknownValue(u) => u.0.name(),
17330 }
17331 }
17332}
17333
17334impl std::default::Default for AccessReason {
17335 fn default() -> Self {
17336 use std::convert::From;
17337 Self::from(0)
17338 }
17339}
17340
17341impl std::fmt::Display for AccessReason {
17342 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17343 wkt::internal::display_enum(f, self.name(), self.value())
17344 }
17345}
17346
17347impl std::convert::From<i32> for AccessReason {
17348 fn from(value: i32) -> Self {
17349 match value {
17350 0 => Self::ReasonUnspecified,
17351 1 => Self::CustomerInitiatedSupport,
17352 2 => Self::GoogleInitiatedService,
17353 3 => Self::ThirdPartyDataRequest,
17354 4 => Self::GoogleInitiatedReview,
17355 5 => Self::CustomerInitiatedAccess,
17356 6 => Self::GoogleInitiatedSystemOperation,
17357 7 => Self::ReasonNotExpected,
17358 8 => Self::ModifiedCustomerInitiatedAccess,
17359 9 => Self::ModifiedGoogleInitiatedSystemOperation,
17360 10 => Self::GoogleResponseToProductionAlert,
17361 11 => Self::CustomerAuthorizedWorkflowServicing,
17362 _ => Self::UnknownValue(access_reason::UnknownValue(
17363 wkt::internal::UnknownEnumValue::Integer(value),
17364 )),
17365 }
17366 }
17367}
17368
17369impl std::convert::From<&str> for AccessReason {
17370 fn from(value: &str) -> Self {
17371 use std::string::ToString;
17372 match value {
17373 "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
17374 "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
17375 "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
17376 "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
17377 "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
17378 "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
17379 "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
17380 "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
17381 "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
17382 "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
17383 Self::ModifiedGoogleInitiatedSystemOperation
17384 }
17385 "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
17386 "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
17387 _ => Self::UnknownValue(access_reason::UnknownValue(
17388 wkt::internal::UnknownEnumValue::String(value.to_string()),
17389 )),
17390 }
17391 }
17392}
17393
17394impl serde::ser::Serialize for AccessReason {
17395 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17396 where
17397 S: serde::Serializer,
17398 {
17399 match self {
17400 Self::ReasonUnspecified => serializer.serialize_i32(0),
17401 Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
17402 Self::GoogleInitiatedService => serializer.serialize_i32(2),
17403 Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
17404 Self::GoogleInitiatedReview => serializer.serialize_i32(4),
17405 Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
17406 Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
17407 Self::ReasonNotExpected => serializer.serialize_i32(7),
17408 Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
17409 Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
17410 Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
17411 Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
17412 Self::UnknownValue(u) => u.0.serialize(serializer),
17413 }
17414 }
17415}
17416
17417impl<'de> serde::de::Deserialize<'de> for AccessReason {
17418 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17419 where
17420 D: serde::Deserializer<'de>,
17421 {
17422 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
17423 ".google.cloud.kms.v1.AccessReason",
17424 ))
17425 }
17426}