google_cloud_kms_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_iam_v1;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// Request message for
40/// [Autokey.CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle].
41///
42/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct CreateKeyHandleRequest {
46 /// Required. Name of the resource project and location to create the
47 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g.
48 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
49 ///
50 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
51 pub parent: std::string::String,
52
53 /// Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be
54 /// unique to the resource project and location. If not provided by the caller,
55 /// a new UUID is used.
56 ///
57 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
58 pub key_handle_id: std::string::String,
59
60 /// Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.
61 ///
62 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
63 pub key_handle: std::option::Option<crate::model::KeyHandle>,
64
65 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
66}
67
68impl CreateKeyHandleRequest {
69 /// Creates a new default instance.
70 pub fn new() -> Self {
71 std::default::Default::default()
72 }
73
74 /// Sets the value of [parent][crate::model::CreateKeyHandleRequest::parent].
75 ///
76 /// # Example
77 /// ```ignore,no_run
78 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
79 /// let x = CreateKeyHandleRequest::new().set_parent("example");
80 /// ```
81 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
82 self.parent = v.into();
83 self
84 }
85
86 /// Sets the value of [key_handle_id][crate::model::CreateKeyHandleRequest::key_handle_id].
87 ///
88 /// # Example
89 /// ```ignore,no_run
90 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
91 /// let x = CreateKeyHandleRequest::new().set_key_handle_id("example");
92 /// ```
93 pub fn set_key_handle_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
94 self.key_handle_id = v.into();
95 self
96 }
97
98 /// Sets the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
99 ///
100 /// # Example
101 /// ```ignore,no_run
102 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
103 /// use google_cloud_kms_v1::model::KeyHandle;
104 /// let x = CreateKeyHandleRequest::new().set_key_handle(KeyHandle::default()/* use setters */);
105 /// ```
106 pub fn set_key_handle<T>(mut self, v: T) -> Self
107 where
108 T: std::convert::Into<crate::model::KeyHandle>,
109 {
110 self.key_handle = std::option::Option::Some(v.into());
111 self
112 }
113
114 /// Sets or clears the value of [key_handle][crate::model::CreateKeyHandleRequest::key_handle].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_kms_v1::model::CreateKeyHandleRequest;
119 /// use google_cloud_kms_v1::model::KeyHandle;
120 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(Some(KeyHandle::default()/* use setters */));
121 /// let x = CreateKeyHandleRequest::new().set_or_clear_key_handle(None::<KeyHandle>);
122 /// ```
123 pub fn set_or_clear_key_handle<T>(mut self, v: std::option::Option<T>) -> Self
124 where
125 T: std::convert::Into<crate::model::KeyHandle>,
126 {
127 self.key_handle = v.map(|x| x.into());
128 self
129 }
130}
131
132impl wkt::message::Message for CreateKeyHandleRequest {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleRequest"
135 }
136}
137
138/// Request message for [GetKeyHandle][google.cloud.kms.v1.Autokey.GetKeyHandle].
139///
140/// [google.cloud.kms.v1.Autokey.GetKeyHandle]: crate::client::Autokey::get_key_handle
141#[derive(Clone, Default, PartialEq)]
142#[non_exhaustive]
143pub struct GetKeyHandleRequest {
144 /// Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource,
145 /// e.g.
146 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
147 ///
148 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
149 pub name: std::string::String,
150
151 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
152}
153
154impl GetKeyHandleRequest {
155 /// Creates a new default instance.
156 pub fn new() -> Self {
157 std::default::Default::default()
158 }
159
160 /// Sets the value of [name][crate::model::GetKeyHandleRequest::name].
161 ///
162 /// # Example
163 /// ```ignore,no_run
164 /// # use google_cloud_kms_v1::model::GetKeyHandleRequest;
165 /// # let project_id = "project_id";
166 /// # let location_id = "location_id";
167 /// # let key_handle_id = "key_handle_id";
168 /// let x = GetKeyHandleRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyHandles/{key_handle_id}"));
169 /// ```
170 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
171 self.name = v.into();
172 self
173 }
174}
175
176impl wkt::message::Message for GetKeyHandleRequest {
177 fn typename() -> &'static str {
178 "type.googleapis.com/google.cloud.kms.v1.GetKeyHandleRequest"
179 }
180}
181
182/// Resource-oriented representation of a request to Cloud KMS Autokey and the
183/// resulting provisioning of a [CryptoKey][google.cloud.kms.v1.CryptoKey].
184///
185/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
186#[derive(Clone, Default, PartialEq)]
187#[non_exhaustive]
188pub struct KeyHandle {
189 /// Identifier. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle]
190 /// resource, e.g.
191 /// `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
192 ///
193 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
194 pub name: std::string::String,
195
196 /// Output only. Name of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that has
197 /// been provisioned for Customer Managed Encryption Key (CMEK) use in the
198 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] project and location for the
199 /// requested resource type. The [CryptoKey][google.cloud.kms.v1.CryptoKey]
200 /// project will reflect the value configured in the
201 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] on the resource
202 /// project's ancestor folder at the time of the
203 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] creation. If more than one
204 /// ancestor folder has a configured
205 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig], the nearest of these
206 /// configurations is used.
207 ///
208 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
209 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
210 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
211 pub kms_key: std::string::String,
212
213 /// Required. Indicates the resource type that the resulting
214 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is meant to protect, e.g.
215 /// `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
216 /// types.
217 ///
218 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
219 pub resource_type_selector: std::string::String,
220
221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
222}
223
224impl KeyHandle {
225 /// Creates a new default instance.
226 pub fn new() -> Self {
227 std::default::Default::default()
228 }
229
230 /// Sets the value of [name][crate::model::KeyHandle::name].
231 ///
232 /// # Example
233 /// ```ignore,no_run
234 /// # use google_cloud_kms_v1::model::KeyHandle;
235 /// # let project_id = "project_id";
236 /// # let location_id = "location_id";
237 /// # let key_handle_id = "key_handle_id";
238 /// let x = KeyHandle::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyHandles/{key_handle_id}"));
239 /// ```
240 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
241 self.name = v.into();
242 self
243 }
244
245 /// Sets the value of [kms_key][crate::model::KeyHandle::kms_key].
246 ///
247 /// # Example
248 /// ```ignore,no_run
249 /// # use google_cloud_kms_v1::model::KeyHandle;
250 /// # let project_id = "project_id";
251 /// # let location_id = "location_id";
252 /// # let key_ring_id = "key_ring_id";
253 /// # let crypto_key_id = "crypto_key_id";
254 /// let x = KeyHandle::new().set_kms_key(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
255 /// ```
256 pub fn set_kms_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
257 self.kms_key = v.into();
258 self
259 }
260
261 /// Sets the value of [resource_type_selector][crate::model::KeyHandle::resource_type_selector].
262 ///
263 /// # Example
264 /// ```ignore,no_run
265 /// # use google_cloud_kms_v1::model::KeyHandle;
266 /// let x = KeyHandle::new().set_resource_type_selector("example");
267 /// ```
268 pub fn set_resource_type_selector<T: std::convert::Into<std::string::String>>(
269 mut self,
270 v: T,
271 ) -> Self {
272 self.resource_type_selector = v.into();
273 self
274 }
275}
276
277impl wkt::message::Message for KeyHandle {
278 fn typename() -> &'static str {
279 "type.googleapis.com/google.cloud.kms.v1.KeyHandle"
280 }
281}
282
283/// Metadata message for
284/// [CreateKeyHandle][google.cloud.kms.v1.Autokey.CreateKeyHandle] long-running
285/// operation response.
286///
287/// [google.cloud.kms.v1.Autokey.CreateKeyHandle]: crate::client::Autokey::create_key_handle
288#[derive(Clone, Default, PartialEq)]
289#[non_exhaustive]
290pub struct CreateKeyHandleMetadata {
291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
292}
293
294impl CreateKeyHandleMetadata {
295 /// Creates a new default instance.
296 pub fn new() -> Self {
297 std::default::Default::default()
298 }
299}
300
301impl wkt::message::Message for CreateKeyHandleMetadata {
302 fn typename() -> &'static str {
303 "type.googleapis.com/google.cloud.kms.v1.CreateKeyHandleMetadata"
304 }
305}
306
307/// Request message for
308/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
309///
310/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
311#[derive(Clone, Default, PartialEq)]
312#[non_exhaustive]
313pub struct ListKeyHandlesRequest {
314 /// Required. Name of the resource project and location from which to list
315 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
316 /// `projects/{PROJECT_ID}/locations/{LOCATION}`.
317 ///
318 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
319 pub parent: std::string::String,
320
321 /// Optional. Optional limit on the number of
322 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] to include in the response. The
323 /// service may return fewer than this value. Further
324 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] can subsequently be obtained by
325 /// including the
326 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]
327 /// in a subsequent request. If unspecified, at most 100
328 /// [KeyHandles][google.cloud.kms.v1.KeyHandle] will be returned.
329 ///
330 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
331 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
332 pub page_size: i32,
333
334 /// Optional. Optional pagination token, returned earlier via
335 /// [ListKeyHandlesResponse.next_page_token][google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token].
336 ///
337 /// [google.cloud.kms.v1.ListKeyHandlesResponse.next_page_token]: crate::model::ListKeyHandlesResponse::next_page_token
338 pub page_token: std::string::String,
339
340 /// Optional. Filter to apply when listing
341 /// [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g.
342 /// `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
343 ///
344 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
345 pub filter: std::string::String,
346
347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
348}
349
350impl ListKeyHandlesRequest {
351 /// Creates a new default instance.
352 pub fn new() -> Self {
353 std::default::Default::default()
354 }
355
356 /// Sets the value of [parent][crate::model::ListKeyHandlesRequest::parent].
357 ///
358 /// # Example
359 /// ```ignore,no_run
360 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
361 /// let x = ListKeyHandlesRequest::new().set_parent("example");
362 /// ```
363 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
364 self.parent = v.into();
365 self
366 }
367
368 /// Sets the value of [page_size][crate::model::ListKeyHandlesRequest::page_size].
369 ///
370 /// # Example
371 /// ```ignore,no_run
372 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
373 /// let x = ListKeyHandlesRequest::new().set_page_size(42);
374 /// ```
375 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
376 self.page_size = v.into();
377 self
378 }
379
380 /// Sets the value of [page_token][crate::model::ListKeyHandlesRequest::page_token].
381 ///
382 /// # Example
383 /// ```ignore,no_run
384 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
385 /// let x = ListKeyHandlesRequest::new().set_page_token("example");
386 /// ```
387 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
388 self.page_token = v.into();
389 self
390 }
391
392 /// Sets the value of [filter][crate::model::ListKeyHandlesRequest::filter].
393 ///
394 /// # Example
395 /// ```ignore,no_run
396 /// # use google_cloud_kms_v1::model::ListKeyHandlesRequest;
397 /// let x = ListKeyHandlesRequest::new().set_filter("example");
398 /// ```
399 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
400 self.filter = v.into();
401 self
402 }
403}
404
405impl wkt::message::Message for ListKeyHandlesRequest {
406 fn typename() -> &'static str {
407 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesRequest"
408 }
409}
410
411/// Response message for
412/// [Autokey.ListKeyHandles][google.cloud.kms.v1.Autokey.ListKeyHandles].
413///
414/// [google.cloud.kms.v1.Autokey.ListKeyHandles]: crate::client::Autokey::list_key_handles
415#[derive(Clone, Default, PartialEq)]
416#[non_exhaustive]
417pub struct ListKeyHandlesResponse {
418 /// Resulting [KeyHandles][google.cloud.kms.v1.KeyHandle].
419 ///
420 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
421 pub key_handles: std::vec::Vec<crate::model::KeyHandle>,
422
423 /// A token to retrieve next page of results. Pass this value in
424 /// [ListKeyHandlesRequest.page_token][google.cloud.kms.v1.ListKeyHandlesRequest.page_token]
425 /// to retrieve the next page of results.
426 ///
427 /// [google.cloud.kms.v1.ListKeyHandlesRequest.page_token]: crate::model::ListKeyHandlesRequest::page_token
428 pub next_page_token: std::string::String,
429
430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
431}
432
433impl ListKeyHandlesResponse {
434 /// Creates a new default instance.
435 pub fn new() -> Self {
436 std::default::Default::default()
437 }
438
439 /// Sets the value of [key_handles][crate::model::ListKeyHandlesResponse::key_handles].
440 ///
441 /// # Example
442 /// ```ignore,no_run
443 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
444 /// use google_cloud_kms_v1::model::KeyHandle;
445 /// let x = ListKeyHandlesResponse::new()
446 /// .set_key_handles([
447 /// KeyHandle::default()/* use setters */,
448 /// KeyHandle::default()/* use (different) setters */,
449 /// ]);
450 /// ```
451 pub fn set_key_handles<T, V>(mut self, v: T) -> Self
452 where
453 T: std::iter::IntoIterator<Item = V>,
454 V: std::convert::Into<crate::model::KeyHandle>,
455 {
456 use std::iter::Iterator;
457 self.key_handles = v.into_iter().map(|i| i.into()).collect();
458 self
459 }
460
461 /// Sets the value of [next_page_token][crate::model::ListKeyHandlesResponse::next_page_token].
462 ///
463 /// # Example
464 /// ```ignore,no_run
465 /// # use google_cloud_kms_v1::model::ListKeyHandlesResponse;
466 /// let x = ListKeyHandlesResponse::new().set_next_page_token("example");
467 /// ```
468 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
469 self.next_page_token = v.into();
470 self
471 }
472}
473
474impl wkt::message::Message for ListKeyHandlesResponse {
475 fn typename() -> &'static str {
476 "type.googleapis.com/google.cloud.kms.v1.ListKeyHandlesResponse"
477 }
478}
479
480#[doc(hidden)]
481impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyHandlesResponse {
482 type PageItem = crate::model::KeyHandle;
483
484 fn items(self) -> std::vec::Vec<Self::PageItem> {
485 self.key_handles
486 }
487
488 fn next_page_token(&self) -> std::string::String {
489 use std::clone::Clone;
490 self.next_page_token.clone()
491 }
492}
493
494/// Request message for
495/// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig].
496///
497/// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
498#[derive(Clone, Default, PartialEq)]
499#[non_exhaustive]
500pub struct UpdateAutokeyConfigRequest {
501 /// Required. [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] with values to
502 /// update.
503 ///
504 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
505 pub autokey_config: std::option::Option<crate::model::AutokeyConfig>,
506
507 /// Required. Masks which fields of the
508 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] to update, e.g.
509 /// `keyProject`.
510 ///
511 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
512 pub update_mask: std::option::Option<wkt::FieldMask>,
513
514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
515}
516
517impl UpdateAutokeyConfigRequest {
518 /// Creates a new default instance.
519 pub fn new() -> Self {
520 std::default::Default::default()
521 }
522
523 /// Sets 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_autokey_config(AutokeyConfig::default()/* use setters */);
530 /// ```
531 pub fn set_autokey_config<T>(mut self, v: T) -> Self
532 where
533 T: std::convert::Into<crate::model::AutokeyConfig>,
534 {
535 self.autokey_config = std::option::Option::Some(v.into());
536 self
537 }
538
539 /// Sets or clears the value of [autokey_config][crate::model::UpdateAutokeyConfigRequest::autokey_config].
540 ///
541 /// # Example
542 /// ```ignore,no_run
543 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
544 /// use google_cloud_kms_v1::model::AutokeyConfig;
545 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(Some(AutokeyConfig::default()/* use setters */));
546 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_autokey_config(None::<AutokeyConfig>);
547 /// ```
548 pub fn set_or_clear_autokey_config<T>(mut self, v: std::option::Option<T>) -> Self
549 where
550 T: std::convert::Into<crate::model::AutokeyConfig>,
551 {
552 self.autokey_config = v.map(|x| x.into());
553 self
554 }
555
556 /// Sets 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_update_mask(FieldMask::default()/* use setters */);
563 /// ```
564 pub fn set_update_mask<T>(mut self, v: T) -> Self
565 where
566 T: std::convert::Into<wkt::FieldMask>,
567 {
568 self.update_mask = std::option::Option::Some(v.into());
569 self
570 }
571
572 /// Sets or clears the value of [update_mask][crate::model::UpdateAutokeyConfigRequest::update_mask].
573 ///
574 /// # Example
575 /// ```ignore,no_run
576 /// # use google_cloud_kms_v1::model::UpdateAutokeyConfigRequest;
577 /// use wkt::FieldMask;
578 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
579 /// let x = UpdateAutokeyConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
580 /// ```
581 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
582 where
583 T: std::convert::Into<wkt::FieldMask>,
584 {
585 self.update_mask = v.map(|x| x.into());
586 self
587 }
588}
589
590impl wkt::message::Message for UpdateAutokeyConfigRequest {
591 fn typename() -> &'static str {
592 "type.googleapis.com/google.cloud.kms.v1.UpdateAutokeyConfigRequest"
593 }
594}
595
596/// Request message for
597/// [GetAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig].
598///
599/// [google.cloud.kms.v1.AutokeyAdmin.GetAutokeyConfig]: crate::client::AutokeyAdmin::get_autokey_config
600#[derive(Clone, Default, PartialEq)]
601#[non_exhaustive]
602pub struct GetAutokeyConfigRequest {
603 /// Required. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
604 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
605 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
606 ///
607 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
608 pub name: std::string::String,
609
610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
611}
612
613impl GetAutokeyConfigRequest {
614 /// Creates a new default instance.
615 pub fn new() -> Self {
616 std::default::Default::default()
617 }
618
619 /// Sets the value of [name][crate::model::GetAutokeyConfigRequest::name].
620 ///
621 /// # Example
622 /// ```ignore,no_run
623 /// # use google_cloud_kms_v1::model::GetAutokeyConfigRequest;
624 /// # let folder_id = "folder_id";
625 /// let x = GetAutokeyConfigRequest::new().set_name(format!("folders/{folder_id}/autokeyConfig"));
626 /// ```
627 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
628 self.name = v.into();
629 self
630 }
631}
632
633impl wkt::message::Message for GetAutokeyConfigRequest {
634 fn typename() -> &'static str {
635 "type.googleapis.com/google.cloud.kms.v1.GetAutokeyConfigRequest"
636 }
637}
638
639/// Cloud KMS Autokey configuration for a folder.
640#[derive(Clone, Default, PartialEq)]
641#[non_exhaustive]
642pub struct AutokeyConfig {
643 /// Identifier. Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
644 /// resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig` or
645 /// `projects/{PROJECT_NUMBER}/autokeyConfig`.
646 ///
647 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
648 pub name: std::string::String,
649
650 /// Optional. Name of the key project, e.g. `projects/{PROJECT_ID}` or
651 /// `projects/{PROJECT_NUMBER}`, where Cloud KMS Autokey will provision a new
652 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] when a
653 /// [KeyHandle][google.cloud.kms.v1.KeyHandle] is created. On
654 /// [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig],
655 /// the caller will require `cloudkms.cryptoKeys.setIamPolicy` permission on
656 /// this key project. Once configured, for Cloud KMS Autokey to function
657 /// properly, this key project must have the Cloud KMS API activated and the
658 /// Cloud KMS Service Agent for this key project must be granted the
659 /// `cloudkms.admin` role (or pertinent permissions). A request with an empty
660 /// key project field will clear the configuration.
661 ///
662 /// [google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig]: crate::client::AutokeyAdmin::update_autokey_config
663 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
664 /// [google.cloud.kms.v1.KeyHandle]: crate::model::KeyHandle
665 pub key_project: std::string::String,
666
667 /// Output only. The state for the AutokeyConfig.
668 pub state: crate::model::autokey_config::State,
669
670 /// Optional. A checksum computed by the server based on the value of other
671 /// fields. This may be sent on update requests to ensure that the client has
672 /// an up-to-date value before proceeding. The request will be rejected with an
673 /// ABORTED error on a mismatched etag.
674 pub etag: std::string::String,
675
676 /// Optional. KeyProjectResolutionMode for the AutokeyConfig.
677 /// Valid values are `DEDICATED_KEY_PROJECT`, `RESOURCE_PROJECT`, or
678 /// `DISABLED`.
679 pub key_project_resolution_mode: crate::model::autokey_config::KeyProjectResolutionMode,
680
681 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
682}
683
684impl AutokeyConfig {
685 /// Creates a new default instance.
686 pub fn new() -> Self {
687 std::default::Default::default()
688 }
689
690 /// Sets the value of [name][crate::model::AutokeyConfig::name].
691 ///
692 /// # Example
693 /// ```ignore,no_run
694 /// # use google_cloud_kms_v1::model::AutokeyConfig;
695 /// # let folder_id = "folder_id";
696 /// let x = AutokeyConfig::new().set_name(format!("folders/{folder_id}/autokeyConfig"));
697 /// ```
698 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
699 self.name = v.into();
700 self
701 }
702
703 /// Sets the value of [key_project][crate::model::AutokeyConfig::key_project].
704 ///
705 /// # Example
706 /// ```ignore,no_run
707 /// # use google_cloud_kms_v1::model::AutokeyConfig;
708 /// let x = AutokeyConfig::new().set_key_project("example");
709 /// ```
710 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
711 self.key_project = v.into();
712 self
713 }
714
715 /// Sets the value of [state][crate::model::AutokeyConfig::state].
716 ///
717 /// # Example
718 /// ```ignore,no_run
719 /// # use google_cloud_kms_v1::model::AutokeyConfig;
720 /// use google_cloud_kms_v1::model::autokey_config::State;
721 /// let x0 = AutokeyConfig::new().set_state(State::Active);
722 /// let x1 = AutokeyConfig::new().set_state(State::KeyProjectDeleted);
723 /// let x2 = AutokeyConfig::new().set_state(State::Uninitialized);
724 /// ```
725 pub fn set_state<T: std::convert::Into<crate::model::autokey_config::State>>(
726 mut self,
727 v: T,
728 ) -> Self {
729 self.state = v.into();
730 self
731 }
732
733 /// Sets the value of [etag][crate::model::AutokeyConfig::etag].
734 ///
735 /// # Example
736 /// ```ignore,no_run
737 /// # use google_cloud_kms_v1::model::AutokeyConfig;
738 /// let x = AutokeyConfig::new().set_etag("example");
739 /// ```
740 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
741 self.etag = v.into();
742 self
743 }
744
745 /// Sets the value of [key_project_resolution_mode][crate::model::AutokeyConfig::key_project_resolution_mode].
746 ///
747 /// # Example
748 /// ```ignore,no_run
749 /// # use google_cloud_kms_v1::model::AutokeyConfig;
750 /// use google_cloud_kms_v1::model::autokey_config::KeyProjectResolutionMode;
751 /// let x0 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::DedicatedKeyProject);
752 /// let x1 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::ResourceProject);
753 /// let x2 = AutokeyConfig::new().set_key_project_resolution_mode(KeyProjectResolutionMode::Disabled);
754 /// ```
755 pub fn set_key_project_resolution_mode<
756 T: std::convert::Into<crate::model::autokey_config::KeyProjectResolutionMode>,
757 >(
758 mut self,
759 v: T,
760 ) -> Self {
761 self.key_project_resolution_mode = v.into();
762 self
763 }
764}
765
766impl wkt::message::Message for AutokeyConfig {
767 fn typename() -> &'static str {
768 "type.googleapis.com/google.cloud.kms.v1.AutokeyConfig"
769 }
770}
771
772/// Defines additional types related to [AutokeyConfig].
773pub mod autokey_config {
774 #[allow(unused_imports)]
775 use super::*;
776
777 /// The states AutokeyConfig can be in.
778 ///
779 /// # Working with unknown values
780 ///
781 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
782 /// additional enum variants at any time. Adding new variants is not considered
783 /// a breaking change. Applications should write their code in anticipation of:
784 ///
785 /// - New values appearing in future releases of the client library, **and**
786 /// - New values received dynamically, without application changes.
787 ///
788 /// Please consult the [Working with enums] section in the user guide for some
789 /// guidelines.
790 ///
791 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
792 #[derive(Clone, Debug, PartialEq)]
793 #[non_exhaustive]
794 pub enum State {
795 /// The state of the AutokeyConfig is unspecified.
796 Unspecified,
797 /// The AutokeyConfig is currently active.
798 Active,
799 /// A previously configured key project has been deleted and the current
800 /// AutokeyConfig is unusable.
801 KeyProjectDeleted,
802 /// The AutokeyConfig is not yet initialized or has been reset to its default
803 /// uninitialized state.
804 Uninitialized,
805 /// The service account lacks the necessary permissions in the key project to
806 /// configure Autokey.
807 KeyProjectPermissionDenied,
808 /// If set, the enum was initialized with an unknown value.
809 ///
810 /// Applications can examine the value using [State::value] or
811 /// [State::name].
812 UnknownValue(state::UnknownValue),
813 }
814
815 #[doc(hidden)]
816 pub mod state {
817 #[allow(unused_imports)]
818 use super::*;
819 #[derive(Clone, Debug, PartialEq)]
820 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
821 }
822
823 impl State {
824 /// Gets the enum value.
825 ///
826 /// Returns `None` if the enum contains an unknown value deserialized from
827 /// the string representation of enums.
828 pub fn value(&self) -> std::option::Option<i32> {
829 match self {
830 Self::Unspecified => std::option::Option::Some(0),
831 Self::Active => std::option::Option::Some(1),
832 Self::KeyProjectDeleted => std::option::Option::Some(2),
833 Self::Uninitialized => std::option::Option::Some(3),
834 Self::KeyProjectPermissionDenied => std::option::Option::Some(4),
835 Self::UnknownValue(u) => u.0.value(),
836 }
837 }
838
839 /// Gets the enum value as a string.
840 ///
841 /// Returns `None` if the enum contains an unknown value deserialized from
842 /// the integer representation of enums.
843 pub fn name(&self) -> std::option::Option<&str> {
844 match self {
845 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
846 Self::Active => std::option::Option::Some("ACTIVE"),
847 Self::KeyProjectDeleted => std::option::Option::Some("KEY_PROJECT_DELETED"),
848 Self::Uninitialized => std::option::Option::Some("UNINITIALIZED"),
849 Self::KeyProjectPermissionDenied => {
850 std::option::Option::Some("KEY_PROJECT_PERMISSION_DENIED")
851 }
852 Self::UnknownValue(u) => u.0.name(),
853 }
854 }
855 }
856
857 impl std::default::Default for State {
858 fn default() -> Self {
859 use std::convert::From;
860 Self::from(0)
861 }
862 }
863
864 impl std::fmt::Display for State {
865 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
866 wkt::internal::display_enum(f, self.name(), self.value())
867 }
868 }
869
870 impl std::convert::From<i32> for State {
871 fn from(value: i32) -> Self {
872 match value {
873 0 => Self::Unspecified,
874 1 => Self::Active,
875 2 => Self::KeyProjectDeleted,
876 3 => Self::Uninitialized,
877 4 => Self::KeyProjectPermissionDenied,
878 _ => Self::UnknownValue(state::UnknownValue(
879 wkt::internal::UnknownEnumValue::Integer(value),
880 )),
881 }
882 }
883 }
884
885 impl std::convert::From<&str> for State {
886 fn from(value: &str) -> Self {
887 use std::string::ToString;
888 match value {
889 "STATE_UNSPECIFIED" => Self::Unspecified,
890 "ACTIVE" => Self::Active,
891 "KEY_PROJECT_DELETED" => Self::KeyProjectDeleted,
892 "UNINITIALIZED" => Self::Uninitialized,
893 "KEY_PROJECT_PERMISSION_DENIED" => Self::KeyProjectPermissionDenied,
894 _ => Self::UnknownValue(state::UnknownValue(
895 wkt::internal::UnknownEnumValue::String(value.to_string()),
896 )),
897 }
898 }
899 }
900
901 impl serde::ser::Serialize for State {
902 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
903 where
904 S: serde::Serializer,
905 {
906 match self {
907 Self::Unspecified => serializer.serialize_i32(0),
908 Self::Active => serializer.serialize_i32(1),
909 Self::KeyProjectDeleted => serializer.serialize_i32(2),
910 Self::Uninitialized => serializer.serialize_i32(3),
911 Self::KeyProjectPermissionDenied => serializer.serialize_i32(4),
912 Self::UnknownValue(u) => u.0.serialize(serializer),
913 }
914 }
915 }
916
917 impl<'de> serde::de::Deserialize<'de> for State {
918 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
919 where
920 D: serde::Deserializer<'de>,
921 {
922 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
923 ".google.cloud.kms.v1.AutokeyConfig.State",
924 ))
925 }
926 }
927
928 /// Defines the resolution mode enum for the key project.
929 /// The
930 /// [KeyProjectResolutionMode][google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]
931 /// determines the mechanism by which
932 /// [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] identifies a
933 /// [key_project][google.cloud.kms.v1.AutokeyConfig.key_project] at its
934 /// specific configuration node. This parameter also determines if Autokey can
935 /// be used within this project or folder.
936 ///
937 /// [google.cloud.kms.v1.AutokeyConfig]: crate::model::AutokeyConfig
938 /// [google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode]: crate::model::autokey_config::KeyProjectResolutionMode
939 /// [google.cloud.kms.v1.AutokeyConfig.key_project]: crate::model::AutokeyConfig::key_project
940 ///
941 /// # Working with unknown values
942 ///
943 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
944 /// additional enum variants at any time. Adding new variants is not considered
945 /// a breaking change. Applications should write their code in anticipation of:
946 ///
947 /// - New values appearing in future releases of the client library, **and**
948 /// - New values received dynamically, without application changes.
949 ///
950 /// Please consult the [Working with enums] section in the user guide for some
951 /// guidelines.
952 ///
953 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
954 #[derive(Clone, Debug, PartialEq)]
955 #[non_exhaustive]
956 pub enum KeyProjectResolutionMode {
957 /// Default value. KeyProjectResolutionMode when not specified will act as
958 /// `DEDICATED_KEY_PROJECT`.
959 Unspecified,
960 /// Keys are created in a dedicated project specified by `key_project`.
961 DedicatedKeyProject,
962 /// Keys are created in the same project as the resource requesting the key.
963 /// The `key_project` must not be set when this mode is used.
964 ResourceProject,
965 /// Disables the AutokeyConfig. When this mode is set, any AutokeyConfig
966 /// from higher levels in the resource hierarchy are ignored for this
967 /// resource and its descendants. This setting can be overridden
968 /// by a more specific configuration at a lower level. For example,
969 /// if Autokey is disabled on a folder, it can be re-enabled on a sub-folder
970 /// or project within that folder by setting a different mode (e.g.,
971 /// DEDICATED_KEY_PROJECT or RESOURCE_PROJECT).
972 Disabled,
973 /// If set, the enum was initialized with an unknown value.
974 ///
975 /// Applications can examine the value using [KeyProjectResolutionMode::value] or
976 /// [KeyProjectResolutionMode::name].
977 UnknownValue(key_project_resolution_mode::UnknownValue),
978 }
979
980 #[doc(hidden)]
981 pub mod key_project_resolution_mode {
982 #[allow(unused_imports)]
983 use super::*;
984 #[derive(Clone, Debug, PartialEq)]
985 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
986 }
987
988 impl KeyProjectResolutionMode {
989 /// Gets the enum value.
990 ///
991 /// Returns `None` if the enum contains an unknown value deserialized from
992 /// the string representation of enums.
993 pub fn value(&self) -> std::option::Option<i32> {
994 match self {
995 Self::Unspecified => std::option::Option::Some(0),
996 Self::DedicatedKeyProject => std::option::Option::Some(1),
997 Self::ResourceProject => std::option::Option::Some(2),
998 Self::Disabled => std::option::Option::Some(3),
999 Self::UnknownValue(u) => u.0.value(),
1000 }
1001 }
1002
1003 /// Gets the enum value as a string.
1004 ///
1005 /// Returns `None` if the enum contains an unknown value deserialized from
1006 /// the integer representation of enums.
1007 pub fn name(&self) -> std::option::Option<&str> {
1008 match self {
1009 Self::Unspecified => {
1010 std::option::Option::Some("KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED")
1011 }
1012 Self::DedicatedKeyProject => std::option::Option::Some("DEDICATED_KEY_PROJECT"),
1013 Self::ResourceProject => std::option::Option::Some("RESOURCE_PROJECT"),
1014 Self::Disabled => std::option::Option::Some("DISABLED"),
1015 Self::UnknownValue(u) => u.0.name(),
1016 }
1017 }
1018 }
1019
1020 impl std::default::Default for KeyProjectResolutionMode {
1021 fn default() -> Self {
1022 use std::convert::From;
1023 Self::from(0)
1024 }
1025 }
1026
1027 impl std::fmt::Display for KeyProjectResolutionMode {
1028 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1029 wkt::internal::display_enum(f, self.name(), self.value())
1030 }
1031 }
1032
1033 impl std::convert::From<i32> for KeyProjectResolutionMode {
1034 fn from(value: i32) -> Self {
1035 match value {
1036 0 => Self::Unspecified,
1037 1 => Self::DedicatedKeyProject,
1038 2 => Self::ResourceProject,
1039 3 => Self::Disabled,
1040 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1041 wkt::internal::UnknownEnumValue::Integer(value),
1042 )),
1043 }
1044 }
1045 }
1046
1047 impl std::convert::From<&str> for KeyProjectResolutionMode {
1048 fn from(value: &str) -> Self {
1049 use std::string::ToString;
1050 match value {
1051 "KEY_PROJECT_RESOLUTION_MODE_UNSPECIFIED" => Self::Unspecified,
1052 "DEDICATED_KEY_PROJECT" => Self::DedicatedKeyProject,
1053 "RESOURCE_PROJECT" => Self::ResourceProject,
1054 "DISABLED" => Self::Disabled,
1055 _ => Self::UnknownValue(key_project_resolution_mode::UnknownValue(
1056 wkt::internal::UnknownEnumValue::String(value.to_string()),
1057 )),
1058 }
1059 }
1060 }
1061
1062 impl serde::ser::Serialize for KeyProjectResolutionMode {
1063 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1064 where
1065 S: serde::Serializer,
1066 {
1067 match self {
1068 Self::Unspecified => serializer.serialize_i32(0),
1069 Self::DedicatedKeyProject => serializer.serialize_i32(1),
1070 Self::ResourceProject => serializer.serialize_i32(2),
1071 Self::Disabled => serializer.serialize_i32(3),
1072 Self::UnknownValue(u) => u.0.serialize(serializer),
1073 }
1074 }
1075 }
1076
1077 impl<'de> serde::de::Deserialize<'de> for KeyProjectResolutionMode {
1078 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1079 where
1080 D: serde::Deserializer<'de>,
1081 {
1082 deserializer.deserialize_any(
1083 wkt::internal::EnumVisitor::<KeyProjectResolutionMode>::new(
1084 ".google.cloud.kms.v1.AutokeyConfig.KeyProjectResolutionMode",
1085 ),
1086 )
1087 }
1088 }
1089}
1090
1091/// Request message for
1092/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1093///
1094/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1095#[derive(Clone, Default, PartialEq)]
1096#[non_exhaustive]
1097pub struct ShowEffectiveAutokeyConfigRequest {
1098 /// Required. Name of the resource project to the show effective Cloud KMS
1099 /// Autokey configuration for. This may be helpful for interrogating the effect
1100 /// of nested folder configurations on a given resource project.
1101 pub parent: std::string::String,
1102
1103 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1104}
1105
1106impl ShowEffectiveAutokeyConfigRequest {
1107 /// Creates a new default instance.
1108 pub fn new() -> Self {
1109 std::default::Default::default()
1110 }
1111
1112 /// Sets the value of [parent][crate::model::ShowEffectiveAutokeyConfigRequest::parent].
1113 ///
1114 /// # Example
1115 /// ```ignore,no_run
1116 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigRequest;
1117 /// let x = ShowEffectiveAutokeyConfigRequest::new().set_parent("example");
1118 /// ```
1119 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1120 self.parent = v.into();
1121 self
1122 }
1123}
1124
1125impl wkt::message::Message for ShowEffectiveAutokeyConfigRequest {
1126 fn typename() -> &'static str {
1127 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigRequest"
1128 }
1129}
1130
1131/// Response message for
1132/// [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].
1133///
1134/// [google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig]: crate::client::AutokeyAdmin::show_effective_autokey_config
1135#[derive(Clone, Default, PartialEq)]
1136#[non_exhaustive]
1137pub struct ShowEffectiveAutokeyConfigResponse {
1138 /// Name of the key project configured in the resource project's folder
1139 /// ancestry.
1140 pub key_project: std::string::String,
1141
1142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1143}
1144
1145impl ShowEffectiveAutokeyConfigResponse {
1146 /// Creates a new default instance.
1147 pub fn new() -> Self {
1148 std::default::Default::default()
1149 }
1150
1151 /// Sets the value of [key_project][crate::model::ShowEffectiveAutokeyConfigResponse::key_project].
1152 ///
1153 /// # Example
1154 /// ```ignore,no_run
1155 /// # use google_cloud_kms_v1::model::ShowEffectiveAutokeyConfigResponse;
1156 /// let x = ShowEffectiveAutokeyConfigResponse::new().set_key_project("example");
1157 /// ```
1158 pub fn set_key_project<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1159 self.key_project = v.into();
1160 self
1161 }
1162}
1163
1164impl wkt::message::Message for ShowEffectiveAutokeyConfigResponse {
1165 fn typename() -> &'static str {
1166 "type.googleapis.com/google.cloud.kms.v1.ShowEffectiveAutokeyConfigResponse"
1167 }
1168}
1169
1170/// Request message for
1171/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1172///
1173/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1174#[derive(Clone, Default, PartialEq)]
1175#[non_exhaustive]
1176pub struct ListEkmConnectionsRequest {
1177 /// Required. The resource name of the location associated with the
1178 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to list, in the format
1179 /// `projects/*/locations/*`.
1180 ///
1181 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1182 pub parent: std::string::String,
1183
1184 /// Optional. Optional limit on the number of
1185 /// [EkmConnections][google.cloud.kms.v1.EkmConnection] to include in the
1186 /// response. Further [EkmConnections][google.cloud.kms.v1.EkmConnection] can
1187 /// subsequently be obtained by including the
1188 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]
1189 /// in a subsequent request. If unspecified, the server will pick an
1190 /// appropriate default.
1191 ///
1192 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1193 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1194 pub page_size: i32,
1195
1196 /// Optional. Optional pagination token, returned earlier via
1197 /// [ListEkmConnectionsResponse.next_page_token][google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token].
1198 ///
1199 /// [google.cloud.kms.v1.ListEkmConnectionsResponse.next_page_token]: crate::model::ListEkmConnectionsResponse::next_page_token
1200 pub page_token: std::string::String,
1201
1202 /// Optional. Only include resources that match the filter in the response. For
1203 /// more information, see
1204 /// [Sorting and filtering list
1205 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1206 pub filter: std::string::String,
1207
1208 /// Optional. Specify how the results should be sorted. If not specified, the
1209 /// results will be sorted in the default order. For more information, see
1210 /// [Sorting and filtering list
1211 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
1212 pub order_by: std::string::String,
1213
1214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1215}
1216
1217impl ListEkmConnectionsRequest {
1218 /// Creates a new default instance.
1219 pub fn new() -> Self {
1220 std::default::Default::default()
1221 }
1222
1223 /// Sets the value of [parent][crate::model::ListEkmConnectionsRequest::parent].
1224 ///
1225 /// # Example
1226 /// ```ignore,no_run
1227 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1228 /// let x = ListEkmConnectionsRequest::new().set_parent("example");
1229 /// ```
1230 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1231 self.parent = v.into();
1232 self
1233 }
1234
1235 /// Sets the value of [page_size][crate::model::ListEkmConnectionsRequest::page_size].
1236 ///
1237 /// # Example
1238 /// ```ignore,no_run
1239 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1240 /// let x = ListEkmConnectionsRequest::new().set_page_size(42);
1241 /// ```
1242 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1243 self.page_size = v.into();
1244 self
1245 }
1246
1247 /// Sets the value of [page_token][crate::model::ListEkmConnectionsRequest::page_token].
1248 ///
1249 /// # Example
1250 /// ```ignore,no_run
1251 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1252 /// let x = ListEkmConnectionsRequest::new().set_page_token("example");
1253 /// ```
1254 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1255 self.page_token = v.into();
1256 self
1257 }
1258
1259 /// Sets the value of [filter][crate::model::ListEkmConnectionsRequest::filter].
1260 ///
1261 /// # Example
1262 /// ```ignore,no_run
1263 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1264 /// let x = ListEkmConnectionsRequest::new().set_filter("example");
1265 /// ```
1266 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1267 self.filter = v.into();
1268 self
1269 }
1270
1271 /// Sets the value of [order_by][crate::model::ListEkmConnectionsRequest::order_by].
1272 ///
1273 /// # Example
1274 /// ```ignore,no_run
1275 /// # use google_cloud_kms_v1::model::ListEkmConnectionsRequest;
1276 /// let x = ListEkmConnectionsRequest::new().set_order_by("example");
1277 /// ```
1278 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1279 self.order_by = v.into();
1280 self
1281 }
1282}
1283
1284impl wkt::message::Message for ListEkmConnectionsRequest {
1285 fn typename() -> &'static str {
1286 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsRequest"
1287 }
1288}
1289
1290/// Response message for
1291/// [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections].
1292///
1293/// [google.cloud.kms.v1.EkmService.ListEkmConnections]: crate::client::EkmService::list_ekm_connections
1294#[derive(Clone, Default, PartialEq)]
1295#[non_exhaustive]
1296pub struct ListEkmConnectionsResponse {
1297 /// The list of [EkmConnections][google.cloud.kms.v1.EkmConnection].
1298 ///
1299 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1300 pub ekm_connections: std::vec::Vec<crate::model::EkmConnection>,
1301
1302 /// A token to retrieve next page of results. Pass this value in
1303 /// [ListEkmConnectionsRequest.page_token][google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]
1304 /// to retrieve the next page of results.
1305 ///
1306 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.page_token]: crate::model::ListEkmConnectionsRequest::page_token
1307 pub next_page_token: std::string::String,
1308
1309 /// The total number of [EkmConnections][google.cloud.kms.v1.EkmConnection]
1310 /// that matched the query.
1311 ///
1312 /// This field is not populated if
1313 /// [ListEkmConnectionsRequest.filter][google.cloud.kms.v1.ListEkmConnectionsRequest.filter]
1314 /// is applied.
1315 ///
1316 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1317 /// [google.cloud.kms.v1.ListEkmConnectionsRequest.filter]: crate::model::ListEkmConnectionsRequest::filter
1318 pub total_size: i32,
1319
1320 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1321}
1322
1323impl ListEkmConnectionsResponse {
1324 /// Creates a new default instance.
1325 pub fn new() -> Self {
1326 std::default::Default::default()
1327 }
1328
1329 /// Sets the value of [ekm_connections][crate::model::ListEkmConnectionsResponse::ekm_connections].
1330 ///
1331 /// # Example
1332 /// ```ignore,no_run
1333 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1334 /// use google_cloud_kms_v1::model::EkmConnection;
1335 /// let x = ListEkmConnectionsResponse::new()
1336 /// .set_ekm_connections([
1337 /// EkmConnection::default()/* use setters */,
1338 /// EkmConnection::default()/* use (different) setters */,
1339 /// ]);
1340 /// ```
1341 pub fn set_ekm_connections<T, V>(mut self, v: T) -> Self
1342 where
1343 T: std::iter::IntoIterator<Item = V>,
1344 V: std::convert::Into<crate::model::EkmConnection>,
1345 {
1346 use std::iter::Iterator;
1347 self.ekm_connections = v.into_iter().map(|i| i.into()).collect();
1348 self
1349 }
1350
1351 /// Sets the value of [next_page_token][crate::model::ListEkmConnectionsResponse::next_page_token].
1352 ///
1353 /// # Example
1354 /// ```ignore,no_run
1355 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1356 /// let x = ListEkmConnectionsResponse::new().set_next_page_token("example");
1357 /// ```
1358 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1359 self.next_page_token = v.into();
1360 self
1361 }
1362
1363 /// Sets the value of [total_size][crate::model::ListEkmConnectionsResponse::total_size].
1364 ///
1365 /// # Example
1366 /// ```ignore,no_run
1367 /// # use google_cloud_kms_v1::model::ListEkmConnectionsResponse;
1368 /// let x = ListEkmConnectionsResponse::new().set_total_size(42);
1369 /// ```
1370 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1371 self.total_size = v.into();
1372 self
1373 }
1374}
1375
1376impl wkt::message::Message for ListEkmConnectionsResponse {
1377 fn typename() -> &'static str {
1378 "type.googleapis.com/google.cloud.kms.v1.ListEkmConnectionsResponse"
1379 }
1380}
1381
1382#[doc(hidden)]
1383impl google_cloud_gax::paginator::internal::PageableResponse for ListEkmConnectionsResponse {
1384 type PageItem = crate::model::EkmConnection;
1385
1386 fn items(self) -> std::vec::Vec<Self::PageItem> {
1387 self.ekm_connections
1388 }
1389
1390 fn next_page_token(&self) -> std::string::String {
1391 use std::clone::Clone;
1392 self.next_page_token.clone()
1393 }
1394}
1395
1396/// Request message for
1397/// [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection].
1398///
1399/// [google.cloud.kms.v1.EkmService.GetEkmConnection]: crate::client::EkmService::get_ekm_connection
1400#[derive(Clone, Default, PartialEq)]
1401#[non_exhaustive]
1402pub struct GetEkmConnectionRequest {
1403 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
1404 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to get.
1405 ///
1406 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1407 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
1408 pub name: std::string::String,
1409
1410 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1411}
1412
1413impl GetEkmConnectionRequest {
1414 /// Creates a new default instance.
1415 pub fn new() -> Self {
1416 std::default::Default::default()
1417 }
1418
1419 /// Sets the value of [name][crate::model::GetEkmConnectionRequest::name].
1420 ///
1421 /// # Example
1422 /// ```ignore,no_run
1423 /// # use google_cloud_kms_v1::model::GetEkmConnectionRequest;
1424 /// # let project_id = "project_id";
1425 /// # let location_id = "location_id";
1426 /// # let ekm_connection_id = "ekm_connection_id";
1427 /// let x = GetEkmConnectionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
1428 /// ```
1429 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1430 self.name = v.into();
1431 self
1432 }
1433}
1434
1435impl wkt::message::Message for GetEkmConnectionRequest {
1436 fn typename() -> &'static str {
1437 "type.googleapis.com/google.cloud.kms.v1.GetEkmConnectionRequest"
1438 }
1439}
1440
1441/// Request message for
1442/// [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection].
1443///
1444/// [google.cloud.kms.v1.EkmService.CreateEkmConnection]: crate::client::EkmService::create_ekm_connection
1445#[derive(Clone, Default, PartialEq)]
1446#[non_exhaustive]
1447pub struct CreateEkmConnectionRequest {
1448 /// Required. The resource name of the location associated with the
1449 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], in the format
1450 /// `projects/*/locations/*`.
1451 ///
1452 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1453 pub parent: std::string::String,
1454
1455 /// Required. It must be unique within a location and match the regular
1456 /// expression `[a-zA-Z0-9_-]{1,63}`.
1457 pub ekm_connection_id: std::string::String,
1458
1459 /// Required. An [EkmConnection][google.cloud.kms.v1.EkmConnection] with
1460 /// initial field values.
1461 ///
1462 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1463 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1464
1465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1466}
1467
1468impl CreateEkmConnectionRequest {
1469 /// Creates a new default instance.
1470 pub fn new() -> Self {
1471 std::default::Default::default()
1472 }
1473
1474 /// Sets the value of [parent][crate::model::CreateEkmConnectionRequest::parent].
1475 ///
1476 /// # Example
1477 /// ```ignore,no_run
1478 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1479 /// let x = CreateEkmConnectionRequest::new().set_parent("example");
1480 /// ```
1481 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1482 self.parent = v.into();
1483 self
1484 }
1485
1486 /// Sets the value of [ekm_connection_id][crate::model::CreateEkmConnectionRequest::ekm_connection_id].
1487 ///
1488 /// # Example
1489 /// ```ignore,no_run
1490 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1491 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection_id("example");
1492 /// ```
1493 pub fn set_ekm_connection_id<T: std::convert::Into<std::string::String>>(
1494 mut self,
1495 v: T,
1496 ) -> Self {
1497 self.ekm_connection_id = v.into();
1498 self
1499 }
1500
1501 /// Sets the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1502 ///
1503 /// # Example
1504 /// ```ignore,no_run
1505 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1506 /// use google_cloud_kms_v1::model::EkmConnection;
1507 /// let x = CreateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1508 /// ```
1509 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1510 where
1511 T: std::convert::Into<crate::model::EkmConnection>,
1512 {
1513 self.ekm_connection = std::option::Option::Some(v.into());
1514 self
1515 }
1516
1517 /// Sets or clears the value of [ekm_connection][crate::model::CreateEkmConnectionRequest::ekm_connection].
1518 ///
1519 /// # Example
1520 /// ```ignore,no_run
1521 /// # use google_cloud_kms_v1::model::CreateEkmConnectionRequest;
1522 /// use google_cloud_kms_v1::model::EkmConnection;
1523 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1524 /// let x = CreateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1525 /// ```
1526 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1527 where
1528 T: std::convert::Into<crate::model::EkmConnection>,
1529 {
1530 self.ekm_connection = v.map(|x| x.into());
1531 self
1532 }
1533}
1534
1535impl wkt::message::Message for CreateEkmConnectionRequest {
1536 fn typename() -> &'static str {
1537 "type.googleapis.com/google.cloud.kms.v1.CreateEkmConnectionRequest"
1538 }
1539}
1540
1541/// Request message for
1542/// [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection].
1543///
1544/// [google.cloud.kms.v1.EkmService.UpdateEkmConnection]: crate::client::EkmService::update_ekm_connection
1545#[derive(Clone, Default, PartialEq)]
1546#[non_exhaustive]
1547pub struct UpdateEkmConnectionRequest {
1548 /// Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with updated
1549 /// values.
1550 ///
1551 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
1552 pub ekm_connection: std::option::Option<crate::model::EkmConnection>,
1553
1554 /// Required. List of fields to be updated in this request.
1555 pub update_mask: std::option::Option<wkt::FieldMask>,
1556
1557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1558}
1559
1560impl UpdateEkmConnectionRequest {
1561 /// Creates a new default instance.
1562 pub fn new() -> Self {
1563 std::default::Default::default()
1564 }
1565
1566 /// Sets the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1567 ///
1568 /// # Example
1569 /// ```ignore,no_run
1570 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1571 /// use google_cloud_kms_v1::model::EkmConnection;
1572 /// let x = UpdateEkmConnectionRequest::new().set_ekm_connection(EkmConnection::default()/* use setters */);
1573 /// ```
1574 pub fn set_ekm_connection<T>(mut self, v: T) -> Self
1575 where
1576 T: std::convert::Into<crate::model::EkmConnection>,
1577 {
1578 self.ekm_connection = std::option::Option::Some(v.into());
1579 self
1580 }
1581
1582 /// Sets or clears the value of [ekm_connection][crate::model::UpdateEkmConnectionRequest::ekm_connection].
1583 ///
1584 /// # Example
1585 /// ```ignore,no_run
1586 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1587 /// use google_cloud_kms_v1::model::EkmConnection;
1588 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(Some(EkmConnection::default()/* use setters */));
1589 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_ekm_connection(None::<EkmConnection>);
1590 /// ```
1591 pub fn set_or_clear_ekm_connection<T>(mut self, v: std::option::Option<T>) -> Self
1592 where
1593 T: std::convert::Into<crate::model::EkmConnection>,
1594 {
1595 self.ekm_connection = v.map(|x| x.into());
1596 self
1597 }
1598
1599 /// Sets the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1600 ///
1601 /// # Example
1602 /// ```ignore,no_run
1603 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1604 /// use wkt::FieldMask;
1605 /// let x = UpdateEkmConnectionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1606 /// ```
1607 pub fn set_update_mask<T>(mut self, v: T) -> Self
1608 where
1609 T: std::convert::Into<wkt::FieldMask>,
1610 {
1611 self.update_mask = std::option::Option::Some(v.into());
1612 self
1613 }
1614
1615 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConnectionRequest::update_mask].
1616 ///
1617 /// # Example
1618 /// ```ignore,no_run
1619 /// # use google_cloud_kms_v1::model::UpdateEkmConnectionRequest;
1620 /// use wkt::FieldMask;
1621 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1622 /// let x = UpdateEkmConnectionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1623 /// ```
1624 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1625 where
1626 T: std::convert::Into<wkt::FieldMask>,
1627 {
1628 self.update_mask = v.map(|x| x.into());
1629 self
1630 }
1631}
1632
1633impl wkt::message::Message for UpdateEkmConnectionRequest {
1634 fn typename() -> &'static str {
1635 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConnectionRequest"
1636 }
1637}
1638
1639/// Request message for
1640/// [EkmService.GetEkmConfig][google.cloud.kms.v1.EkmService.GetEkmConfig].
1641///
1642/// [google.cloud.kms.v1.EkmService.GetEkmConfig]: crate::client::EkmService::get_ekm_config
1643#[derive(Clone, Default, PartialEq)]
1644#[non_exhaustive]
1645pub struct GetEkmConfigRequest {
1646 /// Required. The [name][google.cloud.kms.v1.EkmConfig.name] of the
1647 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] to get.
1648 ///
1649 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1650 /// [google.cloud.kms.v1.EkmConfig.name]: crate::model::EkmConfig::name
1651 pub name: std::string::String,
1652
1653 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1654}
1655
1656impl GetEkmConfigRequest {
1657 /// Creates a new default instance.
1658 pub fn new() -> Self {
1659 std::default::Default::default()
1660 }
1661
1662 /// Sets the value of [name][crate::model::GetEkmConfigRequest::name].
1663 ///
1664 /// # Example
1665 /// ```ignore,no_run
1666 /// # use google_cloud_kms_v1::model::GetEkmConfigRequest;
1667 /// # let project_id = "project_id";
1668 /// # let location_id = "location_id";
1669 /// let x = GetEkmConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConfig"));
1670 /// ```
1671 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1672 self.name = v.into();
1673 self
1674 }
1675}
1676
1677impl wkt::message::Message for GetEkmConfigRequest {
1678 fn typename() -> &'static str {
1679 "type.googleapis.com/google.cloud.kms.v1.GetEkmConfigRequest"
1680 }
1681}
1682
1683/// Request message for
1684/// [EkmService.UpdateEkmConfig][google.cloud.kms.v1.EkmService.UpdateEkmConfig].
1685///
1686/// [google.cloud.kms.v1.EkmService.UpdateEkmConfig]: crate::client::EkmService::update_ekm_config
1687#[derive(Clone, Default, PartialEq)]
1688#[non_exhaustive]
1689pub struct UpdateEkmConfigRequest {
1690 /// Required. [EkmConfig][google.cloud.kms.v1.EkmConfig] with updated values.
1691 ///
1692 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
1693 pub ekm_config: std::option::Option<crate::model::EkmConfig>,
1694
1695 /// Required. List of fields to be updated in this request.
1696 pub update_mask: std::option::Option<wkt::FieldMask>,
1697
1698 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1699}
1700
1701impl UpdateEkmConfigRequest {
1702 /// Creates a new default instance.
1703 pub fn new() -> Self {
1704 std::default::Default::default()
1705 }
1706
1707 /// Sets the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1708 ///
1709 /// # Example
1710 /// ```ignore,no_run
1711 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1712 /// use google_cloud_kms_v1::model::EkmConfig;
1713 /// let x = UpdateEkmConfigRequest::new().set_ekm_config(EkmConfig::default()/* use setters */);
1714 /// ```
1715 pub fn set_ekm_config<T>(mut self, v: T) -> Self
1716 where
1717 T: std::convert::Into<crate::model::EkmConfig>,
1718 {
1719 self.ekm_config = std::option::Option::Some(v.into());
1720 self
1721 }
1722
1723 /// Sets or clears the value of [ekm_config][crate::model::UpdateEkmConfigRequest::ekm_config].
1724 ///
1725 /// # Example
1726 /// ```ignore,no_run
1727 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1728 /// use google_cloud_kms_v1::model::EkmConfig;
1729 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(Some(EkmConfig::default()/* use setters */));
1730 /// let x = UpdateEkmConfigRequest::new().set_or_clear_ekm_config(None::<EkmConfig>);
1731 /// ```
1732 pub fn set_or_clear_ekm_config<T>(mut self, v: std::option::Option<T>) -> Self
1733 where
1734 T: std::convert::Into<crate::model::EkmConfig>,
1735 {
1736 self.ekm_config = v.map(|x| x.into());
1737 self
1738 }
1739
1740 /// Sets the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1741 ///
1742 /// # Example
1743 /// ```ignore,no_run
1744 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1745 /// use wkt::FieldMask;
1746 /// let x = UpdateEkmConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
1747 /// ```
1748 pub fn set_update_mask<T>(mut self, v: T) -> Self
1749 where
1750 T: std::convert::Into<wkt::FieldMask>,
1751 {
1752 self.update_mask = std::option::Option::Some(v.into());
1753 self
1754 }
1755
1756 /// Sets or clears the value of [update_mask][crate::model::UpdateEkmConfigRequest::update_mask].
1757 ///
1758 /// # Example
1759 /// ```ignore,no_run
1760 /// # use google_cloud_kms_v1::model::UpdateEkmConfigRequest;
1761 /// use wkt::FieldMask;
1762 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
1763 /// let x = UpdateEkmConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
1764 /// ```
1765 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1766 where
1767 T: std::convert::Into<wkt::FieldMask>,
1768 {
1769 self.update_mask = v.map(|x| x.into());
1770 self
1771 }
1772}
1773
1774impl wkt::message::Message for UpdateEkmConfigRequest {
1775 fn typename() -> &'static str {
1776 "type.googleapis.com/google.cloud.kms.v1.UpdateEkmConfigRequest"
1777 }
1778}
1779
1780/// A [Certificate][google.cloud.kms.v1.Certificate] represents an X.509
1781/// certificate used to authenticate HTTPS connections to EKM replicas.
1782///
1783/// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
1784#[derive(Clone, Default, PartialEq)]
1785#[non_exhaustive]
1786pub struct Certificate {
1787 /// Required. The raw certificate bytes in DER format.
1788 pub raw_der: ::bytes::Bytes,
1789
1790 /// Output only. True if the certificate was parsed successfully.
1791 pub parsed: bool,
1792
1793 /// Output only. The issuer distinguished name in RFC 2253 format. Only present
1794 /// if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1795 ///
1796 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1797 pub issuer: std::string::String,
1798
1799 /// Output only. The subject distinguished name in RFC 2253 format. Only
1800 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1801 ///
1802 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1803 pub subject: std::string::String,
1804
1805 /// Output only. The subject Alternative DNS names. Only present if
1806 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1807 ///
1808 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1809 pub subject_alternative_dns_names: std::vec::Vec<std::string::String>,
1810
1811 /// Output only. The certificate is not valid before this time. Only present if
1812 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1813 ///
1814 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1815 pub not_before_time: std::option::Option<wkt::Timestamp>,
1816
1817 /// Output only. The certificate is not valid after this time. Only present if
1818 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1819 ///
1820 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1821 pub not_after_time: std::option::Option<wkt::Timestamp>,
1822
1823 /// Output only. The certificate serial number as a hex string. Only present if
1824 /// [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1825 ///
1826 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1827 pub serial_number: std::string::String,
1828
1829 /// Output only. The SHA-256 certificate fingerprint as a hex string. Only
1830 /// present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true.
1831 ///
1832 /// [google.cloud.kms.v1.Certificate.parsed]: crate::model::Certificate::parsed
1833 pub sha256_fingerprint: std::string::String,
1834
1835 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1836}
1837
1838impl Certificate {
1839 /// Creates a new default instance.
1840 pub fn new() -> Self {
1841 std::default::Default::default()
1842 }
1843
1844 /// Sets the value of [raw_der][crate::model::Certificate::raw_der].
1845 ///
1846 /// # Example
1847 /// ```ignore,no_run
1848 /// # use google_cloud_kms_v1::model::Certificate;
1849 /// let x = Certificate::new().set_raw_der(bytes::Bytes::from_static(b"example"));
1850 /// ```
1851 pub fn set_raw_der<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1852 self.raw_der = v.into();
1853 self
1854 }
1855
1856 /// Sets the value of [parsed][crate::model::Certificate::parsed].
1857 ///
1858 /// # Example
1859 /// ```ignore,no_run
1860 /// # use google_cloud_kms_v1::model::Certificate;
1861 /// let x = Certificate::new().set_parsed(true);
1862 /// ```
1863 pub fn set_parsed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1864 self.parsed = v.into();
1865 self
1866 }
1867
1868 /// Sets the value of [issuer][crate::model::Certificate::issuer].
1869 ///
1870 /// # Example
1871 /// ```ignore,no_run
1872 /// # use google_cloud_kms_v1::model::Certificate;
1873 /// let x = Certificate::new().set_issuer("example");
1874 /// ```
1875 pub fn set_issuer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1876 self.issuer = v.into();
1877 self
1878 }
1879
1880 /// Sets the value of [subject][crate::model::Certificate::subject].
1881 ///
1882 /// # Example
1883 /// ```ignore,no_run
1884 /// # use google_cloud_kms_v1::model::Certificate;
1885 /// let x = Certificate::new().set_subject("example");
1886 /// ```
1887 pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1888 self.subject = v.into();
1889 self
1890 }
1891
1892 /// Sets the value of [subject_alternative_dns_names][crate::model::Certificate::subject_alternative_dns_names].
1893 ///
1894 /// # Example
1895 /// ```ignore,no_run
1896 /// # use google_cloud_kms_v1::model::Certificate;
1897 /// let x = Certificate::new().set_subject_alternative_dns_names(["a", "b", "c"]);
1898 /// ```
1899 pub fn set_subject_alternative_dns_names<T, V>(mut self, v: T) -> Self
1900 where
1901 T: std::iter::IntoIterator<Item = V>,
1902 V: std::convert::Into<std::string::String>,
1903 {
1904 use std::iter::Iterator;
1905 self.subject_alternative_dns_names = v.into_iter().map(|i| i.into()).collect();
1906 self
1907 }
1908
1909 /// Sets the value of [not_before_time][crate::model::Certificate::not_before_time].
1910 ///
1911 /// # Example
1912 /// ```ignore,no_run
1913 /// # use google_cloud_kms_v1::model::Certificate;
1914 /// use wkt::Timestamp;
1915 /// let x = Certificate::new().set_not_before_time(Timestamp::default()/* use setters */);
1916 /// ```
1917 pub fn set_not_before_time<T>(mut self, v: T) -> Self
1918 where
1919 T: std::convert::Into<wkt::Timestamp>,
1920 {
1921 self.not_before_time = std::option::Option::Some(v.into());
1922 self
1923 }
1924
1925 /// Sets or clears the value of [not_before_time][crate::model::Certificate::not_before_time].
1926 ///
1927 /// # Example
1928 /// ```ignore,no_run
1929 /// # use google_cloud_kms_v1::model::Certificate;
1930 /// use wkt::Timestamp;
1931 /// let x = Certificate::new().set_or_clear_not_before_time(Some(Timestamp::default()/* use setters */));
1932 /// let x = Certificate::new().set_or_clear_not_before_time(None::<Timestamp>);
1933 /// ```
1934 pub fn set_or_clear_not_before_time<T>(mut self, v: std::option::Option<T>) -> Self
1935 where
1936 T: std::convert::Into<wkt::Timestamp>,
1937 {
1938 self.not_before_time = v.map(|x| x.into());
1939 self
1940 }
1941
1942 /// Sets the value of [not_after_time][crate::model::Certificate::not_after_time].
1943 ///
1944 /// # Example
1945 /// ```ignore,no_run
1946 /// # use google_cloud_kms_v1::model::Certificate;
1947 /// use wkt::Timestamp;
1948 /// let x = Certificate::new().set_not_after_time(Timestamp::default()/* use setters */);
1949 /// ```
1950 pub fn set_not_after_time<T>(mut self, v: T) -> Self
1951 where
1952 T: std::convert::Into<wkt::Timestamp>,
1953 {
1954 self.not_after_time = std::option::Option::Some(v.into());
1955 self
1956 }
1957
1958 /// Sets or clears the value of [not_after_time][crate::model::Certificate::not_after_time].
1959 ///
1960 /// # Example
1961 /// ```ignore,no_run
1962 /// # use google_cloud_kms_v1::model::Certificate;
1963 /// use wkt::Timestamp;
1964 /// let x = Certificate::new().set_or_clear_not_after_time(Some(Timestamp::default()/* use setters */));
1965 /// let x = Certificate::new().set_or_clear_not_after_time(None::<Timestamp>);
1966 /// ```
1967 pub fn set_or_clear_not_after_time<T>(mut self, v: std::option::Option<T>) -> Self
1968 where
1969 T: std::convert::Into<wkt::Timestamp>,
1970 {
1971 self.not_after_time = v.map(|x| x.into());
1972 self
1973 }
1974
1975 /// Sets the value of [serial_number][crate::model::Certificate::serial_number].
1976 ///
1977 /// # Example
1978 /// ```ignore,no_run
1979 /// # use google_cloud_kms_v1::model::Certificate;
1980 /// let x = Certificate::new().set_serial_number("example");
1981 /// ```
1982 pub fn set_serial_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1983 self.serial_number = v.into();
1984 self
1985 }
1986
1987 /// Sets the value of [sha256_fingerprint][crate::model::Certificate::sha256_fingerprint].
1988 ///
1989 /// # Example
1990 /// ```ignore,no_run
1991 /// # use google_cloud_kms_v1::model::Certificate;
1992 /// let x = Certificate::new().set_sha256_fingerprint("example");
1993 /// ```
1994 pub fn set_sha256_fingerprint<T: std::convert::Into<std::string::String>>(
1995 mut self,
1996 v: T,
1997 ) -> Self {
1998 self.sha256_fingerprint = v.into();
1999 self
2000 }
2001}
2002
2003impl wkt::message::Message for Certificate {
2004 fn typename() -> &'static str {
2005 "type.googleapis.com/google.cloud.kms.v1.Certificate"
2006 }
2007}
2008
2009/// An [EkmConnection][google.cloud.kms.v1.EkmConnection] represents an
2010/// individual EKM connection. It can be used for creating
2011/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2012/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2013/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2014/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], as well as
2015/// performing cryptographic operations using keys created within the
2016/// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2017///
2018/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2019/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2020/// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2021/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2022/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2023#[derive(Clone, Default, PartialEq)]
2024#[non_exhaustive]
2025pub struct EkmConnection {
2026 /// Output only. The resource name for the
2027 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] in the format
2028 /// `projects/*/locations/*/ekmConnections/*`.
2029 ///
2030 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2031 pub name: std::string::String,
2032
2033 /// Output only. The time at which the
2034 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] was created.
2035 ///
2036 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2037 pub create_time: std::option::Option<wkt::Timestamp>,
2038
2039 /// Optional. A list of
2040 /// [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where
2041 /// the EKM can be reached. There should be one ServiceResolver per EKM
2042 /// replica. Currently, only a single
2043 /// [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is
2044 /// supported.
2045 ///
2046 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2047 pub service_resolvers: std::vec::Vec<crate::model::ekm_connection::ServiceResolver>,
2048
2049 /// Optional. Etag of the currently stored
2050 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2051 ///
2052 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2053 pub etag: std::string::String,
2054
2055 /// Optional. Describes who can perform control plane operations on the EKM. If
2056 /// unset, this defaults to
2057 /// [MANUAL][google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL].
2058 ///
2059 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.MANUAL]: crate::model::ekm_connection::KeyManagementMode::Manual
2060 pub key_management_mode: crate::model::ekm_connection::KeyManagementMode,
2061
2062 /// Optional. Identifies the EKM Crypto Space that this
2063 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] maps to. Note: This
2064 /// field is required if
2065 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode] is
2066 /// [CLOUD_KMS][google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS].
2067 ///
2068 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2069 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2070 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode.CLOUD_KMS]: crate::model::ekm_connection::KeyManagementMode::CloudKms
2071 pub crypto_space_path: std::string::String,
2072
2073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2074}
2075
2076impl EkmConnection {
2077 /// Creates a new default instance.
2078 pub fn new() -> Self {
2079 std::default::Default::default()
2080 }
2081
2082 /// Sets the value of [name][crate::model::EkmConnection::name].
2083 ///
2084 /// # Example
2085 /// ```ignore,no_run
2086 /// # use google_cloud_kms_v1::model::EkmConnection;
2087 /// # let project_id = "project_id";
2088 /// # let location_id = "location_id";
2089 /// # let ekm_connection_id = "ekm_connection_id";
2090 /// let x = EkmConnection::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2091 /// ```
2092 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2093 self.name = v.into();
2094 self
2095 }
2096
2097 /// Sets the value of [create_time][crate::model::EkmConnection::create_time].
2098 ///
2099 /// # Example
2100 /// ```ignore,no_run
2101 /// # use google_cloud_kms_v1::model::EkmConnection;
2102 /// use wkt::Timestamp;
2103 /// let x = EkmConnection::new().set_create_time(Timestamp::default()/* use setters */);
2104 /// ```
2105 pub fn set_create_time<T>(mut self, v: T) -> Self
2106 where
2107 T: std::convert::Into<wkt::Timestamp>,
2108 {
2109 self.create_time = std::option::Option::Some(v.into());
2110 self
2111 }
2112
2113 /// Sets or clears the value of [create_time][crate::model::EkmConnection::create_time].
2114 ///
2115 /// # Example
2116 /// ```ignore,no_run
2117 /// # use google_cloud_kms_v1::model::EkmConnection;
2118 /// use wkt::Timestamp;
2119 /// let x = EkmConnection::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2120 /// let x = EkmConnection::new().set_or_clear_create_time(None::<Timestamp>);
2121 /// ```
2122 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2123 where
2124 T: std::convert::Into<wkt::Timestamp>,
2125 {
2126 self.create_time = v.map(|x| x.into());
2127 self
2128 }
2129
2130 /// Sets the value of [service_resolvers][crate::model::EkmConnection::service_resolvers].
2131 ///
2132 /// # Example
2133 /// ```ignore,no_run
2134 /// # use google_cloud_kms_v1::model::EkmConnection;
2135 /// use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2136 /// let x = EkmConnection::new()
2137 /// .set_service_resolvers([
2138 /// ServiceResolver::default()/* use setters */,
2139 /// ServiceResolver::default()/* use (different) setters */,
2140 /// ]);
2141 /// ```
2142 pub fn set_service_resolvers<T, V>(mut self, v: T) -> Self
2143 where
2144 T: std::iter::IntoIterator<Item = V>,
2145 V: std::convert::Into<crate::model::ekm_connection::ServiceResolver>,
2146 {
2147 use std::iter::Iterator;
2148 self.service_resolvers = v.into_iter().map(|i| i.into()).collect();
2149 self
2150 }
2151
2152 /// Sets the value of [etag][crate::model::EkmConnection::etag].
2153 ///
2154 /// # Example
2155 /// ```ignore,no_run
2156 /// # use google_cloud_kms_v1::model::EkmConnection;
2157 /// let x = EkmConnection::new().set_etag("example");
2158 /// ```
2159 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2160 self.etag = v.into();
2161 self
2162 }
2163
2164 /// Sets the value of [key_management_mode][crate::model::EkmConnection::key_management_mode].
2165 ///
2166 /// # Example
2167 /// ```ignore,no_run
2168 /// # use google_cloud_kms_v1::model::EkmConnection;
2169 /// use google_cloud_kms_v1::model::ekm_connection::KeyManagementMode;
2170 /// let x0 = EkmConnection::new().set_key_management_mode(KeyManagementMode::Manual);
2171 /// let x1 = EkmConnection::new().set_key_management_mode(KeyManagementMode::CloudKms);
2172 /// ```
2173 pub fn set_key_management_mode<
2174 T: std::convert::Into<crate::model::ekm_connection::KeyManagementMode>,
2175 >(
2176 mut self,
2177 v: T,
2178 ) -> Self {
2179 self.key_management_mode = v.into();
2180 self
2181 }
2182
2183 /// Sets the value of [crypto_space_path][crate::model::EkmConnection::crypto_space_path].
2184 ///
2185 /// # Example
2186 /// ```ignore,no_run
2187 /// # use google_cloud_kms_v1::model::EkmConnection;
2188 /// let x = EkmConnection::new().set_crypto_space_path("example");
2189 /// ```
2190 pub fn set_crypto_space_path<T: std::convert::Into<std::string::String>>(
2191 mut self,
2192 v: T,
2193 ) -> Self {
2194 self.crypto_space_path = v.into();
2195 self
2196 }
2197}
2198
2199impl wkt::message::Message for EkmConnection {
2200 fn typename() -> &'static str {
2201 "type.googleapis.com/google.cloud.kms.v1.EkmConnection"
2202 }
2203}
2204
2205/// Defines additional types related to [EkmConnection].
2206pub mod ekm_connection {
2207 #[allow(unused_imports)]
2208 use super::*;
2209
2210 /// A [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver]
2211 /// represents an EKM replica that can be reached within an
2212 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2213 ///
2214 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2215 /// [google.cloud.kms.v1.EkmConnection.ServiceResolver]: crate::model::ekm_connection::ServiceResolver
2216 #[derive(Clone, Default, PartialEq)]
2217 #[non_exhaustive]
2218 pub struct ServiceResolver {
2219 /// Required. The resource name of the Service Directory service pointing to
2220 /// an EKM replica, in the format
2221 /// `projects/*/locations/*/namespaces/*/services/*`.
2222 pub service_directory_service: std::string::String,
2223
2224 /// Optional. The filter applied to the endpoints of the resolved service. If
2225 /// no filter is specified, all endpoints will be considered. An endpoint
2226 /// will be chosen arbitrarily from the filtered list for each request.
2227 ///
2228 /// For endpoint filter syntax and examples, see
2229 /// <https://cloud.google.com/service-directory/docs/reference/rpc/google.cloud.servicedirectory.v1#resolveservicerequest>.
2230 pub endpoint_filter: std::string::String,
2231
2232 /// Required. The hostname of the EKM replica used at TLS and HTTP layers.
2233 pub hostname: std::string::String,
2234
2235 /// Required. A list of leaf server certificates used to authenticate HTTPS
2236 /// connections to the EKM replica. Currently, a maximum of 10
2237 /// [Certificate][google.cloud.kms.v1.Certificate] is supported.
2238 ///
2239 /// [google.cloud.kms.v1.Certificate]: crate::model::Certificate
2240 pub server_certificates: std::vec::Vec<crate::model::Certificate>,
2241
2242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2243 }
2244
2245 impl ServiceResolver {
2246 /// Creates a new default instance.
2247 pub fn new() -> Self {
2248 std::default::Default::default()
2249 }
2250
2251 /// Sets the value of [service_directory_service][crate::model::ekm_connection::ServiceResolver::service_directory_service].
2252 ///
2253 /// # Example
2254 /// ```ignore,no_run
2255 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2256 /// let x = ServiceResolver::new().set_service_directory_service("example");
2257 /// ```
2258 pub fn set_service_directory_service<T: std::convert::Into<std::string::String>>(
2259 mut self,
2260 v: T,
2261 ) -> Self {
2262 self.service_directory_service = v.into();
2263 self
2264 }
2265
2266 /// Sets the value of [endpoint_filter][crate::model::ekm_connection::ServiceResolver::endpoint_filter].
2267 ///
2268 /// # Example
2269 /// ```ignore,no_run
2270 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2271 /// let x = ServiceResolver::new().set_endpoint_filter("example");
2272 /// ```
2273 pub fn set_endpoint_filter<T: std::convert::Into<std::string::String>>(
2274 mut self,
2275 v: T,
2276 ) -> Self {
2277 self.endpoint_filter = v.into();
2278 self
2279 }
2280
2281 /// Sets the value of [hostname][crate::model::ekm_connection::ServiceResolver::hostname].
2282 ///
2283 /// # Example
2284 /// ```ignore,no_run
2285 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2286 /// let x = ServiceResolver::new().set_hostname("example");
2287 /// ```
2288 pub fn set_hostname<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2289 self.hostname = v.into();
2290 self
2291 }
2292
2293 /// Sets the value of [server_certificates][crate::model::ekm_connection::ServiceResolver::server_certificates].
2294 ///
2295 /// # Example
2296 /// ```ignore,no_run
2297 /// # use google_cloud_kms_v1::model::ekm_connection::ServiceResolver;
2298 /// use google_cloud_kms_v1::model::Certificate;
2299 /// let x = ServiceResolver::new()
2300 /// .set_server_certificates([
2301 /// Certificate::default()/* use setters */,
2302 /// Certificate::default()/* use (different) setters */,
2303 /// ]);
2304 /// ```
2305 pub fn set_server_certificates<T, V>(mut self, v: T) -> Self
2306 where
2307 T: std::iter::IntoIterator<Item = V>,
2308 V: std::convert::Into<crate::model::Certificate>,
2309 {
2310 use std::iter::Iterator;
2311 self.server_certificates = v.into_iter().map(|i| i.into()).collect();
2312 self
2313 }
2314 }
2315
2316 impl wkt::message::Message for ServiceResolver {
2317 fn typename() -> &'static str {
2318 "type.googleapis.com/google.cloud.kms.v1.EkmConnection.ServiceResolver"
2319 }
2320 }
2321
2322 /// [KeyManagementMode][google.cloud.kms.v1.EkmConnection.KeyManagementMode]
2323 /// describes who can perform control plane cryptographic operations using this
2324 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
2325 ///
2326 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2327 /// [google.cloud.kms.v1.EkmConnection.KeyManagementMode]: crate::model::ekm_connection::KeyManagementMode
2328 ///
2329 /// # Working with unknown values
2330 ///
2331 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2332 /// additional enum variants at any time. Adding new variants is not considered
2333 /// a breaking change. Applications should write their code in anticipation of:
2334 ///
2335 /// - New values appearing in future releases of the client library, **and**
2336 /// - New values received dynamically, without application changes.
2337 ///
2338 /// Please consult the [Working with enums] section in the user guide for some
2339 /// guidelines.
2340 ///
2341 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2342 #[derive(Clone, Debug, PartialEq)]
2343 #[non_exhaustive]
2344 pub enum KeyManagementMode {
2345 /// Not specified.
2346 Unspecified,
2347 /// EKM-side key management operations on
2348 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2349 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] must be initiated from
2350 /// the EKM directly and cannot be performed from Cloud KMS. This means that:
2351 ///
2352 /// * When creating a
2353 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] associated with
2354 /// this
2355 /// [EkmConnection][google.cloud.kms.v1.EkmConnection], the caller must
2356 /// supply the key path of pre-existing external key material that will be
2357 /// linked to the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
2358 /// * Destruction of external key material cannot be requested via the
2359 /// Cloud KMS API and must be performed directly in the EKM.
2360 /// * Automatic rotation of key material is not supported.
2361 ///
2362 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2363 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2364 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2365 Manual,
2366 /// All [CryptoKeys][google.cloud.kms.v1.CryptoKey] created with this
2367 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] use EKM-side key
2368 /// management operations initiated from Cloud KMS. This means that:
2369 ///
2370 /// * When a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
2371 /// associated with this [EkmConnection][google.cloud.kms.v1.EkmConnection]
2372 /// is
2373 /// created, the EKM automatically generates new key material and a new
2374 /// key path. The caller cannot supply the key path of pre-existing
2375 /// external key material.
2376 /// * Destruction of external key material associated with this
2377 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] can be requested by
2378 /// calling
2379 /// [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
2380 /// * Automatic rotation of key material is supported.
2381 ///
2382 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2383 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2384 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2385 /// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
2386 CloudKms,
2387 /// If set, the enum was initialized with an unknown value.
2388 ///
2389 /// Applications can examine the value using [KeyManagementMode::value] or
2390 /// [KeyManagementMode::name].
2391 UnknownValue(key_management_mode::UnknownValue),
2392 }
2393
2394 #[doc(hidden)]
2395 pub mod key_management_mode {
2396 #[allow(unused_imports)]
2397 use super::*;
2398 #[derive(Clone, Debug, PartialEq)]
2399 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2400 }
2401
2402 impl KeyManagementMode {
2403 /// Gets the enum value.
2404 ///
2405 /// Returns `None` if the enum contains an unknown value deserialized from
2406 /// the string representation of enums.
2407 pub fn value(&self) -> std::option::Option<i32> {
2408 match self {
2409 Self::Unspecified => std::option::Option::Some(0),
2410 Self::Manual => std::option::Option::Some(1),
2411 Self::CloudKms => std::option::Option::Some(2),
2412 Self::UnknownValue(u) => u.0.value(),
2413 }
2414 }
2415
2416 /// Gets the enum value as a string.
2417 ///
2418 /// Returns `None` if the enum contains an unknown value deserialized from
2419 /// the integer representation of enums.
2420 pub fn name(&self) -> std::option::Option<&str> {
2421 match self {
2422 Self::Unspecified => std::option::Option::Some("KEY_MANAGEMENT_MODE_UNSPECIFIED"),
2423 Self::Manual => std::option::Option::Some("MANUAL"),
2424 Self::CloudKms => std::option::Option::Some("CLOUD_KMS"),
2425 Self::UnknownValue(u) => u.0.name(),
2426 }
2427 }
2428 }
2429
2430 impl std::default::Default for KeyManagementMode {
2431 fn default() -> Self {
2432 use std::convert::From;
2433 Self::from(0)
2434 }
2435 }
2436
2437 impl std::fmt::Display for KeyManagementMode {
2438 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2439 wkt::internal::display_enum(f, self.name(), self.value())
2440 }
2441 }
2442
2443 impl std::convert::From<i32> for KeyManagementMode {
2444 fn from(value: i32) -> Self {
2445 match value {
2446 0 => Self::Unspecified,
2447 1 => Self::Manual,
2448 2 => Self::CloudKms,
2449 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2450 wkt::internal::UnknownEnumValue::Integer(value),
2451 )),
2452 }
2453 }
2454 }
2455
2456 impl std::convert::From<&str> for KeyManagementMode {
2457 fn from(value: &str) -> Self {
2458 use std::string::ToString;
2459 match value {
2460 "KEY_MANAGEMENT_MODE_UNSPECIFIED" => Self::Unspecified,
2461 "MANUAL" => Self::Manual,
2462 "CLOUD_KMS" => Self::CloudKms,
2463 _ => Self::UnknownValue(key_management_mode::UnknownValue(
2464 wkt::internal::UnknownEnumValue::String(value.to_string()),
2465 )),
2466 }
2467 }
2468 }
2469
2470 impl serde::ser::Serialize for KeyManagementMode {
2471 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2472 where
2473 S: serde::Serializer,
2474 {
2475 match self {
2476 Self::Unspecified => serializer.serialize_i32(0),
2477 Self::Manual => serializer.serialize_i32(1),
2478 Self::CloudKms => serializer.serialize_i32(2),
2479 Self::UnknownValue(u) => u.0.serialize(serializer),
2480 }
2481 }
2482 }
2483
2484 impl<'de> serde::de::Deserialize<'de> for KeyManagementMode {
2485 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2486 where
2487 D: serde::Deserializer<'de>,
2488 {
2489 deserializer.deserialize_any(wkt::internal::EnumVisitor::<KeyManagementMode>::new(
2490 ".google.cloud.kms.v1.EkmConnection.KeyManagementMode",
2491 ))
2492 }
2493 }
2494}
2495
2496/// An [EkmConfig][google.cloud.kms.v1.EkmConfig] is a singleton resource that
2497/// represents configuration parameters that apply to all
2498/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
2499/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] with a
2500/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2501/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] in a given
2502/// project and location.
2503///
2504/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2505/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
2506/// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2507/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2508/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
2509#[derive(Clone, Default, PartialEq)]
2510#[non_exhaustive]
2511pub struct EkmConfig {
2512 /// Output only. The resource name for the
2513 /// [EkmConfig][google.cloud.kms.v1.EkmConfig] in the format
2514 /// `projects/*/locations/*/ekmConfig`.
2515 ///
2516 /// [google.cloud.kms.v1.EkmConfig]: crate::model::EkmConfig
2517 pub name: std::string::String,
2518
2519 /// Optional. Resource name of the default
2520 /// [EkmConnection][google.cloud.kms.v1.EkmConnection]. Setting this field to
2521 /// the empty string removes the default.
2522 ///
2523 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2524 pub default_ekm_connection: std::string::String,
2525
2526 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2527}
2528
2529impl EkmConfig {
2530 /// Creates a new default instance.
2531 pub fn new() -> Self {
2532 std::default::Default::default()
2533 }
2534
2535 /// Sets the value of [name][crate::model::EkmConfig::name].
2536 ///
2537 /// # Example
2538 /// ```ignore,no_run
2539 /// # use google_cloud_kms_v1::model::EkmConfig;
2540 /// # let project_id = "project_id";
2541 /// # let location_id = "location_id";
2542 /// let x = EkmConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConfig"));
2543 /// ```
2544 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2545 self.name = v.into();
2546 self
2547 }
2548
2549 /// Sets the value of [default_ekm_connection][crate::model::EkmConfig::default_ekm_connection].
2550 ///
2551 /// # Example
2552 /// ```ignore,no_run
2553 /// # use google_cloud_kms_v1::model::EkmConfig;
2554 /// # let project_id = "project_id";
2555 /// # let location_id = "location_id";
2556 /// # let ekm_connection_id = "ekm_connection_id";
2557 /// let x = EkmConfig::new().set_default_ekm_connection(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2558 /// ```
2559 pub fn set_default_ekm_connection<T: std::convert::Into<std::string::String>>(
2560 mut self,
2561 v: T,
2562 ) -> Self {
2563 self.default_ekm_connection = v.into();
2564 self
2565 }
2566}
2567
2568impl wkt::message::Message for EkmConfig {
2569 fn typename() -> &'static str {
2570 "type.googleapis.com/google.cloud.kms.v1.EkmConfig"
2571 }
2572}
2573
2574/// Request message for
2575/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2576///
2577/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2578#[derive(Clone, Default, PartialEq)]
2579#[non_exhaustive]
2580pub struct VerifyConnectivityRequest {
2581 /// Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the
2582 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] to verify.
2583 ///
2584 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
2585 /// [google.cloud.kms.v1.EkmConnection.name]: crate::model::EkmConnection::name
2586 pub name: std::string::String,
2587
2588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2589}
2590
2591impl VerifyConnectivityRequest {
2592 /// Creates a new default instance.
2593 pub fn new() -> Self {
2594 std::default::Default::default()
2595 }
2596
2597 /// Sets the value of [name][crate::model::VerifyConnectivityRequest::name].
2598 ///
2599 /// # Example
2600 /// ```ignore,no_run
2601 /// # use google_cloud_kms_v1::model::VerifyConnectivityRequest;
2602 /// # let project_id = "project_id";
2603 /// # let location_id = "location_id";
2604 /// # let ekm_connection_id = "ekm_connection_id";
2605 /// let x = VerifyConnectivityRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/ekmConnections/{ekm_connection_id}"));
2606 /// ```
2607 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2608 self.name = v.into();
2609 self
2610 }
2611}
2612
2613impl wkt::message::Message for VerifyConnectivityRequest {
2614 fn typename() -> &'static str {
2615 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityRequest"
2616 }
2617}
2618
2619/// Response message for
2620/// [EkmService.VerifyConnectivity][google.cloud.kms.v1.EkmService.VerifyConnectivity].
2621///
2622/// [google.cloud.kms.v1.EkmService.VerifyConnectivity]: crate::client::EkmService::verify_connectivity
2623#[derive(Clone, Default, PartialEq)]
2624#[non_exhaustive]
2625pub struct VerifyConnectivityResponse {
2626 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2627}
2628
2629impl VerifyConnectivityResponse {
2630 /// Creates a new default instance.
2631 pub fn new() -> Self {
2632 std::default::Default::default()
2633 }
2634}
2635
2636impl wkt::message::Message for VerifyConnectivityResponse {
2637 fn typename() -> &'static str {
2638 "type.googleapis.com/google.cloud.kms.v1.VerifyConnectivityResponse"
2639 }
2640}
2641
2642/// A [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
2643/// represents a single-tenant HSM instance. It can be used for creating
2644/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with a
2645/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
2646/// [HSM_SINGLE_TENANT][CryptoKeyVersion.ProtectionLevel.HSM_SINGLE_TENANT], as
2647/// well as performing cryptographic operations using keys created within the
2648/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2649///
2650/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
2651/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
2652/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2653#[derive(Clone, Default, PartialEq)]
2654#[non_exhaustive]
2655pub struct SingleTenantHsmInstance {
2656 /// Identifier. The resource name for this
2657 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
2658 /// the format `projects/*/locations/*/singleTenantHsmInstances/*`.
2659 ///
2660 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2661 pub name: std::string::String,
2662
2663 /// Output only. The time at which the
2664 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2665 /// created.
2666 ///
2667 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2668 pub create_time: std::option::Option<wkt::Timestamp>,
2669
2670 /// Output only. The state of the
2671 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2672 ///
2673 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2674 pub state: crate::model::single_tenant_hsm_instance::State,
2675
2676 /// Required. The quorum auth configuration for the
2677 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2678 ///
2679 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2680 pub quorum_auth: std::option::Option<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2681
2682 /// Output only. The time at which the
2683 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] was
2684 /// deleted.
2685 ///
2686 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2687 pub delete_time: std::option::Option<wkt::Timestamp>,
2688
2689 /// Output only. The system-defined duration that an instance can remain
2690 /// unrefreshed until it is automatically disabled. This will have a value of
2691 /// 730 days.
2692 pub unrefreshed_duration_until_disable: std::option::Option<wkt::Duration>,
2693
2694 /// Output only. The time at which the instance will be automatically disabled
2695 /// if not refreshed. This field is updated upon creation and after each
2696 /// successful refresh operation and enable. A
2697 /// [RefreshSingleTenantHsmInstance][] operation must be made via a
2698 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
2699 /// before this time otherwise the
2700 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
2701 /// become disabled.
2702 ///
2703 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2704 pub disable_time: std::option::Option<wkt::Timestamp>,
2705
2706 /// Optional. Immutable. Indicates whether key portability is enabled for the
2707 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
2708 /// This can only be set at creation time. Key portability features are
2709 /// disabled by default and not yet available in GA.
2710 ///
2711 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
2712 pub key_portability_enabled: bool,
2713
2714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2715}
2716
2717impl SingleTenantHsmInstance {
2718 /// Creates a new default instance.
2719 pub fn new() -> Self {
2720 std::default::Default::default()
2721 }
2722
2723 /// Sets the value of [name][crate::model::SingleTenantHsmInstance::name].
2724 ///
2725 /// # Example
2726 /// ```ignore,no_run
2727 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2728 /// # let project_id = "project_id";
2729 /// # let location_id = "location_id";
2730 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
2731 /// let x = SingleTenantHsmInstance::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
2732 /// ```
2733 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2734 self.name = v.into();
2735 self
2736 }
2737
2738 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2739 ///
2740 /// # Example
2741 /// ```ignore,no_run
2742 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2743 /// use wkt::Timestamp;
2744 /// let x = SingleTenantHsmInstance::new().set_create_time(Timestamp::default()/* use setters */);
2745 /// ```
2746 pub fn set_create_time<T>(mut self, v: T) -> Self
2747 where
2748 T: std::convert::Into<wkt::Timestamp>,
2749 {
2750 self.create_time = std::option::Option::Some(v.into());
2751 self
2752 }
2753
2754 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstance::create_time].
2755 ///
2756 /// # Example
2757 /// ```ignore,no_run
2758 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2759 /// use wkt::Timestamp;
2760 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2761 /// let x = SingleTenantHsmInstance::new().set_or_clear_create_time(None::<Timestamp>);
2762 /// ```
2763 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2764 where
2765 T: std::convert::Into<wkt::Timestamp>,
2766 {
2767 self.create_time = v.map(|x| x.into());
2768 self
2769 }
2770
2771 /// Sets the value of [state][crate::model::SingleTenantHsmInstance::state].
2772 ///
2773 /// # Example
2774 /// ```ignore,no_run
2775 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2776 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::State;
2777 /// let x0 = SingleTenantHsmInstance::new().set_state(State::Creating);
2778 /// let x1 = SingleTenantHsmInstance::new().set_state(State::PendingTwoFactorAuthRegistration);
2779 /// let x2 = SingleTenantHsmInstance::new().set_state(State::Active);
2780 /// ```
2781 pub fn set_state<T: std::convert::Into<crate::model::single_tenant_hsm_instance::State>>(
2782 mut self,
2783 v: T,
2784 ) -> Self {
2785 self.state = v.into();
2786 self
2787 }
2788
2789 /// Sets the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2790 ///
2791 /// # Example
2792 /// ```ignore,no_run
2793 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2794 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2795 /// let x = SingleTenantHsmInstance::new().set_quorum_auth(QuorumAuth::default()/* use setters */);
2796 /// ```
2797 pub fn set_quorum_auth<T>(mut self, v: T) -> Self
2798 where
2799 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2800 {
2801 self.quorum_auth = std::option::Option::Some(v.into());
2802 self
2803 }
2804
2805 /// Sets or clears the value of [quorum_auth][crate::model::SingleTenantHsmInstance::quorum_auth].
2806 ///
2807 /// # Example
2808 /// ```ignore,no_run
2809 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2810 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2811 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(Some(QuorumAuth::default()/* use setters */));
2812 /// let x = SingleTenantHsmInstance::new().set_or_clear_quorum_auth(None::<QuorumAuth>);
2813 /// ```
2814 pub fn set_or_clear_quorum_auth<T>(mut self, v: std::option::Option<T>) -> Self
2815 where
2816 T: std::convert::Into<crate::model::single_tenant_hsm_instance::QuorumAuth>,
2817 {
2818 self.quorum_auth = v.map(|x| x.into());
2819 self
2820 }
2821
2822 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2823 ///
2824 /// # Example
2825 /// ```ignore,no_run
2826 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2827 /// use wkt::Timestamp;
2828 /// let x = SingleTenantHsmInstance::new().set_delete_time(Timestamp::default()/* use setters */);
2829 /// ```
2830 pub fn set_delete_time<T>(mut self, v: T) -> Self
2831 where
2832 T: std::convert::Into<wkt::Timestamp>,
2833 {
2834 self.delete_time = std::option::Option::Some(v.into());
2835 self
2836 }
2837
2838 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstance::delete_time].
2839 ///
2840 /// # Example
2841 /// ```ignore,no_run
2842 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2843 /// use wkt::Timestamp;
2844 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
2845 /// let x = SingleTenantHsmInstance::new().set_or_clear_delete_time(None::<Timestamp>);
2846 /// ```
2847 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
2848 where
2849 T: std::convert::Into<wkt::Timestamp>,
2850 {
2851 self.delete_time = v.map(|x| x.into());
2852 self
2853 }
2854
2855 /// Sets the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2856 ///
2857 /// # Example
2858 /// ```ignore,no_run
2859 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2860 /// use wkt::Duration;
2861 /// let x = SingleTenantHsmInstance::new().set_unrefreshed_duration_until_disable(Duration::default()/* use setters */);
2862 /// ```
2863 pub fn set_unrefreshed_duration_until_disable<T>(mut self, v: T) -> Self
2864 where
2865 T: std::convert::Into<wkt::Duration>,
2866 {
2867 self.unrefreshed_duration_until_disable = std::option::Option::Some(v.into());
2868 self
2869 }
2870
2871 /// Sets or clears the value of [unrefreshed_duration_until_disable][crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable].
2872 ///
2873 /// # Example
2874 /// ```ignore,no_run
2875 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2876 /// use wkt::Duration;
2877 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(Some(Duration::default()/* use setters */));
2878 /// let x = SingleTenantHsmInstance::new().set_or_clear_unrefreshed_duration_until_disable(None::<Duration>);
2879 /// ```
2880 pub fn set_or_clear_unrefreshed_duration_until_disable<T>(
2881 mut self,
2882 v: std::option::Option<T>,
2883 ) -> Self
2884 where
2885 T: std::convert::Into<wkt::Duration>,
2886 {
2887 self.unrefreshed_duration_until_disable = v.map(|x| x.into());
2888 self
2889 }
2890
2891 /// Sets the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2892 ///
2893 /// # Example
2894 /// ```ignore,no_run
2895 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2896 /// use wkt::Timestamp;
2897 /// let x = SingleTenantHsmInstance::new().set_disable_time(Timestamp::default()/* use setters */);
2898 /// ```
2899 pub fn set_disable_time<T>(mut self, v: T) -> Self
2900 where
2901 T: std::convert::Into<wkt::Timestamp>,
2902 {
2903 self.disable_time = std::option::Option::Some(v.into());
2904 self
2905 }
2906
2907 /// Sets or clears the value of [disable_time][crate::model::SingleTenantHsmInstance::disable_time].
2908 ///
2909 /// # Example
2910 /// ```ignore,no_run
2911 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2912 /// use wkt::Timestamp;
2913 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(Some(Timestamp::default()/* use setters */));
2914 /// let x = SingleTenantHsmInstance::new().set_or_clear_disable_time(None::<Timestamp>);
2915 /// ```
2916 pub fn set_or_clear_disable_time<T>(mut self, v: std::option::Option<T>) -> Self
2917 where
2918 T: std::convert::Into<wkt::Timestamp>,
2919 {
2920 self.disable_time = v.map(|x| x.into());
2921 self
2922 }
2923
2924 /// Sets the value of [key_portability_enabled][crate::model::SingleTenantHsmInstance::key_portability_enabled].
2925 ///
2926 /// # Example
2927 /// ```ignore,no_run
2928 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstance;
2929 /// let x = SingleTenantHsmInstance::new().set_key_portability_enabled(true);
2930 /// ```
2931 pub fn set_key_portability_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2932 self.key_portability_enabled = v.into();
2933 self
2934 }
2935}
2936
2937impl wkt::message::Message for SingleTenantHsmInstance {
2938 fn typename() -> &'static str {
2939 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance"
2940 }
2941}
2942
2943/// Defines additional types related to [SingleTenantHsmInstance].
2944pub mod single_tenant_hsm_instance {
2945 #[allow(unused_imports)]
2946 use super::*;
2947
2948 /// Configuration for M of N quorum auth.
2949 #[derive(Clone, Default, PartialEq)]
2950 #[non_exhaustive]
2951 pub struct QuorumAuth {
2952 /// Required. The total number of approvers. This is the N value used
2953 /// for M of N quorum auth. Must be greater than or equal to 3 and less than
2954 /// or equal to 16.
2955 pub total_approver_count: i32,
2956
2957 /// Output only. The required numbers of approvers. The M value used for M of
2958 /// N quorum auth. Must be greater than or equal to 2 and less than or equal
2959 /// to
2960 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
2961 ///
2962 ///
2963 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
2964 pub required_approver_count: i32,
2965
2966 /// Output only. The public keys associated with the 2FA keys for M of N
2967 /// quorum auth.
2968 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
2969
2970 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2971 }
2972
2973 impl QuorumAuth {
2974 /// Creates a new default instance.
2975 pub fn new() -> Self {
2976 std::default::Default::default()
2977 }
2978
2979 /// Sets the value of [total_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count].
2980 ///
2981 /// # Example
2982 /// ```ignore,no_run
2983 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2984 /// let x = QuorumAuth::new().set_total_approver_count(42);
2985 /// ```
2986 pub fn set_total_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2987 self.total_approver_count = v.into();
2988 self
2989 }
2990
2991 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance::QuorumAuth::required_approver_count].
2992 ///
2993 /// # Example
2994 /// ```ignore,no_run
2995 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
2996 /// let x = QuorumAuth::new().set_required_approver_count(42);
2997 /// ```
2998 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2999 self.required_approver_count = v.into();
3000 self
3001 }
3002
3003 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance::QuorumAuth::two_factor_public_key_pems].
3004 ///
3005 /// # Example
3006 /// ```ignore,no_run
3007 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance::QuorumAuth;
3008 /// let x = QuorumAuth::new().set_two_factor_public_key_pems(["a", "b", "c"]);
3009 /// ```
3010 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
3011 where
3012 T: std::iter::IntoIterator<Item = V>,
3013 V: std::convert::Into<std::string::String>,
3014 {
3015 use std::iter::Iterator;
3016 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
3017 self
3018 }
3019 }
3020
3021 impl wkt::message::Message for QuorumAuth {
3022 fn typename() -> &'static str {
3023 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth"
3024 }
3025 }
3026
3027 /// The set of states of a
3028 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3029 ///
3030 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3031 ///
3032 /// # Working with unknown values
3033 ///
3034 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3035 /// additional enum variants at any time. Adding new variants is not considered
3036 /// a breaking change. Applications should write their code in anticipation of:
3037 ///
3038 /// - New values appearing in future releases of the client library, **and**
3039 /// - New values received dynamically, without application changes.
3040 ///
3041 /// Please consult the [Working with enums] section in the user guide for some
3042 /// guidelines.
3043 ///
3044 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3045 #[derive(Clone, Debug, PartialEq)]
3046 #[non_exhaustive]
3047 pub enum State {
3048 /// Not specified.
3049 Unspecified,
3050 /// The
3051 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3052 /// being created.
3053 ///
3054 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3055 Creating,
3056 /// The
3057 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3058 /// waiting for 2FA keys to be registered. This can be done by calling
3059 /// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
3060 /// with the [RegisterTwoFactorAuthKeys][] operation.
3061 ///
3062 /// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
3063 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3064 PendingTwoFactorAuthRegistration,
3065 /// The
3066 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3067 /// ready to use. A
3068 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3069 /// must be in the
3070 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
3071 /// for all [CryptoKeys][google.cloud.kms.v1.CryptoKey] created within the
3072 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] to
3073 /// be usable.
3074 ///
3075 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
3076 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3077 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
3078 Active,
3079 /// The
3080 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3081 /// being disabled.
3082 ///
3083 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3084 Disabling,
3085 /// The
3086 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3087 /// disabled.
3088 ///
3089 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3090 Disabled,
3091 /// The
3092 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] is
3093 /// being deleted. Requests to the instance will be rejected in this state.
3094 ///
3095 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3096 Deleting,
3097 /// The
3098 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3099 /// has been deleted.
3100 ///
3101 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3102 Deleted,
3103 /// The
3104 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
3105 /// has failed and can not be recovered or used.
3106 ///
3107 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3108 Failed,
3109 /// If set, the enum was initialized with an unknown value.
3110 ///
3111 /// Applications can examine the value using [State::value] or
3112 /// [State::name].
3113 UnknownValue(state::UnknownValue),
3114 }
3115
3116 #[doc(hidden)]
3117 pub mod state {
3118 #[allow(unused_imports)]
3119 use super::*;
3120 #[derive(Clone, Debug, PartialEq)]
3121 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3122 }
3123
3124 impl State {
3125 /// Gets the enum value.
3126 ///
3127 /// Returns `None` if the enum contains an unknown value deserialized from
3128 /// the string representation of enums.
3129 pub fn value(&self) -> std::option::Option<i32> {
3130 match self {
3131 Self::Unspecified => std::option::Option::Some(0),
3132 Self::Creating => std::option::Option::Some(1),
3133 Self::PendingTwoFactorAuthRegistration => std::option::Option::Some(2),
3134 Self::Active => std::option::Option::Some(3),
3135 Self::Disabling => std::option::Option::Some(4),
3136 Self::Disabled => std::option::Option::Some(5),
3137 Self::Deleting => std::option::Option::Some(6),
3138 Self::Deleted => std::option::Option::Some(7),
3139 Self::Failed => std::option::Option::Some(8),
3140 Self::UnknownValue(u) => u.0.value(),
3141 }
3142 }
3143
3144 /// Gets the enum value as a string.
3145 ///
3146 /// Returns `None` if the enum contains an unknown value deserialized from
3147 /// the integer representation of enums.
3148 pub fn name(&self) -> std::option::Option<&str> {
3149 match self {
3150 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3151 Self::Creating => std::option::Option::Some("CREATING"),
3152 Self::PendingTwoFactorAuthRegistration => {
3153 std::option::Option::Some("PENDING_TWO_FACTOR_AUTH_REGISTRATION")
3154 }
3155 Self::Active => std::option::Option::Some("ACTIVE"),
3156 Self::Disabling => std::option::Option::Some("DISABLING"),
3157 Self::Disabled => std::option::Option::Some("DISABLED"),
3158 Self::Deleting => std::option::Option::Some("DELETING"),
3159 Self::Deleted => std::option::Option::Some("DELETED"),
3160 Self::Failed => std::option::Option::Some("FAILED"),
3161 Self::UnknownValue(u) => u.0.name(),
3162 }
3163 }
3164 }
3165
3166 impl std::default::Default for State {
3167 fn default() -> Self {
3168 use std::convert::From;
3169 Self::from(0)
3170 }
3171 }
3172
3173 impl std::fmt::Display for State {
3174 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3175 wkt::internal::display_enum(f, self.name(), self.value())
3176 }
3177 }
3178
3179 impl std::convert::From<i32> for State {
3180 fn from(value: i32) -> Self {
3181 match value {
3182 0 => Self::Unspecified,
3183 1 => Self::Creating,
3184 2 => Self::PendingTwoFactorAuthRegistration,
3185 3 => Self::Active,
3186 4 => Self::Disabling,
3187 5 => Self::Disabled,
3188 6 => Self::Deleting,
3189 7 => Self::Deleted,
3190 8 => Self::Failed,
3191 _ => Self::UnknownValue(state::UnknownValue(
3192 wkt::internal::UnknownEnumValue::Integer(value),
3193 )),
3194 }
3195 }
3196 }
3197
3198 impl std::convert::From<&str> for State {
3199 fn from(value: &str) -> Self {
3200 use std::string::ToString;
3201 match value {
3202 "STATE_UNSPECIFIED" => Self::Unspecified,
3203 "CREATING" => Self::Creating,
3204 "PENDING_TWO_FACTOR_AUTH_REGISTRATION" => Self::PendingTwoFactorAuthRegistration,
3205 "ACTIVE" => Self::Active,
3206 "DISABLING" => Self::Disabling,
3207 "DISABLED" => Self::Disabled,
3208 "DELETING" => Self::Deleting,
3209 "DELETED" => Self::Deleted,
3210 "FAILED" => Self::Failed,
3211 _ => Self::UnknownValue(state::UnknownValue(
3212 wkt::internal::UnknownEnumValue::String(value.to_string()),
3213 )),
3214 }
3215 }
3216 }
3217
3218 impl serde::ser::Serialize for State {
3219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3220 where
3221 S: serde::Serializer,
3222 {
3223 match self {
3224 Self::Unspecified => serializer.serialize_i32(0),
3225 Self::Creating => serializer.serialize_i32(1),
3226 Self::PendingTwoFactorAuthRegistration => serializer.serialize_i32(2),
3227 Self::Active => serializer.serialize_i32(3),
3228 Self::Disabling => serializer.serialize_i32(4),
3229 Self::Disabled => serializer.serialize_i32(5),
3230 Self::Deleting => serializer.serialize_i32(6),
3231 Self::Deleted => serializer.serialize_i32(7),
3232 Self::Failed => serializer.serialize_i32(8),
3233 Self::UnknownValue(u) => u.0.serialize(serializer),
3234 }
3235 }
3236 }
3237
3238 impl<'de> serde::de::Deserialize<'de> for State {
3239 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3240 where
3241 D: serde::Deserializer<'de>,
3242 {
3243 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3244 ".google.cloud.kms.v1.SingleTenantHsmInstance.State",
3245 ))
3246 }
3247 }
3248}
3249
3250/// A
3251/// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3252/// represents a proposal to perform an operation on a
3253/// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3254///
3255/// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3256/// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3257#[derive(Clone, Default, PartialEq)]
3258#[non_exhaustive]
3259pub struct SingleTenantHsmInstanceProposal {
3260 /// Identifier. The resource name for this
3261 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] in
3262 /// the format `projects/*/locations/*/singleTenantHsmInstances/*/proposals/*`.
3263 ///
3264 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3265 pub name: std::string::String,
3266
3267 /// Output only. The time at which the
3268 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3269 /// was created.
3270 ///
3271 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3272 pub create_time: std::option::Option<wkt::Timestamp>,
3273
3274 /// Output only. The state of the
3275 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3276 ///
3277 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3278 pub state: crate::model::single_tenant_hsm_instance_proposal::State,
3279
3280 /// Output only. The root cause of the most recent failure. Only present if
3281 /// [state][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state] is
3282 /// [FAILED][SingleTenantHsmInstanceProposal.FAILED].
3283 ///
3284 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.state]: crate::model::SingleTenantHsmInstanceProposal::state
3285 pub failure_reason: std::string::String,
3286
3287 /// Output only. The time at which the
3288 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3289 /// was deleted.
3290 ///
3291 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3292 pub delete_time: std::option::Option<wkt::Timestamp>,
3293
3294 /// Output only. The time at which the soft-deleted
3295 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3296 /// will be permanently purged. This field is only populated
3297 /// when the state is DELETED and will be set a time after expiration of the
3298 /// proposal, i.e. >= expire_time or (create_time + ttl).
3299 ///
3300 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3301 pub purge_time: std::option::Option<wkt::Timestamp>,
3302
3303 /// The approval parameters for the
3304 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3305 /// The type of parameters is determined by the operation being proposed.
3306 ///
3307 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3308 pub approval_parameters:
3309 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters>,
3310
3311 /// The expiration of the
3312 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
3313 /// If not set, the
3314 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
3315 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
3316 /// time is 5 minutes.
3317 ///
3318 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
3319 pub expiration:
3320 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3321
3322 /// The operation to perform on the
3323 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
3324 ///
3325 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
3326 pub operation:
3327 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3328
3329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3330}
3331
3332impl SingleTenantHsmInstanceProposal {
3333 /// Creates a new default instance.
3334 pub fn new() -> Self {
3335 std::default::Default::default()
3336 }
3337
3338 /// Sets the value of [name][crate::model::SingleTenantHsmInstanceProposal::name].
3339 ///
3340 /// # Example
3341 /// ```ignore,no_run
3342 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3343 /// # let project_id = "project_id";
3344 /// # let location_id = "location_id";
3345 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
3346 /// # let proposal_id = "proposal_id";
3347 /// let x = SingleTenantHsmInstanceProposal::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
3348 /// ```
3349 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3350 self.name = v.into();
3351 self
3352 }
3353
3354 /// Sets the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3355 ///
3356 /// # Example
3357 /// ```ignore,no_run
3358 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3359 /// use wkt::Timestamp;
3360 /// let x = SingleTenantHsmInstanceProposal::new().set_create_time(Timestamp::default()/* use setters */);
3361 /// ```
3362 pub fn set_create_time<T>(mut self, v: T) -> Self
3363 where
3364 T: std::convert::Into<wkt::Timestamp>,
3365 {
3366 self.create_time = std::option::Option::Some(v.into());
3367 self
3368 }
3369
3370 /// Sets or clears the value of [create_time][crate::model::SingleTenantHsmInstanceProposal::create_time].
3371 ///
3372 /// # Example
3373 /// ```ignore,no_run
3374 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3375 /// use wkt::Timestamp;
3376 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
3377 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_create_time(None::<Timestamp>);
3378 /// ```
3379 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3380 where
3381 T: std::convert::Into<wkt::Timestamp>,
3382 {
3383 self.create_time = v.map(|x| x.into());
3384 self
3385 }
3386
3387 /// Sets the value of [state][crate::model::SingleTenantHsmInstanceProposal::state].
3388 ///
3389 /// # Example
3390 /// ```ignore,no_run
3391 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3392 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::State;
3393 /// let x0 = SingleTenantHsmInstanceProposal::new().set_state(State::Creating);
3394 /// let x1 = SingleTenantHsmInstanceProposal::new().set_state(State::Pending);
3395 /// let x2 = SingleTenantHsmInstanceProposal::new().set_state(State::Approved);
3396 /// ```
3397 pub fn set_state<
3398 T: std::convert::Into<crate::model::single_tenant_hsm_instance_proposal::State>,
3399 >(
3400 mut self,
3401 v: T,
3402 ) -> Self {
3403 self.state = v.into();
3404 self
3405 }
3406
3407 /// Sets the value of [failure_reason][crate::model::SingleTenantHsmInstanceProposal::failure_reason].
3408 ///
3409 /// # Example
3410 /// ```ignore,no_run
3411 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3412 /// let x = SingleTenantHsmInstanceProposal::new().set_failure_reason("example");
3413 /// ```
3414 pub fn set_failure_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3415 self.failure_reason = v.into();
3416 self
3417 }
3418
3419 /// Sets the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3420 ///
3421 /// # Example
3422 /// ```ignore,no_run
3423 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3424 /// use wkt::Timestamp;
3425 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_time(Timestamp::default()/* use setters */);
3426 /// ```
3427 pub fn set_delete_time<T>(mut self, v: T) -> Self
3428 where
3429 T: std::convert::Into<wkt::Timestamp>,
3430 {
3431 self.delete_time = std::option::Option::Some(v.into());
3432 self
3433 }
3434
3435 /// Sets or clears the value of [delete_time][crate::model::SingleTenantHsmInstanceProposal::delete_time].
3436 ///
3437 /// # Example
3438 /// ```ignore,no_run
3439 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3440 /// use wkt::Timestamp;
3441 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
3442 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_delete_time(None::<Timestamp>);
3443 /// ```
3444 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
3445 where
3446 T: std::convert::Into<wkt::Timestamp>,
3447 {
3448 self.delete_time = v.map(|x| x.into());
3449 self
3450 }
3451
3452 /// Sets the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3453 ///
3454 /// # Example
3455 /// ```ignore,no_run
3456 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3457 /// use wkt::Timestamp;
3458 /// let x = SingleTenantHsmInstanceProposal::new().set_purge_time(Timestamp::default()/* use setters */);
3459 /// ```
3460 pub fn set_purge_time<T>(mut self, v: T) -> Self
3461 where
3462 T: std::convert::Into<wkt::Timestamp>,
3463 {
3464 self.purge_time = std::option::Option::Some(v.into());
3465 self
3466 }
3467
3468 /// Sets or clears the value of [purge_time][crate::model::SingleTenantHsmInstanceProposal::purge_time].
3469 ///
3470 /// # Example
3471 /// ```ignore,no_run
3472 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3473 /// use wkt::Timestamp;
3474 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(Some(Timestamp::default()/* use setters */));
3475 /// let x = SingleTenantHsmInstanceProposal::new().set_or_clear_purge_time(None::<Timestamp>);
3476 /// ```
3477 pub fn set_or_clear_purge_time<T>(mut self, v: std::option::Option<T>) -> Self
3478 where
3479 T: std::convert::Into<wkt::Timestamp>,
3480 {
3481 self.purge_time = v.map(|x| x.into());
3482 self
3483 }
3484
3485 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters].
3486 ///
3487 /// Note that all the setters affecting `approval_parameters` are mutually
3488 /// exclusive.
3489 ///
3490 /// # Example
3491 /// ```ignore,no_run
3492 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3493 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3494 /// let x = SingleTenantHsmInstanceProposal::new().set_approval_parameters(Some(
3495 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(QuorumParameters::default().into())));
3496 /// ```
3497 pub fn set_approval_parameters<
3498 T: std::convert::Into<
3499 std::option::Option<
3500 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters,
3501 >,
3502 >,
3503 >(
3504 mut self,
3505 v: T,
3506 ) -> Self {
3507 self.approval_parameters = v.into();
3508 self
3509 }
3510
3511 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3512 /// if it holds a `QuorumParameters`, `None` if the field is not set or
3513 /// holds a different branch.
3514 pub fn quorum_parameters(
3515 &self,
3516 ) -> std::option::Option<
3517 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
3518 > {
3519 #[allow(unreachable_patterns)]
3520 self.approval_parameters.as_ref().and_then(|v| match v {
3521 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(v) => std::option::Option::Some(v),
3522 _ => std::option::Option::None,
3523 })
3524 }
3525
3526 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3527 /// to hold a `QuorumParameters`.
3528 ///
3529 /// Note that all the setters affecting `approval_parameters` are
3530 /// mutually exclusive.
3531 ///
3532 /// # Example
3533 /// ```ignore,no_run
3534 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3535 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
3536 /// let x = SingleTenantHsmInstanceProposal::new().set_quorum_parameters(QuorumParameters::default()/* use setters */);
3537 /// assert!(x.quorum_parameters().is_some());
3538 /// assert!(x.required_action_quorum_parameters().is_none());
3539 /// ```
3540 pub fn set_quorum_parameters<
3541 T: std::convert::Into<
3542 std::boxed::Box<
3543 crate::model::single_tenant_hsm_instance_proposal::QuorumParameters,
3544 >,
3545 >,
3546 >(
3547 mut self,
3548 v: T,
3549 ) -> Self {
3550 self.approval_parameters = std::option::Option::Some(
3551 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::QuorumParameters(
3552 v.into(),
3553 ),
3554 );
3555 self
3556 }
3557
3558 /// The value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3559 /// if it holds a `RequiredActionQuorumParameters`, `None` if the field is not set or
3560 /// holds a different branch.
3561 pub fn required_action_quorum_parameters(
3562 &self,
3563 ) -> std::option::Option<
3564 &std::boxed::Box<
3565 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
3566 >,
3567 > {
3568 #[allow(unreachable_patterns)]
3569 self.approval_parameters.as_ref().and_then(|v| match v {
3570 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(v) => std::option::Option::Some(v),
3571 _ => std::option::Option::None,
3572 })
3573 }
3574
3575 /// Sets the value of [approval_parameters][crate::model::SingleTenantHsmInstanceProposal::approval_parameters]
3576 /// to hold a `RequiredActionQuorumParameters`.
3577 ///
3578 /// Note that all the setters affecting `approval_parameters` are
3579 /// mutually exclusive.
3580 ///
3581 /// # Example
3582 /// ```ignore,no_run
3583 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3584 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
3585 /// let x = SingleTenantHsmInstanceProposal::new().set_required_action_quorum_parameters(RequiredActionQuorumParameters::default()/* use setters */);
3586 /// assert!(x.required_action_quorum_parameters().is_some());
3587 /// assert!(x.quorum_parameters().is_none());
3588 /// ```
3589 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{
3590 self.approval_parameters = std::option::Option::Some(
3591 crate::model::single_tenant_hsm_instance_proposal::ApprovalParameters::RequiredActionQuorumParameters(
3592 v.into()
3593 )
3594 );
3595 self
3596 }
3597
3598 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration].
3599 ///
3600 /// Note that all the setters affecting `expiration` are mutually
3601 /// exclusive.
3602 ///
3603 /// # Example
3604 /// ```ignore,no_run
3605 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3606 /// use wkt::Timestamp;
3607 /// let x = SingleTenantHsmInstanceProposal::new().set_expiration(Some(
3608 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(Timestamp::default().into())));
3609 /// ```
3610 pub fn set_expiration<
3611 T: std::convert::Into<
3612 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Expiration>,
3613 >,
3614 >(
3615 mut self,
3616 v: T,
3617 ) -> Self {
3618 self.expiration = v.into();
3619 self
3620 }
3621
3622 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3623 /// if it holds a `ExpireTime`, `None` if the field is not set or
3624 /// holds a different branch.
3625 pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
3626 #[allow(unreachable_patterns)]
3627 self.expiration.as_ref().and_then(|v| match v {
3628 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v) => {
3629 std::option::Option::Some(v)
3630 }
3631 _ => std::option::Option::None,
3632 })
3633 }
3634
3635 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3636 /// to hold a `ExpireTime`.
3637 ///
3638 /// Note that all the setters affecting `expiration` are
3639 /// mutually exclusive.
3640 ///
3641 /// # Example
3642 /// ```ignore,no_run
3643 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3644 /// use wkt::Timestamp;
3645 /// let x = SingleTenantHsmInstanceProposal::new().set_expire_time(Timestamp::default()/* use setters */);
3646 /// assert!(x.expire_time().is_some());
3647 /// assert!(x.ttl().is_none());
3648 /// ```
3649 pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
3650 mut self,
3651 v: T,
3652 ) -> Self {
3653 self.expiration = std::option::Option::Some(
3654 crate::model::single_tenant_hsm_instance_proposal::Expiration::ExpireTime(v.into()),
3655 );
3656 self
3657 }
3658
3659 /// The value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3660 /// if it holds a `Ttl`, `None` if the field is not set or
3661 /// holds a different branch.
3662 pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
3663 #[allow(unreachable_patterns)]
3664 self.expiration.as_ref().and_then(|v| match v {
3665 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v) => {
3666 std::option::Option::Some(v)
3667 }
3668 _ => std::option::Option::None,
3669 })
3670 }
3671
3672 /// Sets the value of [expiration][crate::model::SingleTenantHsmInstanceProposal::expiration]
3673 /// to hold a `Ttl`.
3674 ///
3675 /// Note that all the setters affecting `expiration` are
3676 /// mutually exclusive.
3677 ///
3678 /// # Example
3679 /// ```ignore,no_run
3680 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3681 /// use wkt::Duration;
3682 /// let x = SingleTenantHsmInstanceProposal::new().set_ttl(Duration::default()/* use setters */);
3683 /// assert!(x.ttl().is_some());
3684 /// assert!(x.expire_time().is_none());
3685 /// ```
3686 pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
3687 self.expiration = std::option::Option::Some(
3688 crate::model::single_tenant_hsm_instance_proposal::Expiration::Ttl(v.into()),
3689 );
3690 self
3691 }
3692
3693 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation].
3694 ///
3695 /// Note that all the setters affecting `operation` are mutually
3696 /// exclusive.
3697 ///
3698 /// # Example
3699 /// ```ignore,no_run
3700 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3701 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3702 /// let x = SingleTenantHsmInstanceProposal::new().set_operation(Some(
3703 /// google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(RegisterTwoFactorAuthKeys::default().into())));
3704 /// ```
3705 pub fn set_operation<
3706 T: std::convert::Into<
3707 std::option::Option<crate::model::single_tenant_hsm_instance_proposal::Operation>,
3708 >,
3709 >(
3710 mut self,
3711 v: T,
3712 ) -> Self {
3713 self.operation = v.into();
3714 self
3715 }
3716
3717 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3718 /// if it holds a `RegisterTwoFactorAuthKeys`, `None` if the field is not set or
3719 /// holds a different branch.
3720 pub fn register_two_factor_auth_keys(
3721 &self,
3722 ) -> std::option::Option<
3723 &std::boxed::Box<
3724 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3725 >,
3726 > {
3727 #[allow(unreachable_patterns)]
3728 self.operation.as_ref().and_then(|v| match v {
3729 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(v) => std::option::Option::Some(v),
3730 _ => std::option::Option::None,
3731 })
3732 }
3733
3734 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3735 /// to hold a `RegisterTwoFactorAuthKeys`.
3736 ///
3737 /// Note that all the setters affecting `operation` are
3738 /// mutually exclusive.
3739 ///
3740 /// # Example
3741 /// ```ignore,no_run
3742 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3743 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
3744 /// let x = SingleTenantHsmInstanceProposal::new().set_register_two_factor_auth_keys(RegisterTwoFactorAuthKeys::default()/* use setters */);
3745 /// assert!(x.register_two_factor_auth_keys().is_some());
3746 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3747 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3748 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3749 /// assert!(x.add_quorum_member().is_none());
3750 /// assert!(x.remove_quorum_member().is_none());
3751 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3752 /// ```
3753 pub fn set_register_two_factor_auth_keys<
3754 T: std::convert::Into<
3755 std::boxed::Box<
3756 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
3757 >,
3758 >,
3759 >(
3760 mut self,
3761 v: T,
3762 ) -> Self {
3763 self.operation = std::option::Option::Some(
3764 crate::model::single_tenant_hsm_instance_proposal::Operation::RegisterTwoFactorAuthKeys(
3765 v.into(),
3766 ),
3767 );
3768 self
3769 }
3770
3771 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3772 /// if it holds a `DisableSingleTenantHsmInstance`, `None` if the field is not set or
3773 /// holds a different branch.
3774 pub fn disable_single_tenant_hsm_instance(
3775 &self,
3776 ) -> std::option::Option<
3777 &std::boxed::Box<
3778 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
3779 >,
3780 > {
3781 #[allow(unreachable_patterns)]
3782 self.operation.as_ref().and_then(|v| match v {
3783 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3784 _ => std::option::Option::None,
3785 })
3786 }
3787
3788 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3789 /// to hold a `DisableSingleTenantHsmInstance`.
3790 ///
3791 /// Note that all the setters affecting `operation` are
3792 /// mutually exclusive.
3793 ///
3794 /// # Example
3795 /// ```ignore,no_run
3796 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3797 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance;
3798 /// let x = SingleTenantHsmInstanceProposal::new().set_disable_single_tenant_hsm_instance(DisableSingleTenantHsmInstance::default()/* use setters */);
3799 /// assert!(x.disable_single_tenant_hsm_instance().is_some());
3800 /// assert!(x.register_two_factor_auth_keys().is_none());
3801 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3802 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3803 /// assert!(x.add_quorum_member().is_none());
3804 /// assert!(x.remove_quorum_member().is_none());
3805 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3806 /// ```
3807 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{
3808 self.operation = std::option::Option::Some(
3809 crate::model::single_tenant_hsm_instance_proposal::Operation::DisableSingleTenantHsmInstance(
3810 v.into()
3811 )
3812 );
3813 self
3814 }
3815
3816 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3817 /// if it holds a `EnableSingleTenantHsmInstance`, `None` if the field is not set or
3818 /// holds a different branch.
3819 pub fn enable_single_tenant_hsm_instance(
3820 &self,
3821 ) -> std::option::Option<
3822 &std::boxed::Box<
3823 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
3824 >,
3825 > {
3826 #[allow(unreachable_patterns)]
3827 self.operation.as_ref().and_then(|v| match v {
3828 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3829 _ => std::option::Option::None,
3830 })
3831 }
3832
3833 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3834 /// to hold a `EnableSingleTenantHsmInstance`.
3835 ///
3836 /// Note that all the setters affecting `operation` are
3837 /// mutually exclusive.
3838 ///
3839 /// # Example
3840 /// ```ignore,no_run
3841 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3842 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance;
3843 /// let x = SingleTenantHsmInstanceProposal::new().set_enable_single_tenant_hsm_instance(EnableSingleTenantHsmInstance::default()/* use setters */);
3844 /// assert!(x.enable_single_tenant_hsm_instance().is_some());
3845 /// assert!(x.register_two_factor_auth_keys().is_none());
3846 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3847 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3848 /// assert!(x.add_quorum_member().is_none());
3849 /// assert!(x.remove_quorum_member().is_none());
3850 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3851 /// ```
3852 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{
3853 self.operation = std::option::Option::Some(
3854 crate::model::single_tenant_hsm_instance_proposal::Operation::EnableSingleTenantHsmInstance(
3855 v.into()
3856 )
3857 );
3858 self
3859 }
3860
3861 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3862 /// if it holds a `DeleteSingleTenantHsmInstance`, `None` if the field is not set or
3863 /// holds a different branch.
3864 pub fn delete_single_tenant_hsm_instance(
3865 &self,
3866 ) -> std::option::Option<
3867 &std::boxed::Box<
3868 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
3869 >,
3870 > {
3871 #[allow(unreachable_patterns)]
3872 self.operation.as_ref().and_then(|v| match v {
3873 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(v) => std::option::Option::Some(v),
3874 _ => std::option::Option::None,
3875 })
3876 }
3877
3878 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3879 /// to hold a `DeleteSingleTenantHsmInstance`.
3880 ///
3881 /// Note that all the setters affecting `operation` are
3882 /// mutually exclusive.
3883 ///
3884 /// # Example
3885 /// ```ignore,no_run
3886 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3887 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance;
3888 /// let x = SingleTenantHsmInstanceProposal::new().set_delete_single_tenant_hsm_instance(DeleteSingleTenantHsmInstance::default()/* use setters */);
3889 /// assert!(x.delete_single_tenant_hsm_instance().is_some());
3890 /// assert!(x.register_two_factor_auth_keys().is_none());
3891 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3892 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3893 /// assert!(x.add_quorum_member().is_none());
3894 /// assert!(x.remove_quorum_member().is_none());
3895 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3896 /// ```
3897 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{
3898 self.operation = std::option::Option::Some(
3899 crate::model::single_tenant_hsm_instance_proposal::Operation::DeleteSingleTenantHsmInstance(
3900 v.into()
3901 )
3902 );
3903 self
3904 }
3905
3906 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3907 /// if it holds a `AddQuorumMember`, `None` if the field is not set or
3908 /// holds a different branch.
3909 pub fn add_quorum_member(
3910 &self,
3911 ) -> std::option::Option<
3912 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3913 > {
3914 #[allow(unreachable_patterns)]
3915 self.operation.as_ref().and_then(|v| match v {
3916 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v) => {
3917 std::option::Option::Some(v)
3918 }
3919 _ => std::option::Option::None,
3920 })
3921 }
3922
3923 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3924 /// to hold a `AddQuorumMember`.
3925 ///
3926 /// Note that all the setters affecting `operation` are
3927 /// mutually exclusive.
3928 ///
3929 /// # Example
3930 /// ```ignore,no_run
3931 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3932 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
3933 /// let x = SingleTenantHsmInstanceProposal::new().set_add_quorum_member(AddQuorumMember::default()/* use setters */);
3934 /// assert!(x.add_quorum_member().is_some());
3935 /// assert!(x.register_two_factor_auth_keys().is_none());
3936 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3937 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3938 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3939 /// assert!(x.remove_quorum_member().is_none());
3940 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3941 /// ```
3942 pub fn set_add_quorum_member<
3943 T: std::convert::Into<
3944 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
3945 >,
3946 >(
3947 mut self,
3948 v: T,
3949 ) -> Self {
3950 self.operation = std::option::Option::Some(
3951 crate::model::single_tenant_hsm_instance_proposal::Operation::AddQuorumMember(v.into()),
3952 );
3953 self
3954 }
3955
3956 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3957 /// if it holds a `RemoveQuorumMember`, `None` if the field is not set or
3958 /// holds a different branch.
3959 pub fn remove_quorum_member(
3960 &self,
3961 ) -> std::option::Option<
3962 &std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
3963 > {
3964 #[allow(unreachable_patterns)]
3965 self.operation.as_ref().and_then(|v| match v {
3966 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(v) => {
3967 std::option::Option::Some(v)
3968 }
3969 _ => std::option::Option::None,
3970 })
3971 }
3972
3973 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
3974 /// to hold a `RemoveQuorumMember`.
3975 ///
3976 /// Note that all the setters affecting `operation` are
3977 /// mutually exclusive.
3978 ///
3979 /// # Example
3980 /// ```ignore,no_run
3981 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
3982 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
3983 /// let x = SingleTenantHsmInstanceProposal::new().set_remove_quorum_member(RemoveQuorumMember::default()/* use setters */);
3984 /// assert!(x.remove_quorum_member().is_some());
3985 /// assert!(x.register_two_factor_auth_keys().is_none());
3986 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
3987 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
3988 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
3989 /// assert!(x.add_quorum_member().is_none());
3990 /// assert!(x.refresh_single_tenant_hsm_instance().is_none());
3991 /// ```
3992 pub fn set_remove_quorum_member<
3993 T: std::convert::Into<
3994 std::boxed::Box<
3995 crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember,
3996 >,
3997 >,
3998 >(
3999 mut self,
4000 v: T,
4001 ) -> Self {
4002 self.operation = std::option::Option::Some(
4003 crate::model::single_tenant_hsm_instance_proposal::Operation::RemoveQuorumMember(
4004 v.into(),
4005 ),
4006 );
4007 self
4008 }
4009
4010 /// The value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4011 /// if it holds a `RefreshSingleTenantHsmInstance`, `None` if the field is not set or
4012 /// holds a different branch.
4013 pub fn refresh_single_tenant_hsm_instance(
4014 &self,
4015 ) -> std::option::Option<
4016 &std::boxed::Box<
4017 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4018 >,
4019 > {
4020 #[allow(unreachable_patterns)]
4021 self.operation.as_ref().and_then(|v| match v {
4022 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(v) => std::option::Option::Some(v),
4023 _ => std::option::Option::None,
4024 })
4025 }
4026
4027 /// Sets the value of [operation][crate::model::SingleTenantHsmInstanceProposal::operation]
4028 /// to hold a `RefreshSingleTenantHsmInstance`.
4029 ///
4030 /// Note that all the setters affecting `operation` are
4031 /// mutually exclusive.
4032 ///
4033 /// # Example
4034 /// ```ignore,no_run
4035 /// # use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
4036 /// use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance;
4037 /// let x = SingleTenantHsmInstanceProposal::new().set_refresh_single_tenant_hsm_instance(RefreshSingleTenantHsmInstance::default()/* use setters */);
4038 /// assert!(x.refresh_single_tenant_hsm_instance().is_some());
4039 /// assert!(x.register_two_factor_auth_keys().is_none());
4040 /// assert!(x.disable_single_tenant_hsm_instance().is_none());
4041 /// assert!(x.enable_single_tenant_hsm_instance().is_none());
4042 /// assert!(x.delete_single_tenant_hsm_instance().is_none());
4043 /// assert!(x.add_quorum_member().is_none());
4044 /// assert!(x.remove_quorum_member().is_none());
4045 /// ```
4046 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{
4047 self.operation = std::option::Option::Some(
4048 crate::model::single_tenant_hsm_instance_proposal::Operation::RefreshSingleTenantHsmInstance(
4049 v.into()
4050 )
4051 );
4052 self
4053 }
4054}
4055
4056impl wkt::message::Message for SingleTenantHsmInstanceProposal {
4057 fn typename() -> &'static str {
4058 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal"
4059 }
4060}
4061
4062/// Defines additional types related to [SingleTenantHsmInstanceProposal].
4063pub mod single_tenant_hsm_instance_proposal {
4064 #[allow(unused_imports)]
4065 use super::*;
4066
4067 /// Parameters of quorum approval for the
4068 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4069 ///
4070 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4071 #[derive(Clone, Default, PartialEq)]
4072 #[non_exhaustive]
4073 pub struct QuorumParameters {
4074 /// Output only. The required numbers of approvers. This is the M value used
4075 /// for M of N quorum auth. It is less than the number of public keys.
4076 pub required_approver_count: i32,
4077
4078 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4079 /// of N of these challenges are required to be signed to approve the
4080 /// operation.
4081 pub challenges: std::vec::Vec<crate::model::Challenge>,
4082
4083 /// Output only. The public keys associated with the 2FA keys that have
4084 /// already approved the
4085 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4086 /// by signing the challenge.
4087 ///
4088 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4089 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4090
4091 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4092 }
4093
4094 impl QuorumParameters {
4095 /// Creates a new default instance.
4096 pub fn new() -> Self {
4097 std::default::Default::default()
4098 }
4099
4100 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count].
4101 ///
4102 /// # Example
4103 /// ```ignore,no_run
4104 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4105 /// let x = QuorumParameters::new().set_required_approver_count(42);
4106 /// ```
4107 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4108 self.required_approver_count = v.into();
4109 self
4110 }
4111
4112 /// Sets the value of [challenges][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::challenges].
4113 ///
4114 /// # Example
4115 /// ```ignore,no_run
4116 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4117 /// use google_cloud_kms_v1::model::Challenge;
4118 /// let x = QuorumParameters::new()
4119 /// .set_challenges([
4120 /// Challenge::default()/* use setters */,
4121 /// Challenge::default()/* use (different) setters */,
4122 /// ]);
4123 /// ```
4124 pub fn set_challenges<T, V>(mut self, v: T) -> Self
4125 where
4126 T: std::iter::IntoIterator<Item = V>,
4127 V: std::convert::Into<crate::model::Challenge>,
4128 {
4129 use std::iter::Iterator;
4130 self.challenges = v.into_iter().map(|i| i.into()).collect();
4131 self
4132 }
4133
4134 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::approved_two_factor_public_key_pems].
4135 ///
4136 /// # Example
4137 /// ```ignore,no_run
4138 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::QuorumParameters;
4139 /// let x = QuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4140 /// ```
4141 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4142 where
4143 T: std::iter::IntoIterator<Item = V>,
4144 V: std::convert::Into<std::string::String>,
4145 {
4146 use std::iter::Iterator;
4147 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4148 self
4149 }
4150 }
4151
4152 impl wkt::message::Message for QuorumParameters {
4153 fn typename() -> &'static str {
4154 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters"
4155 }
4156 }
4157
4158 /// Parameters for an approval that has both required challenges and a
4159 /// quorum.
4160 #[derive(Clone, Default, PartialEq)]
4161 #[non_exhaustive]
4162 pub struct RequiredActionQuorumParameters {
4163 /// Output only. A list of specific challenges that must be signed.
4164 /// For some operations, this will contain a single challenge.
4165 pub required_challenges: std::vec::Vec<crate::model::Challenge>,
4166
4167 /// Output only. The required number of quorum approvers. This is the M value
4168 /// used for M of N quorum auth. It is less than the number of public keys.
4169 pub required_approver_count: i32,
4170
4171 /// Output only. The challenges to be signed by 2FA keys for quorum auth. M
4172 /// of N of these challenges are required to be signed to approve the
4173 /// operation.
4174 pub quorum_challenges: std::vec::Vec<crate::model::Challenge>,
4175
4176 /// Output only. The public keys associated with the 2FA keys that have
4177 /// already approved the
4178 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4179 /// by signing the challenge.
4180 ///
4181 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4182 pub approved_two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4183
4184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4185 }
4186
4187 impl RequiredActionQuorumParameters {
4188 /// Creates a new default instance.
4189 pub fn new() -> Self {
4190 std::default::Default::default()
4191 }
4192
4193 /// Sets the value of [required_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_challenges].
4194 ///
4195 /// # Example
4196 /// ```ignore,no_run
4197 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4198 /// use google_cloud_kms_v1::model::Challenge;
4199 /// let x = RequiredActionQuorumParameters::new()
4200 /// .set_required_challenges([
4201 /// Challenge::default()/* use setters */,
4202 /// Challenge::default()/* use (different) setters */,
4203 /// ]);
4204 /// ```
4205 pub fn set_required_challenges<T, V>(mut self, v: T) -> Self
4206 where
4207 T: std::iter::IntoIterator<Item = V>,
4208 V: std::convert::Into<crate::model::Challenge>,
4209 {
4210 use std::iter::Iterator;
4211 self.required_challenges = v.into_iter().map(|i| i.into()).collect();
4212 self
4213 }
4214
4215 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count].
4216 ///
4217 /// # Example
4218 /// ```ignore,no_run
4219 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4220 /// let x = RequiredActionQuorumParameters::new().set_required_approver_count(42);
4221 /// ```
4222 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4223 self.required_approver_count = v.into();
4224 self
4225 }
4226
4227 /// Sets the value of [quorum_challenges][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::quorum_challenges].
4228 ///
4229 /// # Example
4230 /// ```ignore,no_run
4231 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4232 /// use google_cloud_kms_v1::model::Challenge;
4233 /// let x = RequiredActionQuorumParameters::new()
4234 /// .set_quorum_challenges([
4235 /// Challenge::default()/* use setters */,
4236 /// Challenge::default()/* use (different) setters */,
4237 /// ]);
4238 /// ```
4239 pub fn set_quorum_challenges<T, V>(mut self, v: T) -> Self
4240 where
4241 T: std::iter::IntoIterator<Item = V>,
4242 V: std::convert::Into<crate::model::Challenge>,
4243 {
4244 use std::iter::Iterator;
4245 self.quorum_challenges = v.into_iter().map(|i| i.into()).collect();
4246 self
4247 }
4248
4249 /// Sets the value of [approved_two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::approved_two_factor_public_key_pems].
4250 ///
4251 /// # Example
4252 /// ```ignore,no_run
4253 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters;
4254 /// let x = RequiredActionQuorumParameters::new().set_approved_two_factor_public_key_pems(["a", "b", "c"]);
4255 /// ```
4256 pub fn set_approved_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4257 where
4258 T: std::iter::IntoIterator<Item = V>,
4259 V: std::convert::Into<std::string::String>,
4260 {
4261 use std::iter::Iterator;
4262 self.approved_two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4263 self
4264 }
4265 }
4266
4267 impl wkt::message::Message for RequiredActionQuorumParameters {
4268 fn typename() -> &'static str {
4269 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters"
4270 }
4271 }
4272
4273 /// Register 2FA keys for the
4274 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4275 /// This operation requires all Challenges to be signed by 2FA keys. The
4276 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4277 /// be in the
4278 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4279 /// state to perform this operation.
4280 ///
4281 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4282 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4283 #[derive(Clone, Default, PartialEq)]
4284 #[non_exhaustive]
4285 pub struct RegisterTwoFactorAuthKeys {
4286 /// Required. The required numbers of approvers to set for the
4287 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4288 /// This is the M value used for M of N quorum auth. Must be greater than or
4289 /// equal to 2 and less than or equal to
4290 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4291 ///
4292 ///
4293 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4294 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4295 pub required_approver_count: i32,
4296
4297 /// Required. The public keys associated with the 2FA keys for M of N quorum
4298 /// auth. Public keys must be associated with RSA 2048 keys.
4299 pub two_factor_public_key_pems: std::vec::Vec<std::string::String>,
4300
4301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4302 }
4303
4304 impl RegisterTwoFactorAuthKeys {
4305 /// Creates a new default instance.
4306 pub fn new() -> Self {
4307 std::default::Default::default()
4308 }
4309
4310 /// Sets the value of [required_approver_count][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::required_approver_count].
4311 ///
4312 /// # Example
4313 /// ```ignore,no_run
4314 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4315 /// let x = RegisterTwoFactorAuthKeys::new().set_required_approver_count(42);
4316 /// ```
4317 pub fn set_required_approver_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4318 self.required_approver_count = v.into();
4319 self
4320 }
4321
4322 /// Sets the value of [two_factor_public_key_pems][crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys::two_factor_public_key_pems].
4323 ///
4324 /// # Example
4325 /// ```ignore,no_run
4326 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys;
4327 /// let x = RegisterTwoFactorAuthKeys::new().set_two_factor_public_key_pems(["a", "b", "c"]);
4328 /// ```
4329 pub fn set_two_factor_public_key_pems<T, V>(mut self, v: T) -> Self
4330 where
4331 T: std::iter::IntoIterator<Item = V>,
4332 V: std::convert::Into<std::string::String>,
4333 {
4334 use std::iter::Iterator;
4335 self.two_factor_public_key_pems = v.into_iter().map(|i| i.into()).collect();
4336 self
4337 }
4338 }
4339
4340 impl wkt::message::Message for RegisterTwoFactorAuthKeys {
4341 fn typename() -> &'static str {
4342 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RegisterTwoFactorAuthKeys"
4343 }
4344 }
4345
4346 /// Disable the
4347 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4348 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4349 /// be in the
4350 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4351 /// perform this operation.
4352 ///
4353 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4354 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4355 #[derive(Clone, Default, PartialEq)]
4356 #[non_exhaustive]
4357 pub struct DisableSingleTenantHsmInstance {
4358 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4359 }
4360
4361 impl DisableSingleTenantHsmInstance {
4362 /// Creates a new default instance.
4363 pub fn new() -> Self {
4364 std::default::Default::default()
4365 }
4366 }
4367
4368 impl wkt::message::Message for DisableSingleTenantHsmInstance {
4369 fn typename() -> &'static str {
4370 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DisableSingleTenantHsmInstance"
4371 }
4372 }
4373
4374 /// Enable the
4375 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]. The
4376 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4377 /// be in the
4378 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4379 /// state to perform this operation.
4380 ///
4381 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4382 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4383 #[derive(Clone, Default, PartialEq)]
4384 #[non_exhaustive]
4385 pub struct EnableSingleTenantHsmInstance {
4386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4387 }
4388
4389 impl EnableSingleTenantHsmInstance {
4390 /// Creates a new default instance.
4391 pub fn new() -> Self {
4392 std::default::Default::default()
4393 }
4394 }
4395
4396 impl wkt::message::Message for EnableSingleTenantHsmInstance {
4397 fn typename() -> &'static str {
4398 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.EnableSingleTenantHsmInstance"
4399 }
4400 }
4401
4402 /// Delete the
4403 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4404 /// Deleting a
4405 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] will
4406 /// make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4407 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4408 /// unusable. The
4409 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4410 /// not be in the
4411 /// [DELETING][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING] or
4412 /// [DELETED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED] state
4413 /// to perform this operation.
4414 ///
4415 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4416 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4417 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETED]: crate::model::single_tenant_hsm_instance::State::Deleted
4418 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DELETING]: crate::model::single_tenant_hsm_instance::State::Deleting
4419 #[derive(Clone, Default, PartialEq)]
4420 #[non_exhaustive]
4421 pub struct DeleteSingleTenantHsmInstance {
4422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4423 }
4424
4425 impl DeleteSingleTenantHsmInstance {
4426 /// Creates a new default instance.
4427 pub fn new() -> Self {
4428 std::default::Default::default()
4429 }
4430 }
4431
4432 impl wkt::message::Message for DeleteSingleTenantHsmInstance {
4433 fn typename() -> &'static str {
4434 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.DeleteSingleTenantHsmInstance"
4435 }
4436 }
4437
4438 /// Add a quorum member to the
4439 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4440 /// This will increase the
4441 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4442 /// by 1. The
4443 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4444 /// be in the
4445 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4446 /// perform this operation.
4447 ///
4448 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4449 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4450 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4451 #[derive(Clone, Default, PartialEq)]
4452 #[non_exhaustive]
4453 pub struct AddQuorumMember {
4454 /// Required. The public key associated with the 2FA key for the new quorum
4455 /// member to add. Public keys must be associated with RSA 2048 keys.
4456 pub two_factor_public_key_pem: std::string::String,
4457
4458 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4459 }
4460
4461 impl AddQuorumMember {
4462 /// Creates a new default instance.
4463 pub fn new() -> Self {
4464 std::default::Default::default()
4465 }
4466
4467 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember::two_factor_public_key_pem].
4468 ///
4469 /// # Example
4470 /// ```ignore,no_run
4471 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::AddQuorumMember;
4472 /// let x = AddQuorumMember::new().set_two_factor_public_key_pem("example");
4473 /// ```
4474 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4475 mut self,
4476 v: T,
4477 ) -> Self {
4478 self.two_factor_public_key_pem = v.into();
4479 self
4480 }
4481 }
4482
4483 impl wkt::message::Message for AddQuorumMember {
4484 fn typename() -> &'static str {
4485 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.AddQuorumMember"
4486 }
4487 }
4488
4489 /// Remove a quorum member from the
4490 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4491 /// This will reduce
4492 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4493 /// by 1. The
4494 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4495 /// be in the
4496 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4497 /// perform this operation.
4498 ///
4499 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4500 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4501 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4502 #[derive(Clone, Default, PartialEq)]
4503 #[non_exhaustive]
4504 pub struct RemoveQuorumMember {
4505 /// Required. The public key associated with the 2FA key for the quorum
4506 /// member to remove. Public keys must be associated with RSA 2048 keys.
4507 pub two_factor_public_key_pem: std::string::String,
4508
4509 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4510 }
4511
4512 impl RemoveQuorumMember {
4513 /// Creates a new default instance.
4514 pub fn new() -> Self {
4515 std::default::Default::default()
4516 }
4517
4518 /// Sets the value of [two_factor_public_key_pem][crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember::two_factor_public_key_pem].
4519 ///
4520 /// # Example
4521 /// ```ignore,no_run
4522 /// # use google_cloud_kms_v1::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember;
4523 /// let x = RemoveQuorumMember::new().set_two_factor_public_key_pem("example");
4524 /// ```
4525 pub fn set_two_factor_public_key_pem<T: std::convert::Into<std::string::String>>(
4526 mut self,
4527 v: T,
4528 ) -> Self {
4529 self.two_factor_public_key_pem = v.into();
4530 self
4531 }
4532 }
4533
4534 impl wkt::message::Message for RemoveQuorumMember {
4535 fn typename() -> &'static str {
4536 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RemoveQuorumMember"
4537 }
4538 }
4539
4540 /// Refreshes the
4541 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4542 /// This operation must be performed periodically to keep the
4543 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4544 /// active. This operation must be performed before
4545 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4546 /// has passed. The
4547 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] must
4548 /// be in the
4549 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state to
4550 /// perform this operation.
4551 ///
4552 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4553 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4554 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4555 #[derive(Clone, Default, PartialEq)]
4556 #[non_exhaustive]
4557 pub struct RefreshSingleTenantHsmInstance {
4558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4559 }
4560
4561 impl RefreshSingleTenantHsmInstance {
4562 /// Creates a new default instance.
4563 pub fn new() -> Self {
4564 std::default::Default::default()
4565 }
4566 }
4567
4568 impl wkt::message::Message for RefreshSingleTenantHsmInstance {
4569 fn typename() -> &'static str {
4570 "type.googleapis.com/google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RefreshSingleTenantHsmInstance"
4571 }
4572 }
4573
4574 /// The set of states of a
4575 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4576 ///
4577 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4578 ///
4579 /// # Working with unknown values
4580 ///
4581 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4582 /// additional enum variants at any time. Adding new variants is not considered
4583 /// a breaking change. Applications should write their code in anticipation of:
4584 ///
4585 /// - New values appearing in future releases of the client library, **and**
4586 /// - New values received dynamically, without application changes.
4587 ///
4588 /// Please consult the [Working with enums] section in the user guide for some
4589 /// guidelines.
4590 ///
4591 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4592 #[derive(Clone, Debug, PartialEq)]
4593 #[non_exhaustive]
4594 pub enum State {
4595 /// Not specified.
4596 Unspecified,
4597 /// The
4598 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4599 /// is being created.
4600 ///
4601 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4602 Creating,
4603 /// The
4604 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4605 /// is pending approval.
4606 ///
4607 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4608 Pending,
4609 /// The
4610 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4611 /// has been approved.
4612 ///
4613 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4614 Approved,
4615 /// The
4616 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4617 /// is being executed.
4618 ///
4619 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4620 Running,
4621 /// The
4622 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4623 /// has been executed successfully.
4624 ///
4625 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4626 Succeeded,
4627 /// The
4628 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4629 /// has failed.
4630 ///
4631 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4632 Failed,
4633 /// The
4634 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4635 /// has been deleted and will be purged after the purge_time.
4636 ///
4637 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4638 Deleted,
4639 /// If set, the enum was initialized with an unknown value.
4640 ///
4641 /// Applications can examine the value using [State::value] or
4642 /// [State::name].
4643 UnknownValue(state::UnknownValue),
4644 }
4645
4646 #[doc(hidden)]
4647 pub mod state {
4648 #[allow(unused_imports)]
4649 use super::*;
4650 #[derive(Clone, Debug, PartialEq)]
4651 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4652 }
4653
4654 impl State {
4655 /// Gets the enum value.
4656 ///
4657 /// Returns `None` if the enum contains an unknown value deserialized from
4658 /// the string representation of enums.
4659 pub fn value(&self) -> std::option::Option<i32> {
4660 match self {
4661 Self::Unspecified => std::option::Option::Some(0),
4662 Self::Creating => std::option::Option::Some(1),
4663 Self::Pending => std::option::Option::Some(2),
4664 Self::Approved => std::option::Option::Some(3),
4665 Self::Running => std::option::Option::Some(4),
4666 Self::Succeeded => std::option::Option::Some(5),
4667 Self::Failed => std::option::Option::Some(6),
4668 Self::Deleted => std::option::Option::Some(7),
4669 Self::UnknownValue(u) => u.0.value(),
4670 }
4671 }
4672
4673 /// Gets the enum value as a string.
4674 ///
4675 /// Returns `None` if the enum contains an unknown value deserialized from
4676 /// the integer representation of enums.
4677 pub fn name(&self) -> std::option::Option<&str> {
4678 match self {
4679 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
4680 Self::Creating => std::option::Option::Some("CREATING"),
4681 Self::Pending => std::option::Option::Some("PENDING"),
4682 Self::Approved => std::option::Option::Some("APPROVED"),
4683 Self::Running => std::option::Option::Some("RUNNING"),
4684 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
4685 Self::Failed => std::option::Option::Some("FAILED"),
4686 Self::Deleted => std::option::Option::Some("DELETED"),
4687 Self::UnknownValue(u) => u.0.name(),
4688 }
4689 }
4690 }
4691
4692 impl std::default::Default for State {
4693 fn default() -> Self {
4694 use std::convert::From;
4695 Self::from(0)
4696 }
4697 }
4698
4699 impl std::fmt::Display for State {
4700 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4701 wkt::internal::display_enum(f, self.name(), self.value())
4702 }
4703 }
4704
4705 impl std::convert::From<i32> for State {
4706 fn from(value: i32) -> Self {
4707 match value {
4708 0 => Self::Unspecified,
4709 1 => Self::Creating,
4710 2 => Self::Pending,
4711 3 => Self::Approved,
4712 4 => Self::Running,
4713 5 => Self::Succeeded,
4714 6 => Self::Failed,
4715 7 => Self::Deleted,
4716 _ => Self::UnknownValue(state::UnknownValue(
4717 wkt::internal::UnknownEnumValue::Integer(value),
4718 )),
4719 }
4720 }
4721 }
4722
4723 impl std::convert::From<&str> for State {
4724 fn from(value: &str) -> Self {
4725 use std::string::ToString;
4726 match value {
4727 "STATE_UNSPECIFIED" => Self::Unspecified,
4728 "CREATING" => Self::Creating,
4729 "PENDING" => Self::Pending,
4730 "APPROVED" => Self::Approved,
4731 "RUNNING" => Self::Running,
4732 "SUCCEEDED" => Self::Succeeded,
4733 "FAILED" => Self::Failed,
4734 "DELETED" => Self::Deleted,
4735 _ => Self::UnknownValue(state::UnknownValue(
4736 wkt::internal::UnknownEnumValue::String(value.to_string()),
4737 )),
4738 }
4739 }
4740 }
4741
4742 impl serde::ser::Serialize for State {
4743 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4744 where
4745 S: serde::Serializer,
4746 {
4747 match self {
4748 Self::Unspecified => serializer.serialize_i32(0),
4749 Self::Creating => serializer.serialize_i32(1),
4750 Self::Pending => serializer.serialize_i32(2),
4751 Self::Approved => serializer.serialize_i32(3),
4752 Self::Running => serializer.serialize_i32(4),
4753 Self::Succeeded => serializer.serialize_i32(5),
4754 Self::Failed => serializer.serialize_i32(6),
4755 Self::Deleted => serializer.serialize_i32(7),
4756 Self::UnknownValue(u) => u.0.serialize(serializer),
4757 }
4758 }
4759 }
4760
4761 impl<'de> serde::de::Deserialize<'de> for State {
4762 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4763 where
4764 D: serde::Deserializer<'de>,
4765 {
4766 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
4767 ".google.cloud.kms.v1.SingleTenantHsmInstanceProposal.State",
4768 ))
4769 }
4770 }
4771
4772 /// The approval parameters for the
4773 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4774 /// The type of parameters is determined by the operation being proposed.
4775 ///
4776 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4777 #[derive(Clone, Debug, PartialEq)]
4778 #[non_exhaustive]
4779 pub enum ApprovalParameters {
4780 /// Output only. The quorum approval parameters for the
4781 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4782 ///
4783 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4784 QuorumParameters(
4785 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::QuorumParameters>,
4786 ),
4787 /// Output only. Parameters for an approval of a
4788 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4789 /// that has both required challenges and a quorum.
4790 ///
4791 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4792 RequiredActionQuorumParameters(
4793 std::boxed::Box<
4794 crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters,
4795 >,
4796 ),
4797 }
4798
4799 /// The expiration of the
4800 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4801 /// If not set, the
4802 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4803 /// will expire in 1 day. The maximum expire time is 7 days. The minimum expire
4804 /// time is 5 minutes.
4805 ///
4806 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4807 #[derive(Clone, Debug, PartialEq)]
4808 #[non_exhaustive]
4809 pub enum Expiration {
4810 /// The time at which the
4811 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
4812 /// will expire if not approved and executed.
4813 ///
4814 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4815 ExpireTime(std::boxed::Box<wkt::Timestamp>),
4816 /// Input only. The TTL for the
4817 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
4818 /// Proposals will expire after this duration.
4819 ///
4820 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
4821 Ttl(std::boxed::Box<wkt::Duration>),
4822 }
4823
4824 /// The operation to perform on the
4825 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4826 ///
4827 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4828 #[derive(Clone, Debug, PartialEq)]
4829 #[non_exhaustive]
4830 pub enum Operation {
4831 /// Register 2FA keys for the
4832 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4833 /// This operation requires all N Challenges to be signed by 2FA keys. The
4834 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4835 /// must be in the
4836 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4837 /// state to perform this operation.
4838 ///
4839 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4840 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4841 RegisterTwoFactorAuthKeys(
4842 std::boxed::Box<
4843 crate::model::single_tenant_hsm_instance_proposal::RegisterTwoFactorAuthKeys,
4844 >,
4845 ),
4846 /// Disable the
4847 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4848 /// The
4849 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4850 /// must be in the
4851 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4852 /// to perform this operation.
4853 ///
4854 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4855 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4856 DisableSingleTenantHsmInstance(
4857 std::boxed::Box<
4858 crate::model::single_tenant_hsm_instance_proposal::DisableSingleTenantHsmInstance,
4859 >,
4860 ),
4861 /// Enable the
4862 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4863 /// The
4864 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4865 /// must be in the
4866 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]
4867 /// state to perform this operation.
4868 ///
4869 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4870 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4871 EnableSingleTenantHsmInstance(
4872 std::boxed::Box<
4873 crate::model::single_tenant_hsm_instance_proposal::EnableSingleTenantHsmInstance,
4874 >,
4875 ),
4876 /// Delete the
4877 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4878 /// Deleting a
4879 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4880 /// will make all [CryptoKeys][google.cloud.kms.v1.CryptoKey] attached to the
4881 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4882 /// unusable. The
4883 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4884 /// must be in the
4885 /// [DISABLED][google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED] or
4886 /// [PENDING_TWO_FACTOR_AUTH_REGISTRATION][google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]
4887 /// state to perform this operation.
4888 ///
4889 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
4890 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4891 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.DISABLED]: crate::model::single_tenant_hsm_instance::State::Disabled
4892 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.PENDING_TWO_FACTOR_AUTH_REGISTRATION]: crate::model::single_tenant_hsm_instance::State::PendingTwoFactorAuthRegistration
4893 DeleteSingleTenantHsmInstance(
4894 std::boxed::Box<
4895 crate::model::single_tenant_hsm_instance_proposal::DeleteSingleTenantHsmInstance,
4896 >,
4897 ),
4898 /// Add a quorum member to the
4899 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4900 /// This will increase the
4901 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4902 /// by 1. The
4903 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4904 /// must be in the
4905 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4906 /// to perform this operation.
4907 ///
4908 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4909 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4910 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4911 AddQuorumMember(
4912 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::AddQuorumMember>,
4913 ),
4914 /// Remove a quorum member from the
4915 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4916 /// This will reduce
4917 /// [total_approver_count][google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]
4918 /// by 1. The
4919 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4920 /// must be in the
4921 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4922 /// to perform this operation.
4923 ///
4924 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4925 /// [google.cloud.kms.v1.SingleTenantHsmInstance.QuorumAuth.total_approver_count]: crate::model::single_tenant_hsm_instance::QuorumAuth::total_approver_count
4926 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4927 RemoveQuorumMember(
4928 std::boxed::Box<crate::model::single_tenant_hsm_instance_proposal::RemoveQuorumMember>,
4929 ),
4930 /// Refreshes the
4931 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance].
4932 /// This operation must be performed periodically to keep the
4933 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4934 /// active. This operation must be performed before
4935 /// [unrefreshed_duration_until_disable][google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]
4936 /// has passed. The
4937 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
4938 /// must be in the
4939 /// [ACTIVE][google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE] state
4940 /// to perform this operation.
4941 ///
4942 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
4943 /// [google.cloud.kms.v1.SingleTenantHsmInstance.State.ACTIVE]: crate::model::single_tenant_hsm_instance::State::Active
4944 /// [google.cloud.kms.v1.SingleTenantHsmInstance.unrefreshed_duration_until_disable]: crate::model::SingleTenantHsmInstance::unrefreshed_duration_until_disable
4945 RefreshSingleTenantHsmInstance(
4946 std::boxed::Box<
4947 crate::model::single_tenant_hsm_instance_proposal::RefreshSingleTenantHsmInstance,
4948 >,
4949 ),
4950 }
4951}
4952
4953/// A challenge to be signed by a 2FA key.
4954#[derive(Clone, Default, PartialEq)]
4955#[non_exhaustive]
4956pub struct Challenge {
4957 /// Output only. The challenge to be signed by the 2FA key indicated by the
4958 /// public key.
4959 pub challenge: ::bytes::Bytes,
4960
4961 /// Output only. The public key associated with the 2FA key that should sign
4962 /// the challenge.
4963 pub public_key_pem: std::string::String,
4964
4965 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4966}
4967
4968impl Challenge {
4969 /// Creates a new default instance.
4970 pub fn new() -> Self {
4971 std::default::Default::default()
4972 }
4973
4974 /// Sets the value of [challenge][crate::model::Challenge::challenge].
4975 ///
4976 /// # Example
4977 /// ```ignore,no_run
4978 /// # use google_cloud_kms_v1::model::Challenge;
4979 /// let x = Challenge::new().set_challenge(bytes::Bytes::from_static(b"example"));
4980 /// ```
4981 pub fn set_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
4982 self.challenge = v.into();
4983 self
4984 }
4985
4986 /// Sets the value of [public_key_pem][crate::model::Challenge::public_key_pem].
4987 ///
4988 /// # Example
4989 /// ```ignore,no_run
4990 /// # use google_cloud_kms_v1::model::Challenge;
4991 /// let x = Challenge::new().set_public_key_pem("example");
4992 /// ```
4993 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4994 self.public_key_pem = v.into();
4995 self
4996 }
4997}
4998
4999impl wkt::message::Message for Challenge {
5000 fn typename() -> &'static str {
5001 "type.googleapis.com/google.cloud.kms.v1.Challenge"
5002 }
5003}
5004
5005/// A reply to a challenge signed by a 2FA key.
5006#[derive(Clone, Default, PartialEq)]
5007#[non_exhaustive]
5008pub struct ChallengeReply {
5009 /// Required. The signed challenge associated with the 2FA key.
5010 /// The signature must be RSASSA-PKCS1 v1.5 with a SHA256 digest.
5011 pub signed_challenge: ::bytes::Bytes,
5012
5013 /// Required. The public key associated with the 2FA key.
5014 pub public_key_pem: std::string::String,
5015
5016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5017}
5018
5019impl ChallengeReply {
5020 /// Creates a new default instance.
5021 pub fn new() -> Self {
5022 std::default::Default::default()
5023 }
5024
5025 /// Sets the value of [signed_challenge][crate::model::ChallengeReply::signed_challenge].
5026 ///
5027 /// # Example
5028 /// ```ignore,no_run
5029 /// # use google_cloud_kms_v1::model::ChallengeReply;
5030 /// let x = ChallengeReply::new().set_signed_challenge(bytes::Bytes::from_static(b"example"));
5031 /// ```
5032 pub fn set_signed_challenge<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
5033 self.signed_challenge = v.into();
5034 self
5035 }
5036
5037 /// Sets the value of [public_key_pem][crate::model::ChallengeReply::public_key_pem].
5038 ///
5039 /// # Example
5040 /// ```ignore,no_run
5041 /// # use google_cloud_kms_v1::model::ChallengeReply;
5042 /// let x = ChallengeReply::new().set_public_key_pem("example");
5043 /// ```
5044 pub fn set_public_key_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5045 self.public_key_pem = v.into();
5046 self
5047 }
5048}
5049
5050impl wkt::message::Message for ChallengeReply {
5051 fn typename() -> &'static str {
5052 "type.googleapis.com/google.cloud.kms.v1.ChallengeReply"
5053 }
5054}
5055
5056/// Request message for
5057/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5058///
5059/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5060#[derive(Clone, Default, PartialEq)]
5061#[non_exhaustive]
5062pub struct ListSingleTenantHsmInstancesRequest {
5063 /// Required. The resource name of the location associated with the
5064 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5065 /// list, in the format `projects/*/locations/*`.
5066 ///
5067 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5068 pub parent: std::string::String,
5069
5070 /// Optional. Optional limit on the number of
5071 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] to
5072 /// include in the response. Further
5073 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] can
5074 /// subsequently be
5075 /// obtained by including the
5076 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]
5077 /// in a subsequent request. If unspecified, the server will pick an
5078 /// appropriate default.
5079 ///
5080 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5081 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5082 pub page_size: i32,
5083
5084 /// Optional. Optional pagination token, returned earlier via
5085 /// [ListSingleTenantHsmInstancesResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token].
5086 ///
5087 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse.next_page_token]: crate::model::ListSingleTenantHsmInstancesResponse::next_page_token
5088 pub page_token: std::string::String,
5089
5090 /// Optional. Only include resources that match the filter in the response. For
5091 /// more information, see
5092 /// [Sorting and filtering list
5093 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5094 pub filter: std::string::String,
5095
5096 /// Optional. Specify how the results should be sorted. If not specified, the
5097 /// results will be sorted in the default order. For more information, see
5098 /// [Sorting and filtering list
5099 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
5100 pub order_by: std::string::String,
5101
5102 /// Optional. If set to true,
5103 /// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]
5104 /// will also return
5105 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance] in
5106 /// DELETED state.
5107 ///
5108 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5109 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5110 pub show_deleted: bool,
5111
5112 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5113}
5114
5115impl ListSingleTenantHsmInstancesRequest {
5116 /// Creates a new default instance.
5117 pub fn new() -> Self {
5118 std::default::Default::default()
5119 }
5120
5121 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstancesRequest::parent].
5122 ///
5123 /// # Example
5124 /// ```ignore,no_run
5125 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5126 /// let x = ListSingleTenantHsmInstancesRequest::new().set_parent("example");
5127 /// ```
5128 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5129 self.parent = v.into();
5130 self
5131 }
5132
5133 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstancesRequest::page_size].
5134 ///
5135 /// # Example
5136 /// ```ignore,no_run
5137 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5138 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_size(42);
5139 /// ```
5140 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5141 self.page_size = v.into();
5142 self
5143 }
5144
5145 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstancesRequest::page_token].
5146 ///
5147 /// # Example
5148 /// ```ignore,no_run
5149 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5150 /// let x = ListSingleTenantHsmInstancesRequest::new().set_page_token("example");
5151 /// ```
5152 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5153 self.page_token = v.into();
5154 self
5155 }
5156
5157 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstancesRequest::filter].
5158 ///
5159 /// # Example
5160 /// ```ignore,no_run
5161 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5162 /// let x = ListSingleTenantHsmInstancesRequest::new().set_filter("example");
5163 /// ```
5164 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5165 self.filter = v.into();
5166 self
5167 }
5168
5169 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstancesRequest::order_by].
5170 ///
5171 /// # Example
5172 /// ```ignore,no_run
5173 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5174 /// let x = ListSingleTenantHsmInstancesRequest::new().set_order_by("example");
5175 /// ```
5176 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5177 self.order_by = v.into();
5178 self
5179 }
5180
5181 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstancesRequest::show_deleted].
5182 ///
5183 /// # Example
5184 /// ```ignore,no_run
5185 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesRequest;
5186 /// let x = ListSingleTenantHsmInstancesRequest::new().set_show_deleted(true);
5187 /// ```
5188 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5189 self.show_deleted = v.into();
5190 self
5191 }
5192}
5193
5194impl wkt::message::Message for ListSingleTenantHsmInstancesRequest {
5195 fn typename() -> &'static str {
5196 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest"
5197 }
5198}
5199
5200/// Response message for
5201/// [HsmManagement.ListSingleTenantHsmInstances][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances].
5202///
5203/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstances]: crate::client::HsmManagement::list_single_tenant_hsm_instances
5204#[derive(Clone, Default, PartialEq)]
5205#[non_exhaustive]
5206pub struct ListSingleTenantHsmInstancesResponse {
5207 /// The list of
5208 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance].
5209 ///
5210 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5211 pub single_tenant_hsm_instances: std::vec::Vec<crate::model::SingleTenantHsmInstance>,
5212
5213 /// A token to retrieve next page of results. Pass this value in
5214 /// [ListSingleTenantHsmInstancesRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]
5215 /// to retrieve the next page of results.
5216 ///
5217 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.page_token]: crate::model::ListSingleTenantHsmInstancesRequest::page_token
5218 pub next_page_token: std::string::String,
5219
5220 /// The total number of
5221 /// [SingleTenantHsmInstances][google.cloud.kms.v1.SingleTenantHsmInstance]
5222 /// that matched the query.
5223 ///
5224 /// This field is not populated if
5225 /// [ListSingleTenantHsmInstancesRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]
5226 /// is applied.
5227 ///
5228 /// [google.cloud.kms.v1.ListSingleTenantHsmInstancesRequest.filter]: crate::model::ListSingleTenantHsmInstancesRequest::filter
5229 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5230 pub total_size: i32,
5231
5232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5233}
5234
5235impl ListSingleTenantHsmInstancesResponse {
5236 /// Creates a new default instance.
5237 pub fn new() -> Self {
5238 std::default::Default::default()
5239 }
5240
5241 /// Sets the value of [single_tenant_hsm_instances][crate::model::ListSingleTenantHsmInstancesResponse::single_tenant_hsm_instances].
5242 ///
5243 /// # Example
5244 /// ```ignore,no_run
5245 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5246 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5247 /// let x = ListSingleTenantHsmInstancesResponse::new()
5248 /// .set_single_tenant_hsm_instances([
5249 /// SingleTenantHsmInstance::default()/* use setters */,
5250 /// SingleTenantHsmInstance::default()/* use (different) setters */,
5251 /// ]);
5252 /// ```
5253 pub fn set_single_tenant_hsm_instances<T, V>(mut self, v: T) -> Self
5254 where
5255 T: std::iter::IntoIterator<Item = V>,
5256 V: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5257 {
5258 use std::iter::Iterator;
5259 self.single_tenant_hsm_instances = v.into_iter().map(|i| i.into()).collect();
5260 self
5261 }
5262
5263 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstancesResponse::next_page_token].
5264 ///
5265 /// # Example
5266 /// ```ignore,no_run
5267 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5268 /// let x = ListSingleTenantHsmInstancesResponse::new().set_next_page_token("example");
5269 /// ```
5270 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5271 self.next_page_token = v.into();
5272 self
5273 }
5274
5275 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstancesResponse::total_size].
5276 ///
5277 /// # Example
5278 /// ```ignore,no_run
5279 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstancesResponse;
5280 /// let x = ListSingleTenantHsmInstancesResponse::new().set_total_size(42);
5281 /// ```
5282 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5283 self.total_size = v.into();
5284 self
5285 }
5286}
5287
5288impl wkt::message::Message for ListSingleTenantHsmInstancesResponse {
5289 fn typename() -> &'static str {
5290 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstancesResponse"
5291 }
5292}
5293
5294#[doc(hidden)]
5295impl google_cloud_gax::paginator::internal::PageableResponse
5296 for ListSingleTenantHsmInstancesResponse
5297{
5298 type PageItem = crate::model::SingleTenantHsmInstance;
5299
5300 fn items(self) -> std::vec::Vec<Self::PageItem> {
5301 self.single_tenant_hsm_instances
5302 }
5303
5304 fn next_page_token(&self) -> std::string::String {
5305 use std::clone::Clone;
5306 self.next_page_token.clone()
5307 }
5308}
5309
5310/// Request message for
5311/// [HsmManagement.GetSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance].
5312///
5313/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstance]: crate::client::HsmManagement::get_single_tenant_hsm_instance
5314#[derive(Clone, Default, PartialEq)]
5315#[non_exhaustive]
5316pub struct GetSingleTenantHsmInstanceRequest {
5317 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5318 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5319 /// to get.
5320 ///
5321 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5322 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5323 pub name: std::string::String,
5324
5325 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5326}
5327
5328impl GetSingleTenantHsmInstanceRequest {
5329 /// Creates a new default instance.
5330 pub fn new() -> Self {
5331 std::default::Default::default()
5332 }
5333
5334 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceRequest::name].
5335 ///
5336 /// # Example
5337 /// ```ignore,no_run
5338 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceRequest;
5339 /// # let project_id = "project_id";
5340 /// # let location_id = "location_id";
5341 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5342 /// let x = GetSingleTenantHsmInstanceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
5343 /// ```
5344 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5345 self.name = v.into();
5346 self
5347 }
5348}
5349
5350impl wkt::message::Message for GetSingleTenantHsmInstanceRequest {
5351 fn typename() -> &'static str {
5352 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceRequest"
5353 }
5354}
5355
5356/// Request message for
5357/// [HsmManagement.CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance].
5358///
5359/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5360#[derive(Clone, Default, PartialEq)]
5361#[non_exhaustive]
5362pub struct CreateSingleTenantHsmInstanceRequest {
5363 /// Required. The resource name of the location associated with the
5364 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance], in
5365 /// the format `projects/*/locations/*`.
5366 ///
5367 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5368 pub parent: std::string::String,
5369
5370 /// Optional. It must be unique within a location and match the regular
5371 /// expression `[a-zA-Z0-9_-]{1,63}`.
5372 pub single_tenant_hsm_instance_id: std::string::String,
5373
5374 /// Required. An
5375 /// [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance] with
5376 /// initial field values.
5377 ///
5378 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5379 pub single_tenant_hsm_instance: std::option::Option<crate::model::SingleTenantHsmInstance>,
5380
5381 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5382}
5383
5384impl CreateSingleTenantHsmInstanceRequest {
5385 /// Creates a new default instance.
5386 pub fn new() -> Self {
5387 std::default::Default::default()
5388 }
5389
5390 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceRequest::parent].
5391 ///
5392 /// # Example
5393 /// ```ignore,no_run
5394 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5395 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_parent("example");
5396 /// ```
5397 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5398 self.parent = v.into();
5399 self
5400 }
5401
5402 /// Sets the value of [single_tenant_hsm_instance_id][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance_id].
5403 ///
5404 /// # Example
5405 /// ```ignore,no_run
5406 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5407 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance_id("example");
5408 /// ```
5409 pub fn set_single_tenant_hsm_instance_id<T: std::convert::Into<std::string::String>>(
5410 mut self,
5411 v: T,
5412 ) -> Self {
5413 self.single_tenant_hsm_instance_id = v.into();
5414 self
5415 }
5416
5417 /// Sets the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5418 ///
5419 /// # Example
5420 /// ```ignore,no_run
5421 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5422 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5423 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_single_tenant_hsm_instance(SingleTenantHsmInstance::default()/* use setters */);
5424 /// ```
5425 pub fn set_single_tenant_hsm_instance<T>(mut self, v: T) -> Self
5426 where
5427 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5428 {
5429 self.single_tenant_hsm_instance = std::option::Option::Some(v.into());
5430 self
5431 }
5432
5433 /// Sets or clears the value of [single_tenant_hsm_instance][crate::model::CreateSingleTenantHsmInstanceRequest::single_tenant_hsm_instance].
5434 ///
5435 /// # Example
5436 /// ```ignore,no_run
5437 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceRequest;
5438 /// use google_cloud_kms_v1::model::SingleTenantHsmInstance;
5439 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(Some(SingleTenantHsmInstance::default()/* use setters */));
5440 /// let x = CreateSingleTenantHsmInstanceRequest::new().set_or_clear_single_tenant_hsm_instance(None::<SingleTenantHsmInstance>);
5441 /// ```
5442 pub fn set_or_clear_single_tenant_hsm_instance<T>(mut self, v: std::option::Option<T>) -> Self
5443 where
5444 T: std::convert::Into<crate::model::SingleTenantHsmInstance>,
5445 {
5446 self.single_tenant_hsm_instance = v.map(|x| x.into());
5447 self
5448 }
5449}
5450
5451impl wkt::message::Message for CreateSingleTenantHsmInstanceRequest {
5452 fn typename() -> &'static str {
5453 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceRequest"
5454 }
5455}
5456
5457/// Metadata message for
5458/// [CreateSingleTenantHsmInstance][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]
5459/// long-running operation response.
5460///
5461/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstance]: crate::client::HsmManagement::create_single_tenant_hsm_instance
5462#[derive(Clone, Default, PartialEq)]
5463#[non_exhaustive]
5464pub struct CreateSingleTenantHsmInstanceMetadata {
5465 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5466}
5467
5468impl CreateSingleTenantHsmInstanceMetadata {
5469 /// Creates a new default instance.
5470 pub fn new() -> Self {
5471 std::default::Default::default()
5472 }
5473}
5474
5475impl wkt::message::Message for CreateSingleTenantHsmInstanceMetadata {
5476 fn typename() -> &'static str {
5477 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceMetadata"
5478 }
5479}
5480
5481/// Request message for
5482/// [HsmManagement.CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal].
5483///
5484/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5485#[derive(Clone, Default, PartialEq)]
5486#[non_exhaustive]
5487pub struct CreateSingleTenantHsmInstanceProposalRequest {
5488 /// Required. The [name][google.cloud.kms.v1.SingleTenantHsmInstance.name] of
5489 /// the [SingleTenantHsmInstance][google.cloud.kms.v1.SingleTenantHsmInstance]
5490 /// associated with the
5491 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
5492 ///
5493 /// [google.cloud.kms.v1.SingleTenantHsmInstance]: crate::model::SingleTenantHsmInstance
5494 /// [google.cloud.kms.v1.SingleTenantHsmInstance.name]: crate::model::SingleTenantHsmInstance::name
5495 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5496 pub parent: std::string::String,
5497
5498 /// Optional. It must be unique within a location and match the regular
5499 /// expression `[a-zA-Z0-9_-]{1,63}`.
5500 pub single_tenant_hsm_instance_proposal_id: std::string::String,
5501
5502 /// Required. The
5503 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5504 /// to create.
5505 ///
5506 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5507 pub single_tenant_hsm_instance_proposal:
5508 std::option::Option<crate::model::SingleTenantHsmInstanceProposal>,
5509
5510 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5511}
5512
5513impl CreateSingleTenantHsmInstanceProposalRequest {
5514 /// Creates a new default instance.
5515 pub fn new() -> Self {
5516 std::default::Default::default()
5517 }
5518
5519 /// Sets the value of [parent][crate::model::CreateSingleTenantHsmInstanceProposalRequest::parent].
5520 ///
5521 /// # Example
5522 /// ```ignore,no_run
5523 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5524 /// # let project_id = "project_id";
5525 /// # let location_id = "location_id";
5526 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5527 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
5528 /// ```
5529 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5530 self.parent = v.into();
5531 self
5532 }
5533
5534 /// Sets the value of [single_tenant_hsm_instance_proposal_id][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal_id].
5535 ///
5536 /// # Example
5537 /// ```ignore,no_run
5538 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5539 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal_id("example");
5540 /// ```
5541 pub fn set_single_tenant_hsm_instance_proposal_id<
5542 T: std::convert::Into<std::string::String>,
5543 >(
5544 mut self,
5545 v: T,
5546 ) -> Self {
5547 self.single_tenant_hsm_instance_proposal_id = v.into();
5548 self
5549 }
5550
5551 /// Sets the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5552 ///
5553 /// # Example
5554 /// ```ignore,no_run
5555 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5556 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5557 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_single_tenant_hsm_instance_proposal(SingleTenantHsmInstanceProposal::default()/* use setters */);
5558 /// ```
5559 pub fn set_single_tenant_hsm_instance_proposal<T>(mut self, v: T) -> Self
5560 where
5561 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5562 {
5563 self.single_tenant_hsm_instance_proposal = std::option::Option::Some(v.into());
5564 self
5565 }
5566
5567 /// Sets or clears the value of [single_tenant_hsm_instance_proposal][crate::model::CreateSingleTenantHsmInstanceProposalRequest::single_tenant_hsm_instance_proposal].
5568 ///
5569 /// # Example
5570 /// ```ignore,no_run
5571 /// # use google_cloud_kms_v1::model::CreateSingleTenantHsmInstanceProposalRequest;
5572 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
5573 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(Some(SingleTenantHsmInstanceProposal::default()/* use setters */));
5574 /// let x = CreateSingleTenantHsmInstanceProposalRequest::new().set_or_clear_single_tenant_hsm_instance_proposal(None::<SingleTenantHsmInstanceProposal>);
5575 /// ```
5576 pub fn set_or_clear_single_tenant_hsm_instance_proposal<T>(
5577 mut self,
5578 v: std::option::Option<T>,
5579 ) -> Self
5580 where
5581 T: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
5582 {
5583 self.single_tenant_hsm_instance_proposal = v.map(|x| x.into());
5584 self
5585 }
5586}
5587
5588impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalRequest {
5589 fn typename() -> &'static str {
5590 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalRequest"
5591 }
5592}
5593
5594/// Metadata message for
5595/// [CreateSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]
5596/// long-running operation response.
5597///
5598/// [google.cloud.kms.v1.HsmManagement.CreateSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::create_single_tenant_hsm_instance_proposal
5599#[derive(Clone, Default, PartialEq)]
5600#[non_exhaustive]
5601pub struct CreateSingleTenantHsmInstanceProposalMetadata {
5602 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5603}
5604
5605impl CreateSingleTenantHsmInstanceProposalMetadata {
5606 /// Creates a new default instance.
5607 pub fn new() -> Self {
5608 std::default::Default::default()
5609 }
5610}
5611
5612impl wkt::message::Message for CreateSingleTenantHsmInstanceProposalMetadata {
5613 fn typename() -> &'static str {
5614 "type.googleapis.com/google.cloud.kms.v1.CreateSingleTenantHsmInstanceProposalMetadata"
5615 }
5616}
5617
5618/// Request message for
5619/// [HsmManagement.GetSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal].
5620///
5621/// [google.cloud.kms.v1.HsmManagement.GetSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::get_single_tenant_hsm_instance_proposal
5622#[derive(Clone, Default, PartialEq)]
5623#[non_exhaustive]
5624pub struct GetSingleTenantHsmInstanceProposalRequest {
5625 /// Required. The
5626 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5627 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5628 /// to get.
5629 ///
5630 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5631 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5632 pub name: std::string::String,
5633
5634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5635}
5636
5637impl GetSingleTenantHsmInstanceProposalRequest {
5638 /// Creates a new default instance.
5639 pub fn new() -> Self {
5640 std::default::Default::default()
5641 }
5642
5643 /// Sets the value of [name][crate::model::GetSingleTenantHsmInstanceProposalRequest::name].
5644 ///
5645 /// # Example
5646 /// ```ignore,no_run
5647 /// # use google_cloud_kms_v1::model::GetSingleTenantHsmInstanceProposalRequest;
5648 /// # let project_id = "project_id";
5649 /// # let location_id = "location_id";
5650 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5651 /// # let proposal_id = "proposal_id";
5652 /// let x = GetSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
5653 /// ```
5654 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5655 self.name = v.into();
5656 self
5657 }
5658}
5659
5660impl wkt::message::Message for GetSingleTenantHsmInstanceProposalRequest {
5661 fn typename() -> &'static str {
5662 "type.googleapis.com/google.cloud.kms.v1.GetSingleTenantHsmInstanceProposalRequest"
5663 }
5664}
5665
5666/// Request message for
5667/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5668///
5669/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5670#[derive(Clone, Default, PartialEq)]
5671#[non_exhaustive]
5672pub struct ApproveSingleTenantHsmInstanceProposalRequest {
5673 /// Required. The
5674 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
5675 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
5676 /// to approve.
5677 ///
5678 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
5679 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
5680 pub name: std::string::String,
5681
5682 /// The approval payload. The type of approval payload must correspond to the
5683 /// type of approval_parameters in the proposal.
5684 pub approval_payload: std::option::Option<
5685 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload,
5686 >,
5687
5688 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5689}
5690
5691impl ApproveSingleTenantHsmInstanceProposalRequest {
5692 /// Creates a new default instance.
5693 pub fn new() -> Self {
5694 std::default::Default::default()
5695 }
5696
5697 /// Sets the value of [name][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::name].
5698 ///
5699 /// # Example
5700 /// ```ignore,no_run
5701 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5702 /// # let project_id = "project_id";
5703 /// # let location_id = "location_id";
5704 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
5705 /// # let proposal_id = "proposal_id";
5706 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
5707 /// ```
5708 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5709 self.name = v.into();
5710 self
5711 }
5712
5713 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload].
5714 ///
5715 /// Note that all the setters affecting `approval_payload` are mutually
5716 /// exclusive.
5717 ///
5718 /// # Example
5719 /// ```ignore,no_run
5720 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5721 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5722 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_approval_payload(Some(
5723 /// google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(QuorumReply::default().into())));
5724 /// ```
5725 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
5726 {
5727 self.approval_payload = v.into();
5728 self
5729 }
5730
5731 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5732 /// if it holds a `QuorumReply`, `None` if the field is not set or
5733 /// holds a different branch.
5734 pub fn quorum_reply(
5735 &self,
5736 ) -> std::option::Option<
5737 &std::boxed::Box<
5738 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5739 >,
5740 > {
5741 #[allow(unreachable_patterns)]
5742 self.approval_payload.as_ref().and_then(|v| match v {
5743 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(v) => std::option::Option::Some(v),
5744 _ => std::option::Option::None,
5745 })
5746 }
5747
5748 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5749 /// to hold a `QuorumReply`.
5750 ///
5751 /// Note that all the setters affecting `approval_payload` are
5752 /// mutually exclusive.
5753 ///
5754 /// # Example
5755 /// ```ignore,no_run
5756 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5757 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5758 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_quorum_reply(QuorumReply::default()/* use setters */);
5759 /// assert!(x.quorum_reply().is_some());
5760 /// assert!(x.required_action_quorum_reply().is_none());
5761 /// ```
5762 pub fn set_quorum_reply<
5763 T: std::convert::Into<
5764 std::boxed::Box<
5765 crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply,
5766 >,
5767 >,
5768 >(
5769 mut self,
5770 v: T,
5771 ) -> Self {
5772 self.approval_payload = std::option::Option::Some(
5773 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::QuorumReply(
5774 v.into()
5775 )
5776 );
5777 self
5778 }
5779
5780 /// The value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5781 /// if it holds a `RequiredActionQuorumReply`, `None` if the field is not set or
5782 /// holds a different branch.
5783 pub fn required_action_quorum_reply(&self) -> std::option::Option<&std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>>{
5784 #[allow(unreachable_patterns)]
5785 self.approval_payload.as_ref().and_then(|v| match v {
5786 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(v) => std::option::Option::Some(v),
5787 _ => std::option::Option::None,
5788 })
5789 }
5790
5791 /// Sets the value of [approval_payload][crate::model::ApproveSingleTenantHsmInstanceProposalRequest::approval_payload]
5792 /// to hold a `RequiredActionQuorumReply`.
5793 ///
5794 /// Note that all the setters affecting `approval_payload` are
5795 /// mutually exclusive.
5796 ///
5797 /// # Example
5798 /// ```ignore,no_run
5799 /// # use google_cloud_kms_v1::model::ApproveSingleTenantHsmInstanceProposalRequest;
5800 /// use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5801 /// let x = ApproveSingleTenantHsmInstanceProposalRequest::new().set_required_action_quorum_reply(RequiredActionQuorumReply::default()/* use setters */);
5802 /// assert!(x.required_action_quorum_reply().is_some());
5803 /// assert!(x.quorum_reply().is_none());
5804 /// ```
5805 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{
5806 self.approval_payload = std::option::Option::Some(
5807 crate::model::approve_single_tenant_hsm_instance_proposal_request::ApprovalPayload::RequiredActionQuorumReply(
5808 v.into()
5809 )
5810 );
5811 self
5812 }
5813}
5814
5815impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalRequest {
5816 fn typename() -> &'static str {
5817 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest"
5818 }
5819}
5820
5821/// Defines additional types related to [ApproveSingleTenantHsmInstanceProposalRequest].
5822pub mod approve_single_tenant_hsm_instance_proposal_request {
5823 #[allow(unused_imports)]
5824 use super::*;
5825
5826 /// The reply to
5827 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5828 /// for approving the proposal.
5829 ///
5830 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5831 #[derive(Clone, Default, PartialEq)]
5832 #[non_exhaustive]
5833 pub struct QuorumReply {
5834 /// Required. The challenge replies to approve the proposal. Challenge
5835 /// replies can be sent across multiple requests. The proposal will be
5836 /// approved when
5837 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]
5838 /// challenge replies are provided.
5839 ///
5840 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters::required_approver_count
5841 pub challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5842
5843 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5844 }
5845
5846 impl QuorumReply {
5847 /// Creates a new default instance.
5848 pub fn new() -> Self {
5849 std::default::Default::default()
5850 }
5851
5852 /// Sets the value of [challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply::challenge_replies].
5853 ///
5854 /// # Example
5855 /// ```ignore,no_run
5856 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply;
5857 /// use google_cloud_kms_v1::model::ChallengeReply;
5858 /// let x = QuorumReply::new()
5859 /// .set_challenge_replies([
5860 /// ChallengeReply::default()/* use setters */,
5861 /// ChallengeReply::default()/* use (different) setters */,
5862 /// ]);
5863 /// ```
5864 pub fn set_challenge_replies<T, V>(mut self, v: T) -> Self
5865 where
5866 T: std::iter::IntoIterator<Item = V>,
5867 V: std::convert::Into<crate::model::ChallengeReply>,
5868 {
5869 use std::iter::Iterator;
5870 self.challenge_replies = v.into_iter().map(|i| i.into()).collect();
5871 self
5872 }
5873 }
5874
5875 impl wkt::message::Message for QuorumReply {
5876 fn typename() -> &'static str {
5877 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.QuorumReply"
5878 }
5879 }
5880
5881 /// The reply to
5882 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5883 /// for approving the proposal.
5884 ///
5885 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5886 #[derive(Clone, Default, PartialEq)]
5887 #[non_exhaustive]
5888 pub struct RequiredActionQuorumReply {
5889 /// Required. All required challenges must be signed for the proposal to be
5890 /// approved. These can be sent across multiple requests.
5891 pub required_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5892
5893 /// Required. Quorum members' signed challenge replies. These can be provided
5894 /// across multiple requests. The proposal will be approved when
5895 /// [required_approver_count][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]
5896 /// quorum_challenge_replies are provided and when all
5897 /// required_challenge_replies are provided.
5898 ///
5899 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters.required_approver_count]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters::required_approver_count
5900 pub quorum_challenge_replies: std::vec::Vec<crate::model::ChallengeReply>,
5901
5902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5903 }
5904
5905 impl RequiredActionQuorumReply {
5906 /// Creates a new default instance.
5907 pub fn new() -> Self {
5908 std::default::Default::default()
5909 }
5910
5911 /// Sets the value of [required_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::required_challenge_replies].
5912 ///
5913 /// # Example
5914 /// ```ignore,no_run
5915 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5916 /// use google_cloud_kms_v1::model::ChallengeReply;
5917 /// let x = RequiredActionQuorumReply::new()
5918 /// .set_required_challenge_replies([
5919 /// ChallengeReply::default()/* use setters */,
5920 /// ChallengeReply::default()/* use (different) setters */,
5921 /// ]);
5922 /// ```
5923 pub fn set_required_challenge_replies<T, V>(mut self, v: T) -> Self
5924 where
5925 T: std::iter::IntoIterator<Item = V>,
5926 V: std::convert::Into<crate::model::ChallengeReply>,
5927 {
5928 use std::iter::Iterator;
5929 self.required_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5930 self
5931 }
5932
5933 /// Sets the value of [quorum_challenge_replies][crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply::quorum_challenge_replies].
5934 ///
5935 /// # Example
5936 /// ```ignore,no_run
5937 /// # use google_cloud_kms_v1::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply;
5938 /// use google_cloud_kms_v1::model::ChallengeReply;
5939 /// let x = RequiredActionQuorumReply::new()
5940 /// .set_quorum_challenge_replies([
5941 /// ChallengeReply::default()/* use setters */,
5942 /// ChallengeReply::default()/* use (different) setters */,
5943 /// ]);
5944 /// ```
5945 pub fn set_quorum_challenge_replies<T, V>(mut self, v: T) -> Self
5946 where
5947 T: std::iter::IntoIterator<Item = V>,
5948 V: std::convert::Into<crate::model::ChallengeReply>,
5949 {
5950 use std::iter::Iterator;
5951 self.quorum_challenge_replies = v.into_iter().map(|i| i.into()).collect();
5952 self
5953 }
5954 }
5955
5956 impl wkt::message::Message for RequiredActionQuorumReply {
5957 fn typename() -> &'static str {
5958 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalRequest.RequiredActionQuorumReply"
5959 }
5960 }
5961
5962 /// The approval payload. The type of approval payload must correspond to the
5963 /// type of approval_parameters in the proposal.
5964 #[derive(Clone, Debug, PartialEq)]
5965 #[non_exhaustive]
5966 pub enum ApprovalPayload {
5967 /// Required. The reply to
5968 /// [QuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]
5969 /// for approving the proposal.
5970 ///
5971 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.QuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::QuorumParameters
5972 QuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::QuorumReply>),
5973 /// Required. The reply to
5974 /// [RequiredActionQuorumParameters][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]
5975 /// for approving the proposal.
5976 ///
5977 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.RequiredActionQuorumParameters]: crate::model::single_tenant_hsm_instance_proposal::RequiredActionQuorumParameters
5978 RequiredActionQuorumReply(std::boxed::Box<crate::model::approve_single_tenant_hsm_instance_proposal_request::RequiredActionQuorumReply>),
5979 }
5980}
5981
5982/// Response message for
5983/// [HsmManagement.ApproveSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal].
5984///
5985/// [google.cloud.kms.v1.HsmManagement.ApproveSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::approve_single_tenant_hsm_instance_proposal
5986#[derive(Clone, Default, PartialEq)]
5987#[non_exhaustive]
5988pub struct ApproveSingleTenantHsmInstanceProposalResponse {
5989 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5990}
5991
5992impl ApproveSingleTenantHsmInstanceProposalResponse {
5993 /// Creates a new default instance.
5994 pub fn new() -> Self {
5995 std::default::Default::default()
5996 }
5997}
5998
5999impl wkt::message::Message for ApproveSingleTenantHsmInstanceProposalResponse {
6000 fn typename() -> &'static str {
6001 "type.googleapis.com/google.cloud.kms.v1.ApproveSingleTenantHsmInstanceProposalResponse"
6002 }
6003}
6004
6005/// Request message for
6006/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
6007///
6008/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6009#[derive(Clone, Default, PartialEq)]
6010#[non_exhaustive]
6011pub struct ExecuteSingleTenantHsmInstanceProposalRequest {
6012 /// Required. The
6013 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6014 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6015 /// to execute.
6016 ///
6017 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6018 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6019 pub name: std::string::String,
6020
6021 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6022}
6023
6024impl ExecuteSingleTenantHsmInstanceProposalRequest {
6025 /// Creates a new default instance.
6026 pub fn new() -> Self {
6027 std::default::Default::default()
6028 }
6029
6030 /// Sets the value of [name][crate::model::ExecuteSingleTenantHsmInstanceProposalRequest::name].
6031 ///
6032 /// # Example
6033 /// ```ignore,no_run
6034 /// # use google_cloud_kms_v1::model::ExecuteSingleTenantHsmInstanceProposalRequest;
6035 /// # let project_id = "project_id";
6036 /// # let location_id = "location_id";
6037 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6038 /// # let proposal_id = "proposal_id";
6039 /// let x = ExecuteSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
6040 /// ```
6041 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6042 self.name = v.into();
6043 self
6044 }
6045}
6046
6047impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalRequest {
6048 fn typename() -> &'static str {
6049 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalRequest"
6050 }
6051}
6052
6053/// Response message for
6054/// [HsmManagement.ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal].
6055///
6056/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6057#[derive(Clone, Default, PartialEq)]
6058#[non_exhaustive]
6059pub struct ExecuteSingleTenantHsmInstanceProposalResponse {
6060 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6061}
6062
6063impl ExecuteSingleTenantHsmInstanceProposalResponse {
6064 /// Creates a new default instance.
6065 pub fn new() -> Self {
6066 std::default::Default::default()
6067 }
6068}
6069
6070impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalResponse {
6071 fn typename() -> &'static str {
6072 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalResponse"
6073 }
6074}
6075
6076/// Metadata message for
6077/// [ExecuteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]
6078/// long-running operation response.
6079///
6080/// [google.cloud.kms.v1.HsmManagement.ExecuteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::execute_single_tenant_hsm_instance_proposal
6081#[derive(Clone, Default, PartialEq)]
6082#[non_exhaustive]
6083pub struct ExecuteSingleTenantHsmInstanceProposalMetadata {
6084 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6085}
6086
6087impl ExecuteSingleTenantHsmInstanceProposalMetadata {
6088 /// Creates a new default instance.
6089 pub fn new() -> Self {
6090 std::default::Default::default()
6091 }
6092}
6093
6094impl wkt::message::Message for ExecuteSingleTenantHsmInstanceProposalMetadata {
6095 fn typename() -> &'static str {
6096 "type.googleapis.com/google.cloud.kms.v1.ExecuteSingleTenantHsmInstanceProposalMetadata"
6097 }
6098}
6099
6100/// Request message for
6101/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6102///
6103/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6104#[derive(Clone, Default, PartialEq)]
6105#[non_exhaustive]
6106pub struct ListSingleTenantHsmInstanceProposalsRequest {
6107 /// Required. The resource name of the single tenant HSM instance associated
6108 /// with the
6109 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6110 /// to list, in the format `projects/*/locations/*/singleTenantHsmInstances/*`.
6111 ///
6112 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6113 pub parent: std::string::String,
6114
6115 /// Optional. Optional limit on the number of
6116 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6117 /// to include in the response. Further
6118 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6119 /// can subsequently be obtained by including the
6120 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]
6121 /// in a subsequent request. If unspecified, the server will pick an
6122 /// appropriate default.
6123 ///
6124 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6125 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6126 pub page_size: i32,
6127
6128 /// Optional. Optional pagination token, returned earlier via
6129 /// [ListSingleTenantHsmInstanceProposalsResponse.next_page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token].
6130 ///
6131 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse.next_page_token]: crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token
6132 pub page_token: std::string::String,
6133
6134 /// Optional. Only include resources that match the filter in the response. For
6135 /// more information, see
6136 /// [Sorting and filtering list
6137 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6138 pub filter: std::string::String,
6139
6140 /// Optional. Specify how the results should be sorted. If not specified, the
6141 /// results will be sorted in the default order. For more information, see
6142 /// [Sorting and filtering list
6143 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
6144 pub order_by: std::string::String,
6145
6146 /// Optional. If set to true,
6147 /// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]
6148 /// will also return
6149 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6150 /// in DELETED state.
6151 ///
6152 /// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6153 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6154 pub show_deleted: bool,
6155
6156 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6157}
6158
6159impl ListSingleTenantHsmInstanceProposalsRequest {
6160 /// Creates a new default instance.
6161 pub fn new() -> Self {
6162 std::default::Default::default()
6163 }
6164
6165 /// Sets the value of [parent][crate::model::ListSingleTenantHsmInstanceProposalsRequest::parent].
6166 ///
6167 /// # Example
6168 /// ```ignore,no_run
6169 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6170 /// # let project_id = "project_id";
6171 /// # let location_id = "location_id";
6172 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6173 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}"));
6174 /// ```
6175 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6176 self.parent = v.into();
6177 self
6178 }
6179
6180 /// Sets the value of [page_size][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_size].
6181 ///
6182 /// # Example
6183 /// ```ignore,no_run
6184 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6185 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_size(42);
6186 /// ```
6187 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6188 self.page_size = v.into();
6189 self
6190 }
6191
6192 /// Sets the value of [page_token][crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token].
6193 ///
6194 /// # Example
6195 /// ```ignore,no_run
6196 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6197 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_page_token("example");
6198 /// ```
6199 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6200 self.page_token = v.into();
6201 self
6202 }
6203
6204 /// Sets the value of [filter][crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter].
6205 ///
6206 /// # Example
6207 /// ```ignore,no_run
6208 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6209 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_filter("example");
6210 /// ```
6211 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6212 self.filter = v.into();
6213 self
6214 }
6215
6216 /// Sets the value of [order_by][crate::model::ListSingleTenantHsmInstanceProposalsRequest::order_by].
6217 ///
6218 /// # Example
6219 /// ```ignore,no_run
6220 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6221 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_order_by("example");
6222 /// ```
6223 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6224 self.order_by = v.into();
6225 self
6226 }
6227
6228 /// Sets the value of [show_deleted][crate::model::ListSingleTenantHsmInstanceProposalsRequest::show_deleted].
6229 ///
6230 /// # Example
6231 /// ```ignore,no_run
6232 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsRequest;
6233 /// let x = ListSingleTenantHsmInstanceProposalsRequest::new().set_show_deleted(true);
6234 /// ```
6235 pub fn set_show_deleted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6236 self.show_deleted = v.into();
6237 self
6238 }
6239}
6240
6241impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsRequest {
6242 fn typename() -> &'static str {
6243 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest"
6244 }
6245}
6246
6247/// Response message for
6248/// [HsmManagement.ListSingleTenantHsmInstanceProposals][google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals].
6249///
6250/// [google.cloud.kms.v1.HsmManagement.ListSingleTenantHsmInstanceProposals]: crate::client::HsmManagement::list_single_tenant_hsm_instance_proposals
6251#[derive(Clone, Default, PartialEq)]
6252#[non_exhaustive]
6253pub struct ListSingleTenantHsmInstanceProposalsResponse {
6254 /// The list of
6255 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal].
6256 ///
6257 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6258 pub single_tenant_hsm_instance_proposals:
6259 std::vec::Vec<crate::model::SingleTenantHsmInstanceProposal>,
6260
6261 /// A token to retrieve next page of results. Pass this value in
6262 /// [ListSingleTenantHsmInstanceProposalsRequest.page_token][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]
6263 /// to retrieve the next page of results.
6264 ///
6265 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.page_token]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::page_token
6266 pub next_page_token: std::string::String,
6267
6268 /// The total number of
6269 /// [SingleTenantHsmInstanceProposals][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6270 /// that matched the query.
6271 ///
6272 /// This field is not populated if
6273 /// [ListSingleTenantHsmInstanceProposalsRequest.filter][google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]
6274 /// is applied.
6275 ///
6276 /// [google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsRequest.filter]: crate::model::ListSingleTenantHsmInstanceProposalsRequest::filter
6277 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6278 pub total_size: i32,
6279
6280 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6281}
6282
6283impl ListSingleTenantHsmInstanceProposalsResponse {
6284 /// Creates a new default instance.
6285 pub fn new() -> Self {
6286 std::default::Default::default()
6287 }
6288
6289 /// Sets the value of [single_tenant_hsm_instance_proposals][crate::model::ListSingleTenantHsmInstanceProposalsResponse::single_tenant_hsm_instance_proposals].
6290 ///
6291 /// # Example
6292 /// ```ignore,no_run
6293 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6294 /// use google_cloud_kms_v1::model::SingleTenantHsmInstanceProposal;
6295 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new()
6296 /// .set_single_tenant_hsm_instance_proposals([
6297 /// SingleTenantHsmInstanceProposal::default()/* use setters */,
6298 /// SingleTenantHsmInstanceProposal::default()/* use (different) setters */,
6299 /// ]);
6300 /// ```
6301 pub fn set_single_tenant_hsm_instance_proposals<T, V>(mut self, v: T) -> Self
6302 where
6303 T: std::iter::IntoIterator<Item = V>,
6304 V: std::convert::Into<crate::model::SingleTenantHsmInstanceProposal>,
6305 {
6306 use std::iter::Iterator;
6307 self.single_tenant_hsm_instance_proposals = v.into_iter().map(|i| i.into()).collect();
6308 self
6309 }
6310
6311 /// Sets the value of [next_page_token][crate::model::ListSingleTenantHsmInstanceProposalsResponse::next_page_token].
6312 ///
6313 /// # Example
6314 /// ```ignore,no_run
6315 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6316 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_next_page_token("example");
6317 /// ```
6318 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6319 self.next_page_token = v.into();
6320 self
6321 }
6322
6323 /// Sets the value of [total_size][crate::model::ListSingleTenantHsmInstanceProposalsResponse::total_size].
6324 ///
6325 /// # Example
6326 /// ```ignore,no_run
6327 /// # use google_cloud_kms_v1::model::ListSingleTenantHsmInstanceProposalsResponse;
6328 /// let x = ListSingleTenantHsmInstanceProposalsResponse::new().set_total_size(42);
6329 /// ```
6330 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6331 self.total_size = v.into();
6332 self
6333 }
6334}
6335
6336impl wkt::message::Message for ListSingleTenantHsmInstanceProposalsResponse {
6337 fn typename() -> &'static str {
6338 "type.googleapis.com/google.cloud.kms.v1.ListSingleTenantHsmInstanceProposalsResponse"
6339 }
6340}
6341
6342#[doc(hidden)]
6343impl google_cloud_gax::paginator::internal::PageableResponse
6344 for ListSingleTenantHsmInstanceProposalsResponse
6345{
6346 type PageItem = crate::model::SingleTenantHsmInstanceProposal;
6347
6348 fn items(self) -> std::vec::Vec<Self::PageItem> {
6349 self.single_tenant_hsm_instance_proposals
6350 }
6351
6352 fn next_page_token(&self) -> std::string::String {
6353 use std::clone::Clone;
6354 self.next_page_token.clone()
6355 }
6356}
6357
6358/// Request message for
6359/// [HsmManagement.DeleteSingleTenantHsmInstanceProposal][google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal].
6360///
6361/// [google.cloud.kms.v1.HsmManagement.DeleteSingleTenantHsmInstanceProposal]: crate::client::HsmManagement::delete_single_tenant_hsm_instance_proposal
6362#[derive(Clone, Default, PartialEq)]
6363#[non_exhaustive]
6364pub struct DeleteSingleTenantHsmInstanceProposalRequest {
6365 /// Required. The
6366 /// [name][google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name] of the
6367 /// [SingleTenantHsmInstanceProposal][google.cloud.kms.v1.SingleTenantHsmInstanceProposal]
6368 /// to delete.
6369 ///
6370 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal]: crate::model::SingleTenantHsmInstanceProposal
6371 /// [google.cloud.kms.v1.SingleTenantHsmInstanceProposal.name]: crate::model::SingleTenantHsmInstanceProposal::name
6372 pub name: std::string::String,
6373
6374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6375}
6376
6377impl DeleteSingleTenantHsmInstanceProposalRequest {
6378 /// Creates a new default instance.
6379 pub fn new() -> Self {
6380 std::default::Default::default()
6381 }
6382
6383 /// Sets the value of [name][crate::model::DeleteSingleTenantHsmInstanceProposalRequest::name].
6384 ///
6385 /// # Example
6386 /// ```ignore,no_run
6387 /// # use google_cloud_kms_v1::model::DeleteSingleTenantHsmInstanceProposalRequest;
6388 /// # let project_id = "project_id";
6389 /// # let location_id = "location_id";
6390 /// # let single_tenant_hsm_instance_id = "single_tenant_hsm_instance_id";
6391 /// # let proposal_id = "proposal_id";
6392 /// let x = DeleteSingleTenantHsmInstanceProposalRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/singleTenantHsmInstances/{single_tenant_hsm_instance_id}/proposals/{proposal_id}"));
6393 /// ```
6394 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6395 self.name = v.into();
6396 self
6397 }
6398}
6399
6400impl wkt::message::Message for DeleteSingleTenantHsmInstanceProposalRequest {
6401 fn typename() -> &'static str {
6402 "type.googleapis.com/google.cloud.kms.v1.DeleteSingleTenantHsmInstanceProposalRequest"
6403 }
6404}
6405
6406/// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of
6407/// [CryptoKeys][google.cloud.kms.v1.CryptoKey].
6408///
6409/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6410/// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6411#[derive(Clone, Default, PartialEq)]
6412#[non_exhaustive]
6413pub struct KeyRing {
6414 /// Output only. The resource name for the
6415 /// [KeyRing][google.cloud.kms.v1.KeyRing] in the format
6416 /// `projects/*/locations/*/keyRings/*`.
6417 ///
6418 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6419 pub name: std::string::String,
6420
6421 /// Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing]
6422 /// was created.
6423 ///
6424 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
6425 pub create_time: std::option::Option<wkt::Timestamp>,
6426
6427 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6428}
6429
6430impl KeyRing {
6431 /// Creates a new default instance.
6432 pub fn new() -> Self {
6433 std::default::Default::default()
6434 }
6435
6436 /// Sets the value of [name][crate::model::KeyRing::name].
6437 ///
6438 /// # Example
6439 /// ```ignore,no_run
6440 /// # use google_cloud_kms_v1::model::KeyRing;
6441 /// # let project_id = "project_id";
6442 /// # let location_id = "location_id";
6443 /// # let key_ring_id = "key_ring_id";
6444 /// let x = KeyRing::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
6445 /// ```
6446 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6447 self.name = v.into();
6448 self
6449 }
6450
6451 /// Sets the value of [create_time][crate::model::KeyRing::create_time].
6452 ///
6453 /// # Example
6454 /// ```ignore,no_run
6455 /// # use google_cloud_kms_v1::model::KeyRing;
6456 /// use wkt::Timestamp;
6457 /// let x = KeyRing::new().set_create_time(Timestamp::default()/* use setters */);
6458 /// ```
6459 pub fn set_create_time<T>(mut self, v: T) -> Self
6460 where
6461 T: std::convert::Into<wkt::Timestamp>,
6462 {
6463 self.create_time = std::option::Option::Some(v.into());
6464 self
6465 }
6466
6467 /// Sets or clears the value of [create_time][crate::model::KeyRing::create_time].
6468 ///
6469 /// # Example
6470 /// ```ignore,no_run
6471 /// # use google_cloud_kms_v1::model::KeyRing;
6472 /// use wkt::Timestamp;
6473 /// let x = KeyRing::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6474 /// let x = KeyRing::new().set_or_clear_create_time(None::<Timestamp>);
6475 /// ```
6476 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6477 where
6478 T: std::convert::Into<wkt::Timestamp>,
6479 {
6480 self.create_time = v.map(|x| x.into());
6481 self
6482 }
6483}
6484
6485impl wkt::message::Message for KeyRing {
6486 fn typename() -> &'static str {
6487 "type.googleapis.com/google.cloud.kms.v1.KeyRing"
6488 }
6489}
6490
6491/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that
6492/// can be used for cryptographic operations.
6493///
6494/// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of zero or more
6495/// [versions][google.cloud.kms.v1.CryptoKeyVersion], which represent the actual
6496/// key material used in cryptographic operations.
6497///
6498/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6499/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6500#[derive(Clone, Default, PartialEq)]
6501#[non_exhaustive]
6502pub struct CryptoKey {
6503 /// Output only. The resource name for this
6504 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format
6505 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
6506 ///
6507 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6508 pub name: std::string::String,
6509
6510 /// Output only. A copy of the "primary"
6511 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used
6512 /// by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this
6513 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] is given in
6514 /// [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name].
6515 ///
6516 /// The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be
6517 /// updated via
6518 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
6519 ///
6520 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6521 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6522 /// may have a primary. For other keys, this field will be omitted.
6523 ///
6524 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6525 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6526 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6527 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6528 /// [google.cloud.kms.v1.EncryptRequest.name]: crate::model::EncryptRequest::name
6529 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
6530 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6531 pub primary: std::option::Option<crate::model::CryptoKeyVersion>,
6532
6533 /// Immutable. The immutable purpose of this
6534 /// [CryptoKey][google.cloud.kms.v1.CryptoKey].
6535 ///
6536 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6537 pub purpose: crate::model::crypto_key::CryptoKeyPurpose,
6538
6539 /// Output only. The time at which this
6540 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] was created.
6541 ///
6542 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6543 pub create_time: std::option::Option<wkt::Timestamp>,
6544
6545 /// At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time],
6546 /// the Key Management Service will automatically:
6547 ///
6548 /// 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey].
6549 /// 1. Mark the new version as primary.
6550 ///
6551 /// Key rotations performed manually via
6552 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6553 /// and
6554 /// [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]
6555 /// do not affect
6556 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time].
6557 ///
6558 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
6559 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
6560 /// support automatic rotation. For other keys, this field must be omitted.
6561 ///
6562 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6563 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
6564 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
6565 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
6566 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6567 /// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
6568 pub next_rotation_time: std::option::Option<wkt::Timestamp>,
6569
6570 /// A template describing settings for new
6571 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. The
6572 /// properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
6573 /// instances created by either
6574 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
6575 /// or auto-rotation are controlled by this template.
6576 ///
6577 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6578 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
6579 pub version_template: std::option::Option<crate::model::CryptoKeyVersionTemplate>,
6580
6581 /// Labels with user-defined metadata. For more information, see
6582 /// [Labeling Keys](https://cloud.google.com/kms/docs/labeling-keys).
6583 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
6584
6585 /// Immutable. Whether this key may contain imported versions only.
6586 pub import_only: bool,
6587
6588 /// Immutable. The period of time that versions of this key spend in the
6589 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]
6590 /// state before transitioning to
6591 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
6592 /// If not specified at creation time, the default duration is 30 days.
6593 ///
6594 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
6595 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
6596 pub destroy_scheduled_duration: std::option::Option<wkt::Duration>,
6597
6598 /// Immutable. The resource name of the backend environment where the key
6599 /// material for all [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6600 /// associated with this [CryptoKey][google.cloud.kms.v1.CryptoKey] reside and
6601 /// where all related cryptographic operations are performed. Only applicable
6602 /// if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] have a
6603 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6604 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC], with the
6605 /// resource name in the format `projects/*/locations/*/ekmConnections/*`. Only
6606 /// applicable if [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
6607 /// have a [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of
6608 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT],
6609 /// with the resource name in the format
6610 /// `projects/*/locations/*/singleTenantHsmInstances/*`.
6611 /// Note, this list is non-exhaustive and may apply to additional
6612 /// [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel] in the future.
6613 ///
6614 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
6615 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
6616 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
6617 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
6618 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
6619 pub crypto_key_backend: std::string::String,
6620
6621 /// Optional. The policy used for Key Access Justifications Policy Enforcement.
6622 /// If this field is present and this key is enrolled in Key Access
6623 /// Justifications Policy Enforcement, the policy will be evaluated in encrypt,
6624 /// decrypt, and sign operations, and the operation will fail if rejected by
6625 /// the policy. The policy is defined by specifying zero or more allowed
6626 /// justification codes.
6627 /// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
6628 /// By default, this field is absent, and all justification codes are allowed.
6629 /// If the
6630 /// `key_access_justifications_policy.allowed_access_reasons`
6631 /// is empty (zero allowed justification code), all encrypt, decrypt, and sign
6632 /// operations will fail.
6633 pub key_access_justifications_policy:
6634 std::option::Option<crate::model::KeyAccessJustificationsPolicy>,
6635
6636 /// Controls the rate of automatic rotation.
6637 pub rotation_schedule: std::option::Option<crate::model::crypto_key::RotationSchedule>,
6638
6639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6640}
6641
6642impl CryptoKey {
6643 /// Creates a new default instance.
6644 pub fn new() -> Self {
6645 std::default::Default::default()
6646 }
6647
6648 /// Sets the value of [name][crate::model::CryptoKey::name].
6649 ///
6650 /// # Example
6651 /// ```ignore,no_run
6652 /// # use google_cloud_kms_v1::model::CryptoKey;
6653 /// # let project_id = "project_id";
6654 /// # let location_id = "location_id";
6655 /// # let key_ring_id = "key_ring_id";
6656 /// # let crypto_key_id = "crypto_key_id";
6657 /// let x = CryptoKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
6658 /// ```
6659 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6660 self.name = v.into();
6661 self
6662 }
6663
6664 /// Sets the value of [primary][crate::model::CryptoKey::primary].
6665 ///
6666 /// # Example
6667 /// ```ignore,no_run
6668 /// # use google_cloud_kms_v1::model::CryptoKey;
6669 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6670 /// let x = CryptoKey::new().set_primary(CryptoKeyVersion::default()/* use setters */);
6671 /// ```
6672 pub fn set_primary<T>(mut self, v: T) -> Self
6673 where
6674 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6675 {
6676 self.primary = std::option::Option::Some(v.into());
6677 self
6678 }
6679
6680 /// Sets or clears the value of [primary][crate::model::CryptoKey::primary].
6681 ///
6682 /// # Example
6683 /// ```ignore,no_run
6684 /// # use google_cloud_kms_v1::model::CryptoKey;
6685 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
6686 /// let x = CryptoKey::new().set_or_clear_primary(Some(CryptoKeyVersion::default()/* use setters */));
6687 /// let x = CryptoKey::new().set_or_clear_primary(None::<CryptoKeyVersion>);
6688 /// ```
6689 pub fn set_or_clear_primary<T>(mut self, v: std::option::Option<T>) -> Self
6690 where
6691 T: std::convert::Into<crate::model::CryptoKeyVersion>,
6692 {
6693 self.primary = v.map(|x| x.into());
6694 self
6695 }
6696
6697 /// Sets the value of [purpose][crate::model::CryptoKey::purpose].
6698 ///
6699 /// # Example
6700 /// ```ignore,no_run
6701 /// # use google_cloud_kms_v1::model::CryptoKey;
6702 /// use google_cloud_kms_v1::model::crypto_key::CryptoKeyPurpose;
6703 /// let x0 = CryptoKey::new().set_purpose(CryptoKeyPurpose::EncryptDecrypt);
6704 /// let x1 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricSign);
6705 /// let x2 = CryptoKey::new().set_purpose(CryptoKeyPurpose::AsymmetricDecrypt);
6706 /// ```
6707 pub fn set_purpose<T: std::convert::Into<crate::model::crypto_key::CryptoKeyPurpose>>(
6708 mut self,
6709 v: T,
6710 ) -> Self {
6711 self.purpose = v.into();
6712 self
6713 }
6714
6715 /// Sets the value of [create_time][crate::model::CryptoKey::create_time].
6716 ///
6717 /// # Example
6718 /// ```ignore,no_run
6719 /// # use google_cloud_kms_v1::model::CryptoKey;
6720 /// use wkt::Timestamp;
6721 /// let x = CryptoKey::new().set_create_time(Timestamp::default()/* use setters */);
6722 /// ```
6723 pub fn set_create_time<T>(mut self, v: T) -> Self
6724 where
6725 T: std::convert::Into<wkt::Timestamp>,
6726 {
6727 self.create_time = std::option::Option::Some(v.into());
6728 self
6729 }
6730
6731 /// Sets or clears the value of [create_time][crate::model::CryptoKey::create_time].
6732 ///
6733 /// # Example
6734 /// ```ignore,no_run
6735 /// # use google_cloud_kms_v1::model::CryptoKey;
6736 /// use wkt::Timestamp;
6737 /// let x = CryptoKey::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6738 /// let x = CryptoKey::new().set_or_clear_create_time(None::<Timestamp>);
6739 /// ```
6740 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6741 where
6742 T: std::convert::Into<wkt::Timestamp>,
6743 {
6744 self.create_time = v.map(|x| x.into());
6745 self
6746 }
6747
6748 /// Sets the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6749 ///
6750 /// # Example
6751 /// ```ignore,no_run
6752 /// # use google_cloud_kms_v1::model::CryptoKey;
6753 /// use wkt::Timestamp;
6754 /// let x = CryptoKey::new().set_next_rotation_time(Timestamp::default()/* use setters */);
6755 /// ```
6756 pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
6757 where
6758 T: std::convert::Into<wkt::Timestamp>,
6759 {
6760 self.next_rotation_time = std::option::Option::Some(v.into());
6761 self
6762 }
6763
6764 /// Sets or clears the value of [next_rotation_time][crate::model::CryptoKey::next_rotation_time].
6765 ///
6766 /// # Example
6767 /// ```ignore,no_run
6768 /// # use google_cloud_kms_v1::model::CryptoKey;
6769 /// use wkt::Timestamp;
6770 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
6771 /// let x = CryptoKey::new().set_or_clear_next_rotation_time(None::<Timestamp>);
6772 /// ```
6773 pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
6774 where
6775 T: std::convert::Into<wkt::Timestamp>,
6776 {
6777 self.next_rotation_time = v.map(|x| x.into());
6778 self
6779 }
6780
6781 /// Sets the value of [version_template][crate::model::CryptoKey::version_template].
6782 ///
6783 /// # Example
6784 /// ```ignore,no_run
6785 /// # use google_cloud_kms_v1::model::CryptoKey;
6786 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6787 /// let x = CryptoKey::new().set_version_template(CryptoKeyVersionTemplate::default()/* use setters */);
6788 /// ```
6789 pub fn set_version_template<T>(mut self, v: T) -> Self
6790 where
6791 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6792 {
6793 self.version_template = std::option::Option::Some(v.into());
6794 self
6795 }
6796
6797 /// Sets or clears the value of [version_template][crate::model::CryptoKey::version_template].
6798 ///
6799 /// # Example
6800 /// ```ignore,no_run
6801 /// # use google_cloud_kms_v1::model::CryptoKey;
6802 /// use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
6803 /// let x = CryptoKey::new().set_or_clear_version_template(Some(CryptoKeyVersionTemplate::default()/* use setters */));
6804 /// let x = CryptoKey::new().set_or_clear_version_template(None::<CryptoKeyVersionTemplate>);
6805 /// ```
6806 pub fn set_or_clear_version_template<T>(mut self, v: std::option::Option<T>) -> Self
6807 where
6808 T: std::convert::Into<crate::model::CryptoKeyVersionTemplate>,
6809 {
6810 self.version_template = v.map(|x| x.into());
6811 self
6812 }
6813
6814 /// Sets the value of [labels][crate::model::CryptoKey::labels].
6815 ///
6816 /// # Example
6817 /// ```ignore,no_run
6818 /// # use google_cloud_kms_v1::model::CryptoKey;
6819 /// let x = CryptoKey::new().set_labels([
6820 /// ("key0", "abc"),
6821 /// ("key1", "xyz"),
6822 /// ]);
6823 /// ```
6824 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
6825 where
6826 T: std::iter::IntoIterator<Item = (K, V)>,
6827 K: std::convert::Into<std::string::String>,
6828 V: std::convert::Into<std::string::String>,
6829 {
6830 use std::iter::Iterator;
6831 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6832 self
6833 }
6834
6835 /// Sets the value of [import_only][crate::model::CryptoKey::import_only].
6836 ///
6837 /// # Example
6838 /// ```ignore,no_run
6839 /// # use google_cloud_kms_v1::model::CryptoKey;
6840 /// let x = CryptoKey::new().set_import_only(true);
6841 /// ```
6842 pub fn set_import_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6843 self.import_only = v.into();
6844 self
6845 }
6846
6847 /// Sets the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6848 ///
6849 /// # Example
6850 /// ```ignore,no_run
6851 /// # use google_cloud_kms_v1::model::CryptoKey;
6852 /// use wkt::Duration;
6853 /// let x = CryptoKey::new().set_destroy_scheduled_duration(Duration::default()/* use setters */);
6854 /// ```
6855 pub fn set_destroy_scheduled_duration<T>(mut self, v: T) -> Self
6856 where
6857 T: std::convert::Into<wkt::Duration>,
6858 {
6859 self.destroy_scheduled_duration = std::option::Option::Some(v.into());
6860 self
6861 }
6862
6863 /// Sets or clears the value of [destroy_scheduled_duration][crate::model::CryptoKey::destroy_scheduled_duration].
6864 ///
6865 /// # Example
6866 /// ```ignore,no_run
6867 /// # use google_cloud_kms_v1::model::CryptoKey;
6868 /// use wkt::Duration;
6869 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(Some(Duration::default()/* use setters */));
6870 /// let x = CryptoKey::new().set_or_clear_destroy_scheduled_duration(None::<Duration>);
6871 /// ```
6872 pub fn set_or_clear_destroy_scheduled_duration<T>(mut self, v: std::option::Option<T>) -> Self
6873 where
6874 T: std::convert::Into<wkt::Duration>,
6875 {
6876 self.destroy_scheduled_duration = v.map(|x| x.into());
6877 self
6878 }
6879
6880 /// Sets the value of [crypto_key_backend][crate::model::CryptoKey::crypto_key_backend].
6881 ///
6882 /// # Example
6883 /// ```ignore,no_run
6884 /// # use google_cloud_kms_v1::model::CryptoKey;
6885 /// let x = CryptoKey::new().set_crypto_key_backend("example");
6886 /// ```
6887 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
6888 mut self,
6889 v: T,
6890 ) -> Self {
6891 self.crypto_key_backend = v.into();
6892 self
6893 }
6894
6895 /// Sets the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6896 ///
6897 /// # Example
6898 /// ```ignore,no_run
6899 /// # use google_cloud_kms_v1::model::CryptoKey;
6900 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6901 /// let x = CryptoKey::new().set_key_access_justifications_policy(KeyAccessJustificationsPolicy::default()/* use setters */);
6902 /// ```
6903 pub fn set_key_access_justifications_policy<T>(mut self, v: T) -> Self
6904 where
6905 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6906 {
6907 self.key_access_justifications_policy = std::option::Option::Some(v.into());
6908 self
6909 }
6910
6911 /// Sets or clears the value of [key_access_justifications_policy][crate::model::CryptoKey::key_access_justifications_policy].
6912 ///
6913 /// # Example
6914 /// ```ignore,no_run
6915 /// # use google_cloud_kms_v1::model::CryptoKey;
6916 /// use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
6917 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(Some(KeyAccessJustificationsPolicy::default()/* use setters */));
6918 /// let x = CryptoKey::new().set_or_clear_key_access_justifications_policy(None::<KeyAccessJustificationsPolicy>);
6919 /// ```
6920 pub fn set_or_clear_key_access_justifications_policy<T>(
6921 mut self,
6922 v: std::option::Option<T>,
6923 ) -> Self
6924 where
6925 T: std::convert::Into<crate::model::KeyAccessJustificationsPolicy>,
6926 {
6927 self.key_access_justifications_policy = v.map(|x| x.into());
6928 self
6929 }
6930
6931 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule].
6932 ///
6933 /// Note that all the setters affecting `rotation_schedule` are mutually
6934 /// exclusive.
6935 ///
6936 /// # Example
6937 /// ```ignore,no_run
6938 /// # use google_cloud_kms_v1::model::CryptoKey;
6939 /// use wkt::Duration;
6940 /// let x = CryptoKey::new().set_rotation_schedule(Some(
6941 /// google_cloud_kms_v1::model::crypto_key::RotationSchedule::RotationPeriod(Duration::default().into())));
6942 /// ```
6943 pub fn set_rotation_schedule<
6944 T: std::convert::Into<std::option::Option<crate::model::crypto_key::RotationSchedule>>,
6945 >(
6946 mut self,
6947 v: T,
6948 ) -> Self {
6949 self.rotation_schedule = v.into();
6950 self
6951 }
6952
6953 /// The value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6954 /// if it holds a `RotationPeriod`, `None` if the field is not set or
6955 /// holds a different branch.
6956 pub fn rotation_period(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
6957 #[allow(unreachable_patterns)]
6958 self.rotation_schedule.as_ref().and_then(|v| match v {
6959 crate::model::crypto_key::RotationSchedule::RotationPeriod(v) => {
6960 std::option::Option::Some(v)
6961 }
6962 _ => std::option::Option::None,
6963 })
6964 }
6965
6966 /// Sets the value of [rotation_schedule][crate::model::CryptoKey::rotation_schedule]
6967 /// to hold a `RotationPeriod`.
6968 ///
6969 /// Note that all the setters affecting `rotation_schedule` are
6970 /// mutually exclusive.
6971 ///
6972 /// # Example
6973 /// ```ignore,no_run
6974 /// # use google_cloud_kms_v1::model::CryptoKey;
6975 /// use wkt::Duration;
6976 /// let x = CryptoKey::new().set_rotation_period(Duration::default()/* use setters */);
6977 /// assert!(x.rotation_period().is_some());
6978 /// ```
6979 pub fn set_rotation_period<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
6980 mut self,
6981 v: T,
6982 ) -> Self {
6983 self.rotation_schedule = std::option::Option::Some(
6984 crate::model::crypto_key::RotationSchedule::RotationPeriod(v.into()),
6985 );
6986 self
6987 }
6988}
6989
6990impl wkt::message::Message for CryptoKey {
6991 fn typename() -> &'static str {
6992 "type.googleapis.com/google.cloud.kms.v1.CryptoKey"
6993 }
6994}
6995
6996/// Defines additional types related to [CryptoKey].
6997pub mod crypto_key {
6998 #[allow(unused_imports)]
6999 use super::*;
7000
7001 /// [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]
7002 /// describes the cryptographic capabilities of a
7003 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used
7004 /// for the operations allowed by its purpose. For more information, see [Key
7005 /// purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes).
7006 ///
7007 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7008 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose]: crate::model::crypto_key::CryptoKeyPurpose
7009 ///
7010 /// # Working with unknown values
7011 ///
7012 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7013 /// additional enum variants at any time. Adding new variants is not considered
7014 /// a breaking change. Applications should write their code in anticipation of:
7015 ///
7016 /// - New values appearing in future releases of the client library, **and**
7017 /// - New values received dynamically, without application changes.
7018 ///
7019 /// Please consult the [Working with enums] section in the user guide for some
7020 /// guidelines.
7021 ///
7022 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7023 #[derive(Clone, Debug, PartialEq)]
7024 #[non_exhaustive]
7025 pub enum CryptoKeyPurpose {
7026 /// Not specified.
7027 Unspecified,
7028 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7029 /// with [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
7030 /// [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
7031 ///
7032 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7033 /// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
7034 /// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
7035 EncryptDecrypt,
7036 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7037 /// with
7038 /// [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]
7039 /// and
7040 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
7041 ///
7042 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7043 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
7044 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7045 AsymmetricSign,
7046 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7047 /// with
7048 /// [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]
7049 /// and
7050 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
7051 ///
7052 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7053 /// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
7054 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7055 AsymmetricDecrypt,
7056 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7057 /// with [RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt]
7058 /// and [RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
7059 /// This purpose is meant to be used for interoperable symmetric
7060 /// encryption and does not support automatic CryptoKey rotation.
7061 ///
7062 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7063 /// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
7064 /// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
7065 RawEncryptDecrypt,
7066 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7067 /// with [MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
7068 ///
7069 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7070 /// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
7071 Mac,
7072 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used
7073 /// with
7074 /// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]
7075 /// and [Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
7076 ///
7077 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
7078 /// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
7079 /// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
7080 KeyEncapsulation,
7081 /// If set, the enum was initialized with an unknown value.
7082 ///
7083 /// Applications can examine the value using [CryptoKeyPurpose::value] or
7084 /// [CryptoKeyPurpose::name].
7085 UnknownValue(crypto_key_purpose::UnknownValue),
7086 }
7087
7088 #[doc(hidden)]
7089 pub mod crypto_key_purpose {
7090 #[allow(unused_imports)]
7091 use super::*;
7092 #[derive(Clone, Debug, PartialEq)]
7093 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7094 }
7095
7096 impl CryptoKeyPurpose {
7097 /// Gets the enum value.
7098 ///
7099 /// Returns `None` if the enum contains an unknown value deserialized from
7100 /// the string representation of enums.
7101 pub fn value(&self) -> std::option::Option<i32> {
7102 match self {
7103 Self::Unspecified => std::option::Option::Some(0),
7104 Self::EncryptDecrypt => std::option::Option::Some(1),
7105 Self::AsymmetricSign => std::option::Option::Some(5),
7106 Self::AsymmetricDecrypt => std::option::Option::Some(6),
7107 Self::RawEncryptDecrypt => std::option::Option::Some(7),
7108 Self::Mac => std::option::Option::Some(9),
7109 Self::KeyEncapsulation => std::option::Option::Some(10),
7110 Self::UnknownValue(u) => u.0.value(),
7111 }
7112 }
7113
7114 /// Gets the enum value as a string.
7115 ///
7116 /// Returns `None` if the enum contains an unknown value deserialized from
7117 /// the integer representation of enums.
7118 pub fn name(&self) -> std::option::Option<&str> {
7119 match self {
7120 Self::Unspecified => std::option::Option::Some("CRYPTO_KEY_PURPOSE_UNSPECIFIED"),
7121 Self::EncryptDecrypt => std::option::Option::Some("ENCRYPT_DECRYPT"),
7122 Self::AsymmetricSign => std::option::Option::Some("ASYMMETRIC_SIGN"),
7123 Self::AsymmetricDecrypt => std::option::Option::Some("ASYMMETRIC_DECRYPT"),
7124 Self::RawEncryptDecrypt => std::option::Option::Some("RAW_ENCRYPT_DECRYPT"),
7125 Self::Mac => std::option::Option::Some("MAC"),
7126 Self::KeyEncapsulation => std::option::Option::Some("KEY_ENCAPSULATION"),
7127 Self::UnknownValue(u) => u.0.name(),
7128 }
7129 }
7130 }
7131
7132 impl std::default::Default for CryptoKeyPurpose {
7133 fn default() -> Self {
7134 use std::convert::From;
7135 Self::from(0)
7136 }
7137 }
7138
7139 impl std::fmt::Display for CryptoKeyPurpose {
7140 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7141 wkt::internal::display_enum(f, self.name(), self.value())
7142 }
7143 }
7144
7145 impl std::convert::From<i32> for CryptoKeyPurpose {
7146 fn from(value: i32) -> Self {
7147 match value {
7148 0 => Self::Unspecified,
7149 1 => Self::EncryptDecrypt,
7150 5 => Self::AsymmetricSign,
7151 6 => Self::AsymmetricDecrypt,
7152 7 => Self::RawEncryptDecrypt,
7153 9 => Self::Mac,
7154 10 => Self::KeyEncapsulation,
7155 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7156 wkt::internal::UnknownEnumValue::Integer(value),
7157 )),
7158 }
7159 }
7160 }
7161
7162 impl std::convert::From<&str> for CryptoKeyPurpose {
7163 fn from(value: &str) -> Self {
7164 use std::string::ToString;
7165 match value {
7166 "CRYPTO_KEY_PURPOSE_UNSPECIFIED" => Self::Unspecified,
7167 "ENCRYPT_DECRYPT" => Self::EncryptDecrypt,
7168 "ASYMMETRIC_SIGN" => Self::AsymmetricSign,
7169 "ASYMMETRIC_DECRYPT" => Self::AsymmetricDecrypt,
7170 "RAW_ENCRYPT_DECRYPT" => Self::RawEncryptDecrypt,
7171 "MAC" => Self::Mac,
7172 "KEY_ENCAPSULATION" => Self::KeyEncapsulation,
7173 _ => Self::UnknownValue(crypto_key_purpose::UnknownValue(
7174 wkt::internal::UnknownEnumValue::String(value.to_string()),
7175 )),
7176 }
7177 }
7178 }
7179
7180 impl serde::ser::Serialize for CryptoKeyPurpose {
7181 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7182 where
7183 S: serde::Serializer,
7184 {
7185 match self {
7186 Self::Unspecified => serializer.serialize_i32(0),
7187 Self::EncryptDecrypt => serializer.serialize_i32(1),
7188 Self::AsymmetricSign => serializer.serialize_i32(5),
7189 Self::AsymmetricDecrypt => serializer.serialize_i32(6),
7190 Self::RawEncryptDecrypt => serializer.serialize_i32(7),
7191 Self::Mac => serializer.serialize_i32(9),
7192 Self::KeyEncapsulation => serializer.serialize_i32(10),
7193 Self::UnknownValue(u) => u.0.serialize(serializer),
7194 }
7195 }
7196 }
7197
7198 impl<'de> serde::de::Deserialize<'de> for CryptoKeyPurpose {
7199 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7200 where
7201 D: serde::Deserializer<'de>,
7202 {
7203 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyPurpose>::new(
7204 ".google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose",
7205 ))
7206 }
7207 }
7208
7209 /// Controls the rate of automatic rotation.
7210 #[derive(Clone, Debug, PartialEq)]
7211 #[non_exhaustive]
7212 pub enum RotationSchedule {
7213 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7214 /// will be advanced by this period when the service automatically rotates a
7215 /// key. Must be at least 24 hours and at most 876,000 hours.
7216 ///
7217 /// If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is
7218 /// set,
7219 /// [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]
7220 /// must also be set.
7221 ///
7222 /// Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose]
7223 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]
7224 /// support automatic rotation. For other keys, this field must be omitted.
7225 ///
7226 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7227 /// [google.cloud.kms.v1.CryptoKey.next_rotation_time]: crate::model::CryptoKey::next_rotation_time
7228 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7229 /// [google.cloud.kms.v1.CryptoKey.rotation_period]: crate::model::CryptoKey::rotation_schedule
7230 RotationPeriod(std::boxed::Box<wkt::Duration>),
7231 }
7232}
7233
7234/// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate]
7235/// specifies the properties to use when creating a new
7236/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually
7237/// with
7238/// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
7239/// or automatically as a result of auto-rotation.
7240///
7241/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7242/// [google.cloud.kms.v1.CryptoKeyVersionTemplate]: crate::model::CryptoKeyVersionTemplate
7243/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
7244#[derive(Clone, Default, PartialEq)]
7245#[non_exhaustive]
7246pub struct CryptoKeyVersionTemplate {
7247 /// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating
7248 /// a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7249 /// template. Immutable. Defaults to
7250 /// [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE].
7251 ///
7252 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7253 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7254 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
7255 pub protection_level: crate::model::ProtectionLevel,
7256
7257 /// Required.
7258 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7259 /// to use when creating a
7260 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this
7261 /// template.
7262 ///
7263 /// For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both
7264 /// this field is omitted and
7265 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is
7266 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
7267 ///
7268 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
7269 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
7270 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7271 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7272 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7273
7274 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7275}
7276
7277impl CryptoKeyVersionTemplate {
7278 /// Creates a new default instance.
7279 pub fn new() -> Self {
7280 std::default::Default::default()
7281 }
7282
7283 /// Sets the value of [protection_level][crate::model::CryptoKeyVersionTemplate::protection_level].
7284 ///
7285 /// # Example
7286 /// ```ignore,no_run
7287 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7288 /// use google_cloud_kms_v1::model::ProtectionLevel;
7289 /// let x0 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Software);
7290 /// let x1 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::Hsm);
7291 /// let x2 = CryptoKeyVersionTemplate::new().set_protection_level(ProtectionLevel::External);
7292 /// ```
7293 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7294 mut self,
7295 v: T,
7296 ) -> Self {
7297 self.protection_level = v.into();
7298 self
7299 }
7300
7301 /// Sets the value of [algorithm][crate::model::CryptoKeyVersionTemplate::algorithm].
7302 ///
7303 /// # Example
7304 /// ```ignore,no_run
7305 /// # use google_cloud_kms_v1::model::CryptoKeyVersionTemplate;
7306 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7307 /// let x0 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7308 /// let x1 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7309 /// let x2 = CryptoKeyVersionTemplate::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7310 /// ```
7311 pub fn set_algorithm<
7312 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7313 >(
7314 mut self,
7315 v: T,
7316 ) -> Self {
7317 self.algorithm = v.into();
7318 self
7319 }
7320}
7321
7322impl wkt::message::Message for CryptoKeyVersionTemplate {
7323 fn typename() -> &'static str {
7324 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersionTemplate"
7325 }
7326}
7327
7328/// Contains an HSM-generated attestation about a key operation. For more
7329/// information, see [Verifying attestations]
7330/// (<https://cloud.google.com/kms/docs/attest-key>).
7331#[derive(Clone, Default, PartialEq)]
7332#[non_exhaustive]
7333pub struct KeyOperationAttestation {
7334 /// Output only. The format of the attestation data.
7335 pub format: crate::model::key_operation_attestation::AttestationFormat,
7336
7337 /// Output only. The attestation data provided by the HSM when the key
7338 /// operation was performed.
7339 pub content: ::bytes::Bytes,
7340
7341 /// Output only. The certificate chains needed to validate the attestation
7342 pub cert_chains:
7343 std::option::Option<crate::model::key_operation_attestation::CertificateChains>,
7344
7345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7346}
7347
7348impl KeyOperationAttestation {
7349 /// Creates a new default instance.
7350 pub fn new() -> Self {
7351 std::default::Default::default()
7352 }
7353
7354 /// Sets the value of [format][crate::model::KeyOperationAttestation::format].
7355 ///
7356 /// # Example
7357 /// ```ignore,no_run
7358 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7359 /// use google_cloud_kms_v1::model::key_operation_attestation::AttestationFormat;
7360 /// let x0 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV1Compressed);
7361 /// let x1 = KeyOperationAttestation::new().set_format(AttestationFormat::CaviumV2Compressed);
7362 /// ```
7363 pub fn set_format<
7364 T: std::convert::Into<crate::model::key_operation_attestation::AttestationFormat>,
7365 >(
7366 mut self,
7367 v: T,
7368 ) -> Self {
7369 self.format = v.into();
7370 self
7371 }
7372
7373 /// Sets the value of [content][crate::model::KeyOperationAttestation::content].
7374 ///
7375 /// # Example
7376 /// ```ignore,no_run
7377 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7378 /// let x = KeyOperationAttestation::new().set_content(bytes::Bytes::from_static(b"example"));
7379 /// ```
7380 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
7381 self.content = v.into();
7382 self
7383 }
7384
7385 /// Sets the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7386 ///
7387 /// # Example
7388 /// ```ignore,no_run
7389 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7390 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7391 /// let x = KeyOperationAttestation::new().set_cert_chains(CertificateChains::default()/* use setters */);
7392 /// ```
7393 pub fn set_cert_chains<T>(mut self, v: T) -> Self
7394 where
7395 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7396 {
7397 self.cert_chains = std::option::Option::Some(v.into());
7398 self
7399 }
7400
7401 /// Sets or clears the value of [cert_chains][crate::model::KeyOperationAttestation::cert_chains].
7402 ///
7403 /// # Example
7404 /// ```ignore,no_run
7405 /// # use google_cloud_kms_v1::model::KeyOperationAttestation;
7406 /// use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7407 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(Some(CertificateChains::default()/* use setters */));
7408 /// let x = KeyOperationAttestation::new().set_or_clear_cert_chains(None::<CertificateChains>);
7409 /// ```
7410 pub fn set_or_clear_cert_chains<T>(mut self, v: std::option::Option<T>) -> Self
7411 where
7412 T: std::convert::Into<crate::model::key_operation_attestation::CertificateChains>,
7413 {
7414 self.cert_chains = v.map(|x| x.into());
7415 self
7416 }
7417}
7418
7419impl wkt::message::Message for KeyOperationAttestation {
7420 fn typename() -> &'static str {
7421 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation"
7422 }
7423}
7424
7425/// Defines additional types related to [KeyOperationAttestation].
7426pub mod key_operation_attestation {
7427 #[allow(unused_imports)]
7428 use super::*;
7429
7430 /// Certificate chains needed to verify the attestation.
7431 /// Certificates in chains are PEM-encoded and are ordered based on
7432 /// <https://tools.ietf.org/html/rfc5246#section-7.4.2>.
7433 #[derive(Clone, Default, PartialEq)]
7434 #[non_exhaustive]
7435 pub struct CertificateChains {
7436 /// Cavium certificate chain corresponding to the attestation.
7437 pub cavium_certs: std::vec::Vec<std::string::String>,
7438
7439 /// Google card certificate chain corresponding to the attestation.
7440 pub google_card_certs: std::vec::Vec<std::string::String>,
7441
7442 /// Google partition certificate chain corresponding to the attestation.
7443 pub google_partition_certs: std::vec::Vec<std::string::String>,
7444
7445 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7446 }
7447
7448 impl CertificateChains {
7449 /// Creates a new default instance.
7450 pub fn new() -> Self {
7451 std::default::Default::default()
7452 }
7453
7454 /// Sets the value of [cavium_certs][crate::model::key_operation_attestation::CertificateChains::cavium_certs].
7455 ///
7456 /// # Example
7457 /// ```ignore,no_run
7458 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7459 /// let x = CertificateChains::new().set_cavium_certs(["a", "b", "c"]);
7460 /// ```
7461 pub fn set_cavium_certs<T, V>(mut self, v: T) -> Self
7462 where
7463 T: std::iter::IntoIterator<Item = V>,
7464 V: std::convert::Into<std::string::String>,
7465 {
7466 use std::iter::Iterator;
7467 self.cavium_certs = v.into_iter().map(|i| i.into()).collect();
7468 self
7469 }
7470
7471 /// Sets the value of [google_card_certs][crate::model::key_operation_attestation::CertificateChains::google_card_certs].
7472 ///
7473 /// # Example
7474 /// ```ignore,no_run
7475 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7476 /// let x = CertificateChains::new().set_google_card_certs(["a", "b", "c"]);
7477 /// ```
7478 pub fn set_google_card_certs<T, V>(mut self, v: T) -> Self
7479 where
7480 T: std::iter::IntoIterator<Item = V>,
7481 V: std::convert::Into<std::string::String>,
7482 {
7483 use std::iter::Iterator;
7484 self.google_card_certs = v.into_iter().map(|i| i.into()).collect();
7485 self
7486 }
7487
7488 /// Sets the value of [google_partition_certs][crate::model::key_operation_attestation::CertificateChains::google_partition_certs].
7489 ///
7490 /// # Example
7491 /// ```ignore,no_run
7492 /// # use google_cloud_kms_v1::model::key_operation_attestation::CertificateChains;
7493 /// let x = CertificateChains::new().set_google_partition_certs(["a", "b", "c"]);
7494 /// ```
7495 pub fn set_google_partition_certs<T, V>(mut self, v: T) -> Self
7496 where
7497 T: std::iter::IntoIterator<Item = V>,
7498 V: std::convert::Into<std::string::String>,
7499 {
7500 use std::iter::Iterator;
7501 self.google_partition_certs = v.into_iter().map(|i| i.into()).collect();
7502 self
7503 }
7504 }
7505
7506 impl wkt::message::Message for CertificateChains {
7507 fn typename() -> &'static str {
7508 "type.googleapis.com/google.cloud.kms.v1.KeyOperationAttestation.CertificateChains"
7509 }
7510 }
7511
7512 /// Attestation formats provided by the HSM.
7513 ///
7514 /// # Working with unknown values
7515 ///
7516 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7517 /// additional enum variants at any time. Adding new variants is not considered
7518 /// a breaking change. Applications should write their code in anticipation of:
7519 ///
7520 /// - New values appearing in future releases of the client library, **and**
7521 /// - New values received dynamically, without application changes.
7522 ///
7523 /// Please consult the [Working with enums] section in the user guide for some
7524 /// guidelines.
7525 ///
7526 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
7527 #[derive(Clone, Debug, PartialEq)]
7528 #[non_exhaustive]
7529 pub enum AttestationFormat {
7530 /// Not specified.
7531 Unspecified,
7532 /// Cavium HSM attestation compressed with gzip. Note that this format is
7533 /// defined by Cavium and subject to change at any time.
7534 ///
7535 /// See
7536 /// <https://www.marvell.com/products/security-solutions/nitrox-hs-adapters/software-key-attestation.html>.
7537 CaviumV1Compressed,
7538 /// Cavium HSM attestation V2 compressed with gzip. This is a new format
7539 /// introduced in Cavium's version 3.2-08.
7540 CaviumV2Compressed,
7541 /// If set, the enum was initialized with an unknown value.
7542 ///
7543 /// Applications can examine the value using [AttestationFormat::value] or
7544 /// [AttestationFormat::name].
7545 UnknownValue(attestation_format::UnknownValue),
7546 }
7547
7548 #[doc(hidden)]
7549 pub mod attestation_format {
7550 #[allow(unused_imports)]
7551 use super::*;
7552 #[derive(Clone, Debug, PartialEq)]
7553 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7554 }
7555
7556 impl AttestationFormat {
7557 /// Gets the enum value.
7558 ///
7559 /// Returns `None` if the enum contains an unknown value deserialized from
7560 /// the string representation of enums.
7561 pub fn value(&self) -> std::option::Option<i32> {
7562 match self {
7563 Self::Unspecified => std::option::Option::Some(0),
7564 Self::CaviumV1Compressed => std::option::Option::Some(3),
7565 Self::CaviumV2Compressed => std::option::Option::Some(4),
7566 Self::UnknownValue(u) => u.0.value(),
7567 }
7568 }
7569
7570 /// Gets the enum value as a string.
7571 ///
7572 /// Returns `None` if the enum contains an unknown value deserialized from
7573 /// the integer representation of enums.
7574 pub fn name(&self) -> std::option::Option<&str> {
7575 match self {
7576 Self::Unspecified => std::option::Option::Some("ATTESTATION_FORMAT_UNSPECIFIED"),
7577 Self::CaviumV1Compressed => std::option::Option::Some("CAVIUM_V1_COMPRESSED"),
7578 Self::CaviumV2Compressed => std::option::Option::Some("CAVIUM_V2_COMPRESSED"),
7579 Self::UnknownValue(u) => u.0.name(),
7580 }
7581 }
7582 }
7583
7584 impl std::default::Default for AttestationFormat {
7585 fn default() -> Self {
7586 use std::convert::From;
7587 Self::from(0)
7588 }
7589 }
7590
7591 impl std::fmt::Display for AttestationFormat {
7592 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7593 wkt::internal::display_enum(f, self.name(), self.value())
7594 }
7595 }
7596
7597 impl std::convert::From<i32> for AttestationFormat {
7598 fn from(value: i32) -> Self {
7599 match value {
7600 0 => Self::Unspecified,
7601 3 => Self::CaviumV1Compressed,
7602 4 => Self::CaviumV2Compressed,
7603 _ => Self::UnknownValue(attestation_format::UnknownValue(
7604 wkt::internal::UnknownEnumValue::Integer(value),
7605 )),
7606 }
7607 }
7608 }
7609
7610 impl std::convert::From<&str> for AttestationFormat {
7611 fn from(value: &str) -> Self {
7612 use std::string::ToString;
7613 match value {
7614 "ATTESTATION_FORMAT_UNSPECIFIED" => Self::Unspecified,
7615 "CAVIUM_V1_COMPRESSED" => Self::CaviumV1Compressed,
7616 "CAVIUM_V2_COMPRESSED" => Self::CaviumV2Compressed,
7617 _ => Self::UnknownValue(attestation_format::UnknownValue(
7618 wkt::internal::UnknownEnumValue::String(value.to_string()),
7619 )),
7620 }
7621 }
7622 }
7623
7624 impl serde::ser::Serialize for AttestationFormat {
7625 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7626 where
7627 S: serde::Serializer,
7628 {
7629 match self {
7630 Self::Unspecified => serializer.serialize_i32(0),
7631 Self::CaviumV1Compressed => serializer.serialize_i32(3),
7632 Self::CaviumV2Compressed => serializer.serialize_i32(4),
7633 Self::UnknownValue(u) => u.0.serialize(serializer),
7634 }
7635 }
7636 }
7637
7638 impl<'de> serde::de::Deserialize<'de> for AttestationFormat {
7639 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7640 where
7641 D: serde::Deserializer<'de>,
7642 {
7643 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttestationFormat>::new(
7644 ".google.cloud.kms.v1.KeyOperationAttestation.AttestationFormat",
7645 ))
7646 }
7647 }
7648}
7649
7650/// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an
7651/// individual cryptographic key, and the associated key material.
7652///
7653/// An
7654/// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
7655/// version can be used for cryptographic operations.
7656///
7657/// For security reasons, the raw cryptographic key material represented by a
7658/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed
7659/// or exported. It can only be used to encrypt, decrypt, or sign data when an
7660/// authorized user or application invokes Cloud KMS.
7661///
7662/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7663/// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
7664#[derive(Clone, Default, PartialEq)]
7665#[non_exhaustive]
7666pub struct CryptoKeyVersion {
7667 /// Output only. The resource name for this
7668 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format
7669 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`.
7670 ///
7671 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7672 pub name: std::string::String,
7673
7674 /// The current state of the
7675 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7676 ///
7677 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7678 pub state: crate::model::crypto_key_version::CryptoKeyVersionState,
7679
7680 /// Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel]
7681 /// describing how crypto operations are performed with this
7682 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
7683 ///
7684 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7685 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
7686 pub protection_level: crate::model::ProtectionLevel,
7687
7688 /// Output only. The
7689 /// [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
7690 /// that this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
7691 /// supports.
7692 ///
7693 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7694 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
7695 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
7696
7697 /// Output only. Statement that was generated and signed by the HSM at key
7698 /// creation time. Use this statement to verify attributes of the key as stored
7699 /// on the HSM, independently of Google. Only provided for key versions with
7700 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level]
7701 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
7702 ///
7703 /// [google.cloud.kms.v1.CryptoKeyVersion.protection_level]: crate::model::CryptoKeyVersion::protection_level
7704 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
7705 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
7706
7707 /// Output only. The time at which this
7708 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created.
7709 ///
7710 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7711 pub create_time: std::option::Option<wkt::Timestamp>,
7712
7713 /// Output only. The time this
7714 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7715 /// generated.
7716 ///
7717 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7718 pub generate_time: std::option::Option<wkt::Timestamp>,
7719
7720 /// Output only. The time this
7721 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is
7722 /// scheduled for destruction. Only present if
7723 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7724 /// [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED].
7725 ///
7726 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7727 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]: crate::model::crypto_key_version::CryptoKeyVersionState::DestroyScheduled
7728 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7729 pub destroy_time: std::option::Option<wkt::Timestamp>,
7730
7731 /// Output only. The time this CryptoKeyVersion's key material was
7732 /// destroyed. Only present if
7733 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7734 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED].
7735 ///
7736 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
7737 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7738 pub destroy_event_time: std::option::Option<wkt::Timestamp>,
7739
7740 /// Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob]
7741 /// used in the most recent import of this
7742 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if
7743 /// the underlying key material was imported.
7744 ///
7745 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7746 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
7747 pub import_job: std::string::String,
7748
7749 /// Output only. The time at which this
7750 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was
7751 /// most recently imported.
7752 ///
7753 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7754 pub import_time: std::option::Option<wkt::Timestamp>,
7755
7756 /// Output only. The root cause of the most recent import failure. Only present
7757 /// if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7758 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED].
7759 ///
7760 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
7761 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7762 pub import_failure_reason: std::string::String,
7763
7764 /// Output only. The root cause of the most recent generation failure. Only
7765 /// present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7766 /// [GENERATION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED].
7767 ///
7768 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.GENERATION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::GenerationFailed
7769 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7770 pub generation_failure_reason: std::string::String,
7771
7772 /// Output only. The root cause of the most recent external destruction
7773 /// failure. Only present if
7774 /// [state][google.cloud.kms.v1.CryptoKeyVersion.state] is
7775 /// [EXTERNAL_DESTRUCTION_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED].
7776 ///
7777 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.EXTERNAL_DESTRUCTION_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ExternalDestructionFailed
7778 /// [google.cloud.kms.v1.CryptoKeyVersion.state]: crate::model::CryptoKeyVersion::state
7779 pub external_destruction_failure_reason: std::string::String,
7780
7781 /// ExternalProtectionLevelOptions stores a group of additional fields for
7782 /// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
7783 /// are specific to the
7784 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] protection level
7785 /// and [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]
7786 /// protection levels.
7787 ///
7788 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
7789 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
7790 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
7791 pub external_protection_level_options:
7792 std::option::Option<crate::model::ExternalProtectionLevelOptions>,
7793
7794 /// Output only. Whether or not this key version is eligible for reimport, by
7795 /// being specified as a target in
7796 /// [ImportCryptoKeyVersionRequest.crypto_key_version][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version].
7797 ///
7798 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.crypto_key_version]: crate::model::ImportCryptoKeyVersionRequest::crypto_key_version
7799 pub reimport_eligible: bool,
7800
7801 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7802}
7803
7804impl CryptoKeyVersion {
7805 /// Creates a new default instance.
7806 pub fn new() -> Self {
7807 std::default::Default::default()
7808 }
7809
7810 /// Sets the value of [name][crate::model::CryptoKeyVersion::name].
7811 ///
7812 /// # Example
7813 /// ```ignore,no_run
7814 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7815 /// # let project_id = "project_id";
7816 /// # let location_id = "location_id";
7817 /// # let key_ring_id = "key_ring_id";
7818 /// # let crypto_key_id = "crypto_key_id";
7819 /// # let crypto_key_version_id = "crypto_key_version_id";
7820 /// let x = CryptoKeyVersion::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
7821 /// ```
7822 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7823 self.name = v.into();
7824 self
7825 }
7826
7827 /// Sets the value of [state][crate::model::CryptoKeyVersion::state].
7828 ///
7829 /// # Example
7830 /// ```ignore,no_run
7831 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7832 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionState;
7833 /// let x0 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::PendingGeneration);
7834 /// let x1 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Enabled);
7835 /// let x2 = CryptoKeyVersion::new().set_state(CryptoKeyVersionState::Disabled);
7836 /// ```
7837 pub fn set_state<
7838 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionState>,
7839 >(
7840 mut self,
7841 v: T,
7842 ) -> Self {
7843 self.state = v.into();
7844 self
7845 }
7846
7847 /// Sets the value of [protection_level][crate::model::CryptoKeyVersion::protection_level].
7848 ///
7849 /// # Example
7850 /// ```ignore,no_run
7851 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7852 /// use google_cloud_kms_v1::model::ProtectionLevel;
7853 /// let x0 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Software);
7854 /// let x1 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::Hsm);
7855 /// let x2 = CryptoKeyVersion::new().set_protection_level(ProtectionLevel::External);
7856 /// ```
7857 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
7858 mut self,
7859 v: T,
7860 ) -> Self {
7861 self.protection_level = v.into();
7862 self
7863 }
7864
7865 /// Sets the value of [algorithm][crate::model::CryptoKeyVersion::algorithm].
7866 ///
7867 /// # Example
7868 /// ```ignore,no_run
7869 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7870 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
7871 /// let x0 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
7872 /// let x1 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
7873 /// let x2 = CryptoKeyVersion::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
7874 /// ```
7875 pub fn set_algorithm<
7876 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
7877 >(
7878 mut self,
7879 v: T,
7880 ) -> Self {
7881 self.algorithm = v.into();
7882 self
7883 }
7884
7885 /// Sets the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7886 ///
7887 /// # Example
7888 /// ```ignore,no_run
7889 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7890 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7891 /// let x = CryptoKeyVersion::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
7892 /// ```
7893 pub fn set_attestation<T>(mut self, v: T) -> Self
7894 where
7895 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7896 {
7897 self.attestation = std::option::Option::Some(v.into());
7898 self
7899 }
7900
7901 /// Sets or clears the value of [attestation][crate::model::CryptoKeyVersion::attestation].
7902 ///
7903 /// # Example
7904 /// ```ignore,no_run
7905 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7906 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
7907 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
7908 /// let x = CryptoKeyVersion::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
7909 /// ```
7910 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
7911 where
7912 T: std::convert::Into<crate::model::KeyOperationAttestation>,
7913 {
7914 self.attestation = v.map(|x| x.into());
7915 self
7916 }
7917
7918 /// Sets the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7919 ///
7920 /// # Example
7921 /// ```ignore,no_run
7922 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7923 /// use wkt::Timestamp;
7924 /// let x = CryptoKeyVersion::new().set_create_time(Timestamp::default()/* use setters */);
7925 /// ```
7926 pub fn set_create_time<T>(mut self, v: T) -> Self
7927 where
7928 T: std::convert::Into<wkt::Timestamp>,
7929 {
7930 self.create_time = std::option::Option::Some(v.into());
7931 self
7932 }
7933
7934 /// Sets or clears the value of [create_time][crate::model::CryptoKeyVersion::create_time].
7935 ///
7936 /// # Example
7937 /// ```ignore,no_run
7938 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7939 /// use wkt::Timestamp;
7940 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
7941 /// let x = CryptoKeyVersion::new().set_or_clear_create_time(None::<Timestamp>);
7942 /// ```
7943 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
7944 where
7945 T: std::convert::Into<wkt::Timestamp>,
7946 {
7947 self.create_time = v.map(|x| x.into());
7948 self
7949 }
7950
7951 /// Sets the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7952 ///
7953 /// # Example
7954 /// ```ignore,no_run
7955 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7956 /// use wkt::Timestamp;
7957 /// let x = CryptoKeyVersion::new().set_generate_time(Timestamp::default()/* use setters */);
7958 /// ```
7959 pub fn set_generate_time<T>(mut self, v: T) -> Self
7960 where
7961 T: std::convert::Into<wkt::Timestamp>,
7962 {
7963 self.generate_time = std::option::Option::Some(v.into());
7964 self
7965 }
7966
7967 /// Sets or clears the value of [generate_time][crate::model::CryptoKeyVersion::generate_time].
7968 ///
7969 /// # Example
7970 /// ```ignore,no_run
7971 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7972 /// use wkt::Timestamp;
7973 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
7974 /// let x = CryptoKeyVersion::new().set_or_clear_generate_time(None::<Timestamp>);
7975 /// ```
7976 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
7977 where
7978 T: std::convert::Into<wkt::Timestamp>,
7979 {
7980 self.generate_time = v.map(|x| x.into());
7981 self
7982 }
7983
7984 /// Sets the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
7985 ///
7986 /// # Example
7987 /// ```ignore,no_run
7988 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
7989 /// use wkt::Timestamp;
7990 /// let x = CryptoKeyVersion::new().set_destroy_time(Timestamp::default()/* use setters */);
7991 /// ```
7992 pub fn set_destroy_time<T>(mut self, v: T) -> Self
7993 where
7994 T: std::convert::Into<wkt::Timestamp>,
7995 {
7996 self.destroy_time = std::option::Option::Some(v.into());
7997 self
7998 }
7999
8000 /// Sets or clears the value of [destroy_time][crate::model::CryptoKeyVersion::destroy_time].
8001 ///
8002 /// # Example
8003 /// ```ignore,no_run
8004 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8005 /// use wkt::Timestamp;
8006 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(Some(Timestamp::default()/* use setters */));
8007 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_time(None::<Timestamp>);
8008 /// ```
8009 pub fn set_or_clear_destroy_time<T>(mut self, v: std::option::Option<T>) -> Self
8010 where
8011 T: std::convert::Into<wkt::Timestamp>,
8012 {
8013 self.destroy_time = v.map(|x| x.into());
8014 self
8015 }
8016
8017 /// Sets the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
8018 ///
8019 /// # Example
8020 /// ```ignore,no_run
8021 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8022 /// use wkt::Timestamp;
8023 /// let x = CryptoKeyVersion::new().set_destroy_event_time(Timestamp::default()/* use setters */);
8024 /// ```
8025 pub fn set_destroy_event_time<T>(mut self, v: T) -> Self
8026 where
8027 T: std::convert::Into<wkt::Timestamp>,
8028 {
8029 self.destroy_event_time = std::option::Option::Some(v.into());
8030 self
8031 }
8032
8033 /// Sets or clears the value of [destroy_event_time][crate::model::CryptoKeyVersion::destroy_event_time].
8034 ///
8035 /// # Example
8036 /// ```ignore,no_run
8037 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8038 /// use wkt::Timestamp;
8039 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(Some(Timestamp::default()/* use setters */));
8040 /// let x = CryptoKeyVersion::new().set_or_clear_destroy_event_time(None::<Timestamp>);
8041 /// ```
8042 pub fn set_or_clear_destroy_event_time<T>(mut self, v: std::option::Option<T>) -> Self
8043 where
8044 T: std::convert::Into<wkt::Timestamp>,
8045 {
8046 self.destroy_event_time = v.map(|x| x.into());
8047 self
8048 }
8049
8050 /// Sets the value of [import_job][crate::model::CryptoKeyVersion::import_job].
8051 ///
8052 /// # Example
8053 /// ```ignore,no_run
8054 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8055 /// let x = CryptoKeyVersion::new().set_import_job("example");
8056 /// ```
8057 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8058 self.import_job = v.into();
8059 self
8060 }
8061
8062 /// Sets the value of [import_time][crate::model::CryptoKeyVersion::import_time].
8063 ///
8064 /// # Example
8065 /// ```ignore,no_run
8066 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8067 /// use wkt::Timestamp;
8068 /// let x = CryptoKeyVersion::new().set_import_time(Timestamp::default()/* use setters */);
8069 /// ```
8070 pub fn set_import_time<T>(mut self, v: T) -> Self
8071 where
8072 T: std::convert::Into<wkt::Timestamp>,
8073 {
8074 self.import_time = std::option::Option::Some(v.into());
8075 self
8076 }
8077
8078 /// Sets or clears the value of [import_time][crate::model::CryptoKeyVersion::import_time].
8079 ///
8080 /// # Example
8081 /// ```ignore,no_run
8082 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8083 /// use wkt::Timestamp;
8084 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(Some(Timestamp::default()/* use setters */));
8085 /// let x = CryptoKeyVersion::new().set_or_clear_import_time(None::<Timestamp>);
8086 /// ```
8087 pub fn set_or_clear_import_time<T>(mut self, v: std::option::Option<T>) -> Self
8088 where
8089 T: std::convert::Into<wkt::Timestamp>,
8090 {
8091 self.import_time = v.map(|x| x.into());
8092 self
8093 }
8094
8095 /// Sets the value of [import_failure_reason][crate::model::CryptoKeyVersion::import_failure_reason].
8096 ///
8097 /// # Example
8098 /// ```ignore,no_run
8099 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8100 /// let x = CryptoKeyVersion::new().set_import_failure_reason("example");
8101 /// ```
8102 pub fn set_import_failure_reason<T: std::convert::Into<std::string::String>>(
8103 mut self,
8104 v: T,
8105 ) -> Self {
8106 self.import_failure_reason = v.into();
8107 self
8108 }
8109
8110 /// Sets the value of [generation_failure_reason][crate::model::CryptoKeyVersion::generation_failure_reason].
8111 ///
8112 /// # Example
8113 /// ```ignore,no_run
8114 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8115 /// let x = CryptoKeyVersion::new().set_generation_failure_reason("example");
8116 /// ```
8117 pub fn set_generation_failure_reason<T: std::convert::Into<std::string::String>>(
8118 mut self,
8119 v: T,
8120 ) -> Self {
8121 self.generation_failure_reason = v.into();
8122 self
8123 }
8124
8125 /// Sets the value of [external_destruction_failure_reason][crate::model::CryptoKeyVersion::external_destruction_failure_reason].
8126 ///
8127 /// # Example
8128 /// ```ignore,no_run
8129 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8130 /// let x = CryptoKeyVersion::new().set_external_destruction_failure_reason("example");
8131 /// ```
8132 pub fn set_external_destruction_failure_reason<T: std::convert::Into<std::string::String>>(
8133 mut self,
8134 v: T,
8135 ) -> Self {
8136 self.external_destruction_failure_reason = v.into();
8137 self
8138 }
8139
8140 /// Sets the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8141 ///
8142 /// # Example
8143 /// ```ignore,no_run
8144 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8145 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8146 /// let x = CryptoKeyVersion::new().set_external_protection_level_options(ExternalProtectionLevelOptions::default()/* use setters */);
8147 /// ```
8148 pub fn set_external_protection_level_options<T>(mut self, v: T) -> Self
8149 where
8150 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8151 {
8152 self.external_protection_level_options = std::option::Option::Some(v.into());
8153 self
8154 }
8155
8156 /// Sets or clears the value of [external_protection_level_options][crate::model::CryptoKeyVersion::external_protection_level_options].
8157 ///
8158 /// # Example
8159 /// ```ignore,no_run
8160 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8161 /// use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
8162 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(Some(ExternalProtectionLevelOptions::default()/* use setters */));
8163 /// let x = CryptoKeyVersion::new().set_or_clear_external_protection_level_options(None::<ExternalProtectionLevelOptions>);
8164 /// ```
8165 pub fn set_or_clear_external_protection_level_options<T>(
8166 mut self,
8167 v: std::option::Option<T>,
8168 ) -> Self
8169 where
8170 T: std::convert::Into<crate::model::ExternalProtectionLevelOptions>,
8171 {
8172 self.external_protection_level_options = v.map(|x| x.into());
8173 self
8174 }
8175
8176 /// Sets the value of [reimport_eligible][crate::model::CryptoKeyVersion::reimport_eligible].
8177 ///
8178 /// # Example
8179 /// ```ignore,no_run
8180 /// # use google_cloud_kms_v1::model::CryptoKeyVersion;
8181 /// let x = CryptoKeyVersion::new().set_reimport_eligible(true);
8182 /// ```
8183 pub fn set_reimport_eligible<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8184 self.reimport_eligible = v.into();
8185 self
8186 }
8187}
8188
8189impl wkt::message::Message for CryptoKeyVersion {
8190 fn typename() -> &'static str {
8191 "type.googleapis.com/google.cloud.kms.v1.CryptoKeyVersion"
8192 }
8193}
8194
8195/// Defines additional types related to [CryptoKeyVersion].
8196pub mod crypto_key_version {
8197 #[allow(unused_imports)]
8198 use super::*;
8199
8200 /// The algorithm of the
8201 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what
8202 /// parameters must be used for each cryptographic operation.
8203 ///
8204 /// The
8205 /// [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]
8206 /// algorithm is usable with
8207 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8208 /// [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].
8209 ///
8210 /// Algorithms beginning with `RSA_SIGN_` are usable with
8211 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8212 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8213 ///
8214 /// The fields in the name after `RSA_SIGN_` correspond to the following
8215 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8216 ///
8217 /// For PSS, the salt length used is equal to the length of digest
8218 /// algorithm. For example,
8219 /// [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]
8220 /// will use PSS with a salt length of 256 bits or 32 bytes.
8221 ///
8222 /// Algorithms beginning with `RSA_DECRYPT_` are usable with
8223 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8224 /// [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].
8225 ///
8226 /// The fields in the name after `RSA_DECRYPT_` correspond to the following
8227 /// parameters: padding algorithm, modulus bit length, and digest algorithm.
8228 ///
8229 /// Algorithms beginning with `EC_SIGN_` are usable with
8230 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8231 /// [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN].
8232 ///
8233 /// The fields in the name after `EC_SIGN_` correspond to the following
8234 /// parameters: elliptic curve, digest algorithm.
8235 ///
8236 /// Algorithms beginning with `HMAC_` are usable with
8237 /// [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose]
8238 /// [MAC][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC].
8239 ///
8240 /// The suffix following `HMAC_` corresponds to the hash algorithm being used
8241 /// (eg. SHA256).
8242 ///
8243 /// Algorithms beginning with `PQ_` are post-quantum.
8244 ///
8245 /// For more information, see [Key purposes and algorithms]
8246 /// (<https://cloud.google.com/kms/docs/algorithms>).
8247 ///
8248 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricDecrypt
8249 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]: crate::model::crypto_key::CryptoKeyPurpose::AsymmetricSign
8250 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]: crate::model::crypto_key::CryptoKeyPurpose::EncryptDecrypt
8251 /// [google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.MAC]: crate::model::crypto_key::CryptoKeyPurpose::Mac
8252 /// [google.cloud.kms.v1.CryptoKey.purpose]: crate::model::CryptoKey::purpose
8253 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8254 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption
8255 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm::RsaSignPss2048Sha256
8256 ///
8257 /// # Working with unknown values
8258 ///
8259 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8260 /// additional enum variants at any time. Adding new variants is not considered
8261 /// a breaking change. Applications should write their code in anticipation of:
8262 ///
8263 /// - New values appearing in future releases of the client library, **and**
8264 /// - New values received dynamically, without application changes.
8265 ///
8266 /// Please consult the [Working with enums] section in the user guide for some
8267 /// guidelines.
8268 ///
8269 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8270 #[derive(Clone, Debug, PartialEq)]
8271 #[non_exhaustive]
8272 pub enum CryptoKeyVersionAlgorithm {
8273 /// Not specified.
8274 Unspecified,
8275 /// Creates symmetric encryption keys.
8276 GoogleSymmetricEncryption,
8277 /// AES-GCM (Galois Counter Mode) using 128-bit keys.
8278 Aes128Gcm,
8279 /// AES-GCM (Galois Counter Mode) using 256-bit keys.
8280 Aes256Gcm,
8281 /// AES-CBC (Cipher Block Chaining Mode) using 128-bit keys.
8282 Aes128Cbc,
8283 /// AES-CBC (Cipher Block Chaining Mode) using 256-bit keys.
8284 Aes256Cbc,
8285 /// AES-CTR (Counter Mode) using 128-bit keys.
8286 Aes128Ctr,
8287 /// AES-CTR (Counter Mode) using 256-bit keys.
8288 Aes256Ctr,
8289 /// RSASSA-PSS 2048 bit key with a SHA256 digest.
8290 RsaSignPss2048Sha256,
8291 /// RSASSA-PSS 3072 bit key with a SHA256 digest.
8292 RsaSignPss3072Sha256,
8293 /// RSASSA-PSS 4096 bit key with a SHA256 digest.
8294 RsaSignPss4096Sha256,
8295 /// RSASSA-PSS 4096 bit key with a SHA512 digest.
8296 RsaSignPss4096Sha512,
8297 /// RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest.
8298 RsaSignPkcs12048Sha256,
8299 /// RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest.
8300 RsaSignPkcs13072Sha256,
8301 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest.
8302 RsaSignPkcs14096Sha256,
8303 /// RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest.
8304 RsaSignPkcs14096Sha512,
8305 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 2048 bit key.
8306 RsaSignRawPkcs12048,
8307 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 3072 bit key.
8308 RsaSignRawPkcs13072,
8309 /// RSASSA-PKCS1-v1_5 signing without encoding, with a 4096 bit key.
8310 RsaSignRawPkcs14096,
8311 /// RSAES-OAEP 2048 bit key with a SHA256 digest.
8312 RsaDecryptOaep2048Sha256,
8313 /// RSAES-OAEP 3072 bit key with a SHA256 digest.
8314 RsaDecryptOaep3072Sha256,
8315 /// RSAES-OAEP 4096 bit key with a SHA256 digest.
8316 RsaDecryptOaep4096Sha256,
8317 /// RSAES-OAEP 4096 bit key with a SHA512 digest.
8318 RsaDecryptOaep4096Sha512,
8319 /// RSAES-OAEP 2048 bit key with a SHA1 digest.
8320 RsaDecryptOaep2048Sha1,
8321 /// RSAES-OAEP 3072 bit key with a SHA1 digest.
8322 RsaDecryptOaep3072Sha1,
8323 /// RSAES-OAEP 4096 bit key with a SHA1 digest.
8324 RsaDecryptOaep4096Sha1,
8325 /// ECDSA on the NIST P-256 curve with a SHA256 digest.
8326 /// Other hash functions can also be used:
8327 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8328 EcSignP256Sha256,
8329 /// ECDSA on the NIST P-384 curve with a SHA384 digest.
8330 /// Other hash functions can also be used:
8331 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8332 EcSignP384Sha384,
8333 /// ECDSA on the non-NIST secp256k1 curve. This curve is only supported for
8334 /// HSM protection level.
8335 /// Other hash functions can also be used:
8336 /// <https://cloud.google.com/kms/docs/create-validate-signatures#ecdsa_support_for_other_hash_algorithms>
8337 EcSignSecp256K1Sha256,
8338 /// EdDSA on the Curve25519 in pure mode (taking data as input).
8339 EcSignEd25519,
8340 /// HMAC-SHA256 signing with a 256 bit key.
8341 HmacSha256,
8342 /// HMAC-SHA1 signing with a 160 bit key.
8343 HmacSha1,
8344 /// HMAC-SHA384 signing with a 384 bit key.
8345 HmacSha384,
8346 /// HMAC-SHA512 signing with a 512 bit key.
8347 HmacSha512,
8348 /// HMAC-SHA224 signing with a 224 bit key.
8349 HmacSha224,
8350 /// Algorithm representing symmetric encryption by an external key manager.
8351 ExternalSymmetricEncryption,
8352 /// ML-KEM-768 (FIPS 203)
8353 MlKem768,
8354 /// ML-KEM-1024 (FIPS 203)
8355 MlKem1024,
8356 /// X-Wing hybrid KEM combining ML-KEM-768 with X25519 following
8357 /// datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem/.
8358 KemXwing,
8359 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8360 /// security level 1. Randomized version.
8361 PqSignMlDsa44,
8362 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8363 /// security level 3. Randomized version.
8364 PqSignMlDsa65,
8365 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8366 /// security level 5. Randomized version.
8367 PqSignMlDsa87,
8368 /// The post-quantum stateless hash-based digital signature algorithm, at
8369 /// security level 1. Randomized version.
8370 PqSignSlhDsaSha2128S,
8371 /// The post-quantum stateless hash-based digital signature algorithm, at
8372 /// security level 1. Randomized pre-hash version supporting SHA256 digests.
8373 PqSignHashSlhDsaSha2128SSha256,
8374 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8375 /// security level 1. Randomized version supporting externally-computed
8376 /// message representatives.
8377 PqSignMlDsa44ExternalMu,
8378 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8379 /// security level 3. Randomized version supporting externally-computed
8380 /// message representatives.
8381 PqSignMlDsa65ExternalMu,
8382 /// The post-quantum Module-Lattice-Based Digital Signature Algorithm, at
8383 /// security level 5. Randomized version supporting externally-computed
8384 /// message representatives.
8385 PqSignMlDsa87ExternalMu,
8386 /// If set, the enum was initialized with an unknown value.
8387 ///
8388 /// Applications can examine the value using [CryptoKeyVersionAlgorithm::value] or
8389 /// [CryptoKeyVersionAlgorithm::name].
8390 UnknownValue(crypto_key_version_algorithm::UnknownValue),
8391 }
8392
8393 #[doc(hidden)]
8394 pub mod crypto_key_version_algorithm {
8395 #[allow(unused_imports)]
8396 use super::*;
8397 #[derive(Clone, Debug, PartialEq)]
8398 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8399 }
8400
8401 impl CryptoKeyVersionAlgorithm {
8402 /// Gets the enum value.
8403 ///
8404 /// Returns `None` if the enum contains an unknown value deserialized from
8405 /// the string representation of enums.
8406 pub fn value(&self) -> std::option::Option<i32> {
8407 match self {
8408 Self::Unspecified => std::option::Option::Some(0),
8409 Self::GoogleSymmetricEncryption => std::option::Option::Some(1),
8410 Self::Aes128Gcm => std::option::Option::Some(41),
8411 Self::Aes256Gcm => std::option::Option::Some(19),
8412 Self::Aes128Cbc => std::option::Option::Some(42),
8413 Self::Aes256Cbc => std::option::Option::Some(43),
8414 Self::Aes128Ctr => std::option::Option::Some(44),
8415 Self::Aes256Ctr => std::option::Option::Some(45),
8416 Self::RsaSignPss2048Sha256 => std::option::Option::Some(2),
8417 Self::RsaSignPss3072Sha256 => std::option::Option::Some(3),
8418 Self::RsaSignPss4096Sha256 => std::option::Option::Some(4),
8419 Self::RsaSignPss4096Sha512 => std::option::Option::Some(15),
8420 Self::RsaSignPkcs12048Sha256 => std::option::Option::Some(5),
8421 Self::RsaSignPkcs13072Sha256 => std::option::Option::Some(6),
8422 Self::RsaSignPkcs14096Sha256 => std::option::Option::Some(7),
8423 Self::RsaSignPkcs14096Sha512 => std::option::Option::Some(16),
8424 Self::RsaSignRawPkcs12048 => std::option::Option::Some(28),
8425 Self::RsaSignRawPkcs13072 => std::option::Option::Some(29),
8426 Self::RsaSignRawPkcs14096 => std::option::Option::Some(30),
8427 Self::RsaDecryptOaep2048Sha256 => std::option::Option::Some(8),
8428 Self::RsaDecryptOaep3072Sha256 => std::option::Option::Some(9),
8429 Self::RsaDecryptOaep4096Sha256 => std::option::Option::Some(10),
8430 Self::RsaDecryptOaep4096Sha512 => std::option::Option::Some(17),
8431 Self::RsaDecryptOaep2048Sha1 => std::option::Option::Some(37),
8432 Self::RsaDecryptOaep3072Sha1 => std::option::Option::Some(38),
8433 Self::RsaDecryptOaep4096Sha1 => std::option::Option::Some(39),
8434 Self::EcSignP256Sha256 => std::option::Option::Some(12),
8435 Self::EcSignP384Sha384 => std::option::Option::Some(13),
8436 Self::EcSignSecp256K1Sha256 => std::option::Option::Some(31),
8437 Self::EcSignEd25519 => std::option::Option::Some(40),
8438 Self::HmacSha256 => std::option::Option::Some(32),
8439 Self::HmacSha1 => std::option::Option::Some(33),
8440 Self::HmacSha384 => std::option::Option::Some(34),
8441 Self::HmacSha512 => std::option::Option::Some(35),
8442 Self::HmacSha224 => std::option::Option::Some(36),
8443 Self::ExternalSymmetricEncryption => std::option::Option::Some(18),
8444 Self::MlKem768 => std::option::Option::Some(47),
8445 Self::MlKem1024 => std::option::Option::Some(48),
8446 Self::KemXwing => std::option::Option::Some(63),
8447 Self::PqSignMlDsa44 => std::option::Option::Some(68),
8448 Self::PqSignMlDsa65 => std::option::Option::Some(56),
8449 Self::PqSignMlDsa87 => std::option::Option::Some(69),
8450 Self::PqSignSlhDsaSha2128S => std::option::Option::Some(57),
8451 Self::PqSignHashSlhDsaSha2128SSha256 => std::option::Option::Some(60),
8452 Self::PqSignMlDsa44ExternalMu => std::option::Option::Some(70),
8453 Self::PqSignMlDsa65ExternalMu => std::option::Option::Some(67),
8454 Self::PqSignMlDsa87ExternalMu => std::option::Option::Some(71),
8455 Self::UnknownValue(u) => u.0.value(),
8456 }
8457 }
8458
8459 /// Gets the enum value as a string.
8460 ///
8461 /// Returns `None` if the enum contains an unknown value deserialized from
8462 /// the integer representation of enums.
8463 pub fn name(&self) -> std::option::Option<&str> {
8464 match self {
8465 Self::Unspecified => {
8466 std::option::Option::Some("CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED")
8467 }
8468 Self::GoogleSymmetricEncryption => {
8469 std::option::Option::Some("GOOGLE_SYMMETRIC_ENCRYPTION")
8470 }
8471 Self::Aes128Gcm => std::option::Option::Some("AES_128_GCM"),
8472 Self::Aes256Gcm => std::option::Option::Some("AES_256_GCM"),
8473 Self::Aes128Cbc => std::option::Option::Some("AES_128_CBC"),
8474 Self::Aes256Cbc => std::option::Option::Some("AES_256_CBC"),
8475 Self::Aes128Ctr => std::option::Option::Some("AES_128_CTR"),
8476 Self::Aes256Ctr => std::option::Option::Some("AES_256_CTR"),
8477 Self::RsaSignPss2048Sha256 => std::option::Option::Some("RSA_SIGN_PSS_2048_SHA256"),
8478 Self::RsaSignPss3072Sha256 => std::option::Option::Some("RSA_SIGN_PSS_3072_SHA256"),
8479 Self::RsaSignPss4096Sha256 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA256"),
8480 Self::RsaSignPss4096Sha512 => std::option::Option::Some("RSA_SIGN_PSS_4096_SHA512"),
8481 Self::RsaSignPkcs12048Sha256 => {
8482 std::option::Option::Some("RSA_SIGN_PKCS1_2048_SHA256")
8483 }
8484 Self::RsaSignPkcs13072Sha256 => {
8485 std::option::Option::Some("RSA_SIGN_PKCS1_3072_SHA256")
8486 }
8487 Self::RsaSignPkcs14096Sha256 => {
8488 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA256")
8489 }
8490 Self::RsaSignPkcs14096Sha512 => {
8491 std::option::Option::Some("RSA_SIGN_PKCS1_4096_SHA512")
8492 }
8493 Self::RsaSignRawPkcs12048 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_2048"),
8494 Self::RsaSignRawPkcs13072 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_3072"),
8495 Self::RsaSignRawPkcs14096 => std::option::Option::Some("RSA_SIGN_RAW_PKCS1_4096"),
8496 Self::RsaDecryptOaep2048Sha256 => {
8497 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA256")
8498 }
8499 Self::RsaDecryptOaep3072Sha256 => {
8500 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA256")
8501 }
8502 Self::RsaDecryptOaep4096Sha256 => {
8503 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA256")
8504 }
8505 Self::RsaDecryptOaep4096Sha512 => {
8506 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA512")
8507 }
8508 Self::RsaDecryptOaep2048Sha1 => {
8509 std::option::Option::Some("RSA_DECRYPT_OAEP_2048_SHA1")
8510 }
8511 Self::RsaDecryptOaep3072Sha1 => {
8512 std::option::Option::Some("RSA_DECRYPT_OAEP_3072_SHA1")
8513 }
8514 Self::RsaDecryptOaep4096Sha1 => {
8515 std::option::Option::Some("RSA_DECRYPT_OAEP_4096_SHA1")
8516 }
8517 Self::EcSignP256Sha256 => std::option::Option::Some("EC_SIGN_P256_SHA256"),
8518 Self::EcSignP384Sha384 => std::option::Option::Some("EC_SIGN_P384_SHA384"),
8519 Self::EcSignSecp256K1Sha256 => {
8520 std::option::Option::Some("EC_SIGN_SECP256K1_SHA256")
8521 }
8522 Self::EcSignEd25519 => std::option::Option::Some("EC_SIGN_ED25519"),
8523 Self::HmacSha256 => std::option::Option::Some("HMAC_SHA256"),
8524 Self::HmacSha1 => std::option::Option::Some("HMAC_SHA1"),
8525 Self::HmacSha384 => std::option::Option::Some("HMAC_SHA384"),
8526 Self::HmacSha512 => std::option::Option::Some("HMAC_SHA512"),
8527 Self::HmacSha224 => std::option::Option::Some("HMAC_SHA224"),
8528 Self::ExternalSymmetricEncryption => {
8529 std::option::Option::Some("EXTERNAL_SYMMETRIC_ENCRYPTION")
8530 }
8531 Self::MlKem768 => std::option::Option::Some("ML_KEM_768"),
8532 Self::MlKem1024 => std::option::Option::Some("ML_KEM_1024"),
8533 Self::KemXwing => std::option::Option::Some("KEM_XWING"),
8534 Self::PqSignMlDsa44 => std::option::Option::Some("PQ_SIGN_ML_DSA_44"),
8535 Self::PqSignMlDsa65 => std::option::Option::Some("PQ_SIGN_ML_DSA_65"),
8536 Self::PqSignMlDsa87 => std::option::Option::Some("PQ_SIGN_ML_DSA_87"),
8537 Self::PqSignSlhDsaSha2128S => {
8538 std::option::Option::Some("PQ_SIGN_SLH_DSA_SHA2_128S")
8539 }
8540 Self::PqSignHashSlhDsaSha2128SSha256 => {
8541 std::option::Option::Some("PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256")
8542 }
8543 Self::PqSignMlDsa44ExternalMu => {
8544 std::option::Option::Some("PQ_SIGN_ML_DSA_44_EXTERNAL_MU")
8545 }
8546 Self::PqSignMlDsa65ExternalMu => {
8547 std::option::Option::Some("PQ_SIGN_ML_DSA_65_EXTERNAL_MU")
8548 }
8549 Self::PqSignMlDsa87ExternalMu => {
8550 std::option::Option::Some("PQ_SIGN_ML_DSA_87_EXTERNAL_MU")
8551 }
8552 Self::UnknownValue(u) => u.0.name(),
8553 }
8554 }
8555 }
8556
8557 impl std::default::Default for CryptoKeyVersionAlgorithm {
8558 fn default() -> Self {
8559 use std::convert::From;
8560 Self::from(0)
8561 }
8562 }
8563
8564 impl std::fmt::Display for CryptoKeyVersionAlgorithm {
8565 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8566 wkt::internal::display_enum(f, self.name(), self.value())
8567 }
8568 }
8569
8570 impl std::convert::From<i32> for CryptoKeyVersionAlgorithm {
8571 fn from(value: i32) -> Self {
8572 match value {
8573 0 => Self::Unspecified,
8574 1 => Self::GoogleSymmetricEncryption,
8575 2 => Self::RsaSignPss2048Sha256,
8576 3 => Self::RsaSignPss3072Sha256,
8577 4 => Self::RsaSignPss4096Sha256,
8578 5 => Self::RsaSignPkcs12048Sha256,
8579 6 => Self::RsaSignPkcs13072Sha256,
8580 7 => Self::RsaSignPkcs14096Sha256,
8581 8 => Self::RsaDecryptOaep2048Sha256,
8582 9 => Self::RsaDecryptOaep3072Sha256,
8583 10 => Self::RsaDecryptOaep4096Sha256,
8584 12 => Self::EcSignP256Sha256,
8585 13 => Self::EcSignP384Sha384,
8586 15 => Self::RsaSignPss4096Sha512,
8587 16 => Self::RsaSignPkcs14096Sha512,
8588 17 => Self::RsaDecryptOaep4096Sha512,
8589 18 => Self::ExternalSymmetricEncryption,
8590 19 => Self::Aes256Gcm,
8591 28 => Self::RsaSignRawPkcs12048,
8592 29 => Self::RsaSignRawPkcs13072,
8593 30 => Self::RsaSignRawPkcs14096,
8594 31 => Self::EcSignSecp256K1Sha256,
8595 32 => Self::HmacSha256,
8596 33 => Self::HmacSha1,
8597 34 => Self::HmacSha384,
8598 35 => Self::HmacSha512,
8599 36 => Self::HmacSha224,
8600 37 => Self::RsaDecryptOaep2048Sha1,
8601 38 => Self::RsaDecryptOaep3072Sha1,
8602 39 => Self::RsaDecryptOaep4096Sha1,
8603 40 => Self::EcSignEd25519,
8604 41 => Self::Aes128Gcm,
8605 42 => Self::Aes128Cbc,
8606 43 => Self::Aes256Cbc,
8607 44 => Self::Aes128Ctr,
8608 45 => Self::Aes256Ctr,
8609 47 => Self::MlKem768,
8610 48 => Self::MlKem1024,
8611 56 => Self::PqSignMlDsa65,
8612 57 => Self::PqSignSlhDsaSha2128S,
8613 60 => Self::PqSignHashSlhDsaSha2128SSha256,
8614 63 => Self::KemXwing,
8615 67 => Self::PqSignMlDsa65ExternalMu,
8616 68 => Self::PqSignMlDsa44,
8617 69 => Self::PqSignMlDsa87,
8618 70 => Self::PqSignMlDsa44ExternalMu,
8619 71 => Self::PqSignMlDsa87ExternalMu,
8620 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8621 wkt::internal::UnknownEnumValue::Integer(value),
8622 )),
8623 }
8624 }
8625 }
8626
8627 impl std::convert::From<&str> for CryptoKeyVersionAlgorithm {
8628 fn from(value: &str) -> Self {
8629 use std::string::ToString;
8630 match value {
8631 "CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED" => Self::Unspecified,
8632 "GOOGLE_SYMMETRIC_ENCRYPTION" => Self::GoogleSymmetricEncryption,
8633 "AES_128_GCM" => Self::Aes128Gcm,
8634 "AES_256_GCM" => Self::Aes256Gcm,
8635 "AES_128_CBC" => Self::Aes128Cbc,
8636 "AES_256_CBC" => Self::Aes256Cbc,
8637 "AES_128_CTR" => Self::Aes128Ctr,
8638 "AES_256_CTR" => Self::Aes256Ctr,
8639 "RSA_SIGN_PSS_2048_SHA256" => Self::RsaSignPss2048Sha256,
8640 "RSA_SIGN_PSS_3072_SHA256" => Self::RsaSignPss3072Sha256,
8641 "RSA_SIGN_PSS_4096_SHA256" => Self::RsaSignPss4096Sha256,
8642 "RSA_SIGN_PSS_4096_SHA512" => Self::RsaSignPss4096Sha512,
8643 "RSA_SIGN_PKCS1_2048_SHA256" => Self::RsaSignPkcs12048Sha256,
8644 "RSA_SIGN_PKCS1_3072_SHA256" => Self::RsaSignPkcs13072Sha256,
8645 "RSA_SIGN_PKCS1_4096_SHA256" => Self::RsaSignPkcs14096Sha256,
8646 "RSA_SIGN_PKCS1_4096_SHA512" => Self::RsaSignPkcs14096Sha512,
8647 "RSA_SIGN_RAW_PKCS1_2048" => Self::RsaSignRawPkcs12048,
8648 "RSA_SIGN_RAW_PKCS1_3072" => Self::RsaSignRawPkcs13072,
8649 "RSA_SIGN_RAW_PKCS1_4096" => Self::RsaSignRawPkcs14096,
8650 "RSA_DECRYPT_OAEP_2048_SHA256" => Self::RsaDecryptOaep2048Sha256,
8651 "RSA_DECRYPT_OAEP_3072_SHA256" => Self::RsaDecryptOaep3072Sha256,
8652 "RSA_DECRYPT_OAEP_4096_SHA256" => Self::RsaDecryptOaep4096Sha256,
8653 "RSA_DECRYPT_OAEP_4096_SHA512" => Self::RsaDecryptOaep4096Sha512,
8654 "RSA_DECRYPT_OAEP_2048_SHA1" => Self::RsaDecryptOaep2048Sha1,
8655 "RSA_DECRYPT_OAEP_3072_SHA1" => Self::RsaDecryptOaep3072Sha1,
8656 "RSA_DECRYPT_OAEP_4096_SHA1" => Self::RsaDecryptOaep4096Sha1,
8657 "EC_SIGN_P256_SHA256" => Self::EcSignP256Sha256,
8658 "EC_SIGN_P384_SHA384" => Self::EcSignP384Sha384,
8659 "EC_SIGN_SECP256K1_SHA256" => Self::EcSignSecp256K1Sha256,
8660 "EC_SIGN_ED25519" => Self::EcSignEd25519,
8661 "HMAC_SHA256" => Self::HmacSha256,
8662 "HMAC_SHA1" => Self::HmacSha1,
8663 "HMAC_SHA384" => Self::HmacSha384,
8664 "HMAC_SHA512" => Self::HmacSha512,
8665 "HMAC_SHA224" => Self::HmacSha224,
8666 "EXTERNAL_SYMMETRIC_ENCRYPTION" => Self::ExternalSymmetricEncryption,
8667 "ML_KEM_768" => Self::MlKem768,
8668 "ML_KEM_1024" => Self::MlKem1024,
8669 "KEM_XWING" => Self::KemXwing,
8670 "PQ_SIGN_ML_DSA_44" => Self::PqSignMlDsa44,
8671 "PQ_SIGN_ML_DSA_65" => Self::PqSignMlDsa65,
8672 "PQ_SIGN_ML_DSA_87" => Self::PqSignMlDsa87,
8673 "PQ_SIGN_SLH_DSA_SHA2_128S" => Self::PqSignSlhDsaSha2128S,
8674 "PQ_SIGN_HASH_SLH_DSA_SHA2_128S_SHA256" => Self::PqSignHashSlhDsaSha2128SSha256,
8675 "PQ_SIGN_ML_DSA_44_EXTERNAL_MU" => Self::PqSignMlDsa44ExternalMu,
8676 "PQ_SIGN_ML_DSA_65_EXTERNAL_MU" => Self::PqSignMlDsa65ExternalMu,
8677 "PQ_SIGN_ML_DSA_87_EXTERNAL_MU" => Self::PqSignMlDsa87ExternalMu,
8678 _ => Self::UnknownValue(crypto_key_version_algorithm::UnknownValue(
8679 wkt::internal::UnknownEnumValue::String(value.to_string()),
8680 )),
8681 }
8682 }
8683 }
8684
8685 impl serde::ser::Serialize for CryptoKeyVersionAlgorithm {
8686 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8687 where
8688 S: serde::Serializer,
8689 {
8690 match self {
8691 Self::Unspecified => serializer.serialize_i32(0),
8692 Self::GoogleSymmetricEncryption => serializer.serialize_i32(1),
8693 Self::Aes128Gcm => serializer.serialize_i32(41),
8694 Self::Aes256Gcm => serializer.serialize_i32(19),
8695 Self::Aes128Cbc => serializer.serialize_i32(42),
8696 Self::Aes256Cbc => serializer.serialize_i32(43),
8697 Self::Aes128Ctr => serializer.serialize_i32(44),
8698 Self::Aes256Ctr => serializer.serialize_i32(45),
8699 Self::RsaSignPss2048Sha256 => serializer.serialize_i32(2),
8700 Self::RsaSignPss3072Sha256 => serializer.serialize_i32(3),
8701 Self::RsaSignPss4096Sha256 => serializer.serialize_i32(4),
8702 Self::RsaSignPss4096Sha512 => serializer.serialize_i32(15),
8703 Self::RsaSignPkcs12048Sha256 => serializer.serialize_i32(5),
8704 Self::RsaSignPkcs13072Sha256 => serializer.serialize_i32(6),
8705 Self::RsaSignPkcs14096Sha256 => serializer.serialize_i32(7),
8706 Self::RsaSignPkcs14096Sha512 => serializer.serialize_i32(16),
8707 Self::RsaSignRawPkcs12048 => serializer.serialize_i32(28),
8708 Self::RsaSignRawPkcs13072 => serializer.serialize_i32(29),
8709 Self::RsaSignRawPkcs14096 => serializer.serialize_i32(30),
8710 Self::RsaDecryptOaep2048Sha256 => serializer.serialize_i32(8),
8711 Self::RsaDecryptOaep3072Sha256 => serializer.serialize_i32(9),
8712 Self::RsaDecryptOaep4096Sha256 => serializer.serialize_i32(10),
8713 Self::RsaDecryptOaep4096Sha512 => serializer.serialize_i32(17),
8714 Self::RsaDecryptOaep2048Sha1 => serializer.serialize_i32(37),
8715 Self::RsaDecryptOaep3072Sha1 => serializer.serialize_i32(38),
8716 Self::RsaDecryptOaep4096Sha1 => serializer.serialize_i32(39),
8717 Self::EcSignP256Sha256 => serializer.serialize_i32(12),
8718 Self::EcSignP384Sha384 => serializer.serialize_i32(13),
8719 Self::EcSignSecp256K1Sha256 => serializer.serialize_i32(31),
8720 Self::EcSignEd25519 => serializer.serialize_i32(40),
8721 Self::HmacSha256 => serializer.serialize_i32(32),
8722 Self::HmacSha1 => serializer.serialize_i32(33),
8723 Self::HmacSha384 => serializer.serialize_i32(34),
8724 Self::HmacSha512 => serializer.serialize_i32(35),
8725 Self::HmacSha224 => serializer.serialize_i32(36),
8726 Self::ExternalSymmetricEncryption => serializer.serialize_i32(18),
8727 Self::MlKem768 => serializer.serialize_i32(47),
8728 Self::MlKem1024 => serializer.serialize_i32(48),
8729 Self::KemXwing => serializer.serialize_i32(63),
8730 Self::PqSignMlDsa44 => serializer.serialize_i32(68),
8731 Self::PqSignMlDsa65 => serializer.serialize_i32(56),
8732 Self::PqSignMlDsa87 => serializer.serialize_i32(69),
8733 Self::PqSignSlhDsaSha2128S => serializer.serialize_i32(57),
8734 Self::PqSignHashSlhDsaSha2128SSha256 => serializer.serialize_i32(60),
8735 Self::PqSignMlDsa44ExternalMu => serializer.serialize_i32(70),
8736 Self::PqSignMlDsa65ExternalMu => serializer.serialize_i32(67),
8737 Self::PqSignMlDsa87ExternalMu => serializer.serialize_i32(71),
8738 Self::UnknownValue(u) => u.0.serialize(serializer),
8739 }
8740 }
8741 }
8742
8743 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionAlgorithm {
8744 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8745 where
8746 D: serde::Deserializer<'de>,
8747 {
8748 deserializer.deserialize_any(
8749 wkt::internal::EnumVisitor::<CryptoKeyVersionAlgorithm>::new(
8750 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm",
8751 ),
8752 )
8753 }
8754 }
8755
8756 /// The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion],
8757 /// indicating if it can be used.
8758 ///
8759 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
8760 ///
8761 /// # Working with unknown values
8762 ///
8763 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8764 /// additional enum variants at any time. Adding new variants is not considered
8765 /// a breaking change. Applications should write their code in anticipation of:
8766 ///
8767 /// - New values appearing in future releases of the client library, **and**
8768 /// - New values received dynamically, without application changes.
8769 ///
8770 /// Please consult the [Working with enums] section in the user guide for some
8771 /// guidelines.
8772 ///
8773 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8774 #[derive(Clone, Debug, PartialEq)]
8775 #[non_exhaustive]
8776 pub enum CryptoKeyVersionState {
8777 /// Not specified.
8778 Unspecified,
8779 /// This version is still being generated. It may not be used, enabled,
8780 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8781 /// version
8782 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8783 /// as soon as the version is ready.
8784 ///
8785 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8786 PendingGeneration,
8787 /// This version may be used for cryptographic operations.
8788 Enabled,
8789 /// This version may not be used, but the key material is still available,
8790 /// and the version can be placed back into the
8791 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8792 /// state.
8793 ///
8794 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8795 Disabled,
8796 /// The key material of this version is destroyed and no longer stored.
8797 /// This version may only become
8798 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8799 /// again if this version is
8800 /// [reimport_eligible][google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]
8801 /// and the original key material is reimported with a call to
8802 /// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
8803 ///
8804 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8805 /// [google.cloud.kms.v1.CryptoKeyVersion.reimport_eligible]: crate::model::CryptoKeyVersion::reimport_eligible
8806 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
8807 Destroyed,
8808 /// This version is scheduled for destruction, and will be destroyed soon.
8809 /// Call
8810 /// [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]
8811 /// to put it back into the
8812 /// [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]
8813 /// state.
8814 ///
8815 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Disabled
8816 /// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
8817 DestroyScheduled,
8818 /// This version is still being imported. It may not be used, enabled,
8819 /// disabled, or destroyed yet. Cloud KMS will automatically mark this
8820 /// version
8821 /// [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]
8822 /// as soon as the version is ready.
8823 ///
8824 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]: crate::model::crypto_key_version::CryptoKeyVersionState::Enabled
8825 PendingImport,
8826 /// This version was not imported successfully. It may not be used, enabled,
8827 /// disabled, or destroyed. The submitted key material has been discarded.
8828 /// Additional details can be found in
8829 /// [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason].
8830 ///
8831 /// [google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]: crate::model::CryptoKeyVersion::import_failure_reason
8832 ImportFailed,
8833 /// This version was not generated successfully. It may not be used, enabled,
8834 /// disabled, or destroyed. Additional details can be found in
8835 /// [CryptoKeyVersion.generation_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason].
8836 ///
8837 /// [google.cloud.kms.v1.CryptoKeyVersion.generation_failure_reason]: crate::model::CryptoKeyVersion::generation_failure_reason
8838 GenerationFailed,
8839 /// This version was destroyed, and it may not be used or enabled again.
8840 /// Cloud KMS is waiting for the corresponding key material residing in an
8841 /// external key manager to be destroyed.
8842 PendingExternalDestruction,
8843 /// This version was destroyed, and it may not be used or enabled again.
8844 /// However, Cloud KMS could not confirm that the corresponding key material
8845 /// residing in an external key manager was destroyed. Additional details can
8846 /// be found in
8847 /// [CryptoKeyVersion.external_destruction_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason].
8848 ///
8849 /// [google.cloud.kms.v1.CryptoKeyVersion.external_destruction_failure_reason]: crate::model::CryptoKeyVersion::external_destruction_failure_reason
8850 ExternalDestructionFailed,
8851 /// If set, the enum was initialized with an unknown value.
8852 ///
8853 /// Applications can examine the value using [CryptoKeyVersionState::value] or
8854 /// [CryptoKeyVersionState::name].
8855 UnknownValue(crypto_key_version_state::UnknownValue),
8856 }
8857
8858 #[doc(hidden)]
8859 pub mod crypto_key_version_state {
8860 #[allow(unused_imports)]
8861 use super::*;
8862 #[derive(Clone, Debug, PartialEq)]
8863 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8864 }
8865
8866 impl CryptoKeyVersionState {
8867 /// Gets the enum value.
8868 ///
8869 /// Returns `None` if the enum contains an unknown value deserialized from
8870 /// the string representation of enums.
8871 pub fn value(&self) -> std::option::Option<i32> {
8872 match self {
8873 Self::Unspecified => std::option::Option::Some(0),
8874 Self::PendingGeneration => std::option::Option::Some(5),
8875 Self::Enabled => std::option::Option::Some(1),
8876 Self::Disabled => std::option::Option::Some(2),
8877 Self::Destroyed => std::option::Option::Some(3),
8878 Self::DestroyScheduled => std::option::Option::Some(4),
8879 Self::PendingImport => std::option::Option::Some(6),
8880 Self::ImportFailed => std::option::Option::Some(7),
8881 Self::GenerationFailed => std::option::Option::Some(8),
8882 Self::PendingExternalDestruction => std::option::Option::Some(9),
8883 Self::ExternalDestructionFailed => std::option::Option::Some(10),
8884 Self::UnknownValue(u) => u.0.value(),
8885 }
8886 }
8887
8888 /// Gets the enum value as a string.
8889 ///
8890 /// Returns `None` if the enum contains an unknown value deserialized from
8891 /// the integer representation of enums.
8892 pub fn name(&self) -> std::option::Option<&str> {
8893 match self {
8894 Self::Unspecified => {
8895 std::option::Option::Some("CRYPTO_KEY_VERSION_STATE_UNSPECIFIED")
8896 }
8897 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
8898 Self::Enabled => std::option::Option::Some("ENABLED"),
8899 Self::Disabled => std::option::Option::Some("DISABLED"),
8900 Self::Destroyed => std::option::Option::Some("DESTROYED"),
8901 Self::DestroyScheduled => std::option::Option::Some("DESTROY_SCHEDULED"),
8902 Self::PendingImport => std::option::Option::Some("PENDING_IMPORT"),
8903 Self::ImportFailed => std::option::Option::Some("IMPORT_FAILED"),
8904 Self::GenerationFailed => std::option::Option::Some("GENERATION_FAILED"),
8905 Self::PendingExternalDestruction => {
8906 std::option::Option::Some("PENDING_EXTERNAL_DESTRUCTION")
8907 }
8908 Self::ExternalDestructionFailed => {
8909 std::option::Option::Some("EXTERNAL_DESTRUCTION_FAILED")
8910 }
8911 Self::UnknownValue(u) => u.0.name(),
8912 }
8913 }
8914 }
8915
8916 impl std::default::Default for CryptoKeyVersionState {
8917 fn default() -> Self {
8918 use std::convert::From;
8919 Self::from(0)
8920 }
8921 }
8922
8923 impl std::fmt::Display for CryptoKeyVersionState {
8924 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
8925 wkt::internal::display_enum(f, self.name(), self.value())
8926 }
8927 }
8928
8929 impl std::convert::From<i32> for CryptoKeyVersionState {
8930 fn from(value: i32) -> Self {
8931 match value {
8932 0 => Self::Unspecified,
8933 1 => Self::Enabled,
8934 2 => Self::Disabled,
8935 3 => Self::Destroyed,
8936 4 => Self::DestroyScheduled,
8937 5 => Self::PendingGeneration,
8938 6 => Self::PendingImport,
8939 7 => Self::ImportFailed,
8940 8 => Self::GenerationFailed,
8941 9 => Self::PendingExternalDestruction,
8942 10 => Self::ExternalDestructionFailed,
8943 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8944 wkt::internal::UnknownEnumValue::Integer(value),
8945 )),
8946 }
8947 }
8948 }
8949
8950 impl std::convert::From<&str> for CryptoKeyVersionState {
8951 fn from(value: &str) -> Self {
8952 use std::string::ToString;
8953 match value {
8954 "CRYPTO_KEY_VERSION_STATE_UNSPECIFIED" => Self::Unspecified,
8955 "PENDING_GENERATION" => Self::PendingGeneration,
8956 "ENABLED" => Self::Enabled,
8957 "DISABLED" => Self::Disabled,
8958 "DESTROYED" => Self::Destroyed,
8959 "DESTROY_SCHEDULED" => Self::DestroyScheduled,
8960 "PENDING_IMPORT" => Self::PendingImport,
8961 "IMPORT_FAILED" => Self::ImportFailed,
8962 "GENERATION_FAILED" => Self::GenerationFailed,
8963 "PENDING_EXTERNAL_DESTRUCTION" => Self::PendingExternalDestruction,
8964 "EXTERNAL_DESTRUCTION_FAILED" => Self::ExternalDestructionFailed,
8965 _ => Self::UnknownValue(crypto_key_version_state::UnknownValue(
8966 wkt::internal::UnknownEnumValue::String(value.to_string()),
8967 )),
8968 }
8969 }
8970 }
8971
8972 impl serde::ser::Serialize for CryptoKeyVersionState {
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::PendingGeneration => serializer.serialize_i32(5),
8980 Self::Enabled => serializer.serialize_i32(1),
8981 Self::Disabled => serializer.serialize_i32(2),
8982 Self::Destroyed => serializer.serialize_i32(3),
8983 Self::DestroyScheduled => serializer.serialize_i32(4),
8984 Self::PendingImport => serializer.serialize_i32(6),
8985 Self::ImportFailed => serializer.serialize_i32(7),
8986 Self::GenerationFailed => serializer.serialize_i32(8),
8987 Self::PendingExternalDestruction => serializer.serialize_i32(9),
8988 Self::ExternalDestructionFailed => serializer.serialize_i32(10),
8989 Self::UnknownValue(u) => u.0.serialize(serializer),
8990 }
8991 }
8992 }
8993
8994 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionState {
8995 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8996 where
8997 D: serde::Deserializer<'de>,
8998 {
8999 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionState>::new(
9000 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState",
9001 ))
9002 }
9003 }
9004
9005 /// A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s.
9006 /// Controls the level of detail returned for
9007 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in
9008 /// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]
9009 /// and
9010 /// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
9011 ///
9012 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9013 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
9014 /// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
9015 ///
9016 /// # Working with unknown values
9017 ///
9018 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9019 /// additional enum variants at any time. Adding new variants is not considered
9020 /// a breaking change. Applications should write their code in anticipation of:
9021 ///
9022 /// - New values appearing in future releases of the client library, **and**
9023 /// - New values received dynamically, without application changes.
9024 ///
9025 /// Please consult the [Working with enums] section in the user guide for some
9026 /// guidelines.
9027 ///
9028 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9029 #[derive(Clone, Debug, PartialEq)]
9030 #[non_exhaustive]
9031 pub enum CryptoKeyVersionView {
9032 /// Default view for each
9033 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not
9034 /// include the
9035 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field.
9036 ///
9037 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9038 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
9039 Unspecified,
9040 /// Provides all fields in each
9041 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the
9042 /// [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation].
9043 ///
9044 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9045 /// [google.cloud.kms.v1.CryptoKeyVersion.attestation]: crate::model::CryptoKeyVersion::attestation
9046 Full,
9047 /// If set, the enum was initialized with an unknown value.
9048 ///
9049 /// Applications can examine the value using [CryptoKeyVersionView::value] or
9050 /// [CryptoKeyVersionView::name].
9051 UnknownValue(crypto_key_version_view::UnknownValue),
9052 }
9053
9054 #[doc(hidden)]
9055 pub mod crypto_key_version_view {
9056 #[allow(unused_imports)]
9057 use super::*;
9058 #[derive(Clone, Debug, PartialEq)]
9059 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9060 }
9061
9062 impl CryptoKeyVersionView {
9063 /// Gets the enum value.
9064 ///
9065 /// Returns `None` if the enum contains an unknown value deserialized from
9066 /// the string representation of enums.
9067 pub fn value(&self) -> std::option::Option<i32> {
9068 match self {
9069 Self::Unspecified => std::option::Option::Some(0),
9070 Self::Full => std::option::Option::Some(1),
9071 Self::UnknownValue(u) => u.0.value(),
9072 }
9073 }
9074
9075 /// Gets the enum value as a string.
9076 ///
9077 /// Returns `None` if the enum contains an unknown value deserialized from
9078 /// the integer representation of enums.
9079 pub fn name(&self) -> std::option::Option<&str> {
9080 match self {
9081 Self::Unspecified => {
9082 std::option::Option::Some("CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED")
9083 }
9084 Self::Full => std::option::Option::Some("FULL"),
9085 Self::UnknownValue(u) => u.0.name(),
9086 }
9087 }
9088 }
9089
9090 impl std::default::Default for CryptoKeyVersionView {
9091 fn default() -> Self {
9092 use std::convert::From;
9093 Self::from(0)
9094 }
9095 }
9096
9097 impl std::fmt::Display for CryptoKeyVersionView {
9098 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9099 wkt::internal::display_enum(f, self.name(), self.value())
9100 }
9101 }
9102
9103 impl std::convert::From<i32> for CryptoKeyVersionView {
9104 fn from(value: i32) -> Self {
9105 match value {
9106 0 => Self::Unspecified,
9107 1 => Self::Full,
9108 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9109 wkt::internal::UnknownEnumValue::Integer(value),
9110 )),
9111 }
9112 }
9113 }
9114
9115 impl std::convert::From<&str> for CryptoKeyVersionView {
9116 fn from(value: &str) -> Self {
9117 use std::string::ToString;
9118 match value {
9119 "CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED" => Self::Unspecified,
9120 "FULL" => Self::Full,
9121 _ => Self::UnknownValue(crypto_key_version_view::UnknownValue(
9122 wkt::internal::UnknownEnumValue::String(value.to_string()),
9123 )),
9124 }
9125 }
9126 }
9127
9128 impl serde::ser::Serialize for CryptoKeyVersionView {
9129 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9130 where
9131 S: serde::Serializer,
9132 {
9133 match self {
9134 Self::Unspecified => serializer.serialize_i32(0),
9135 Self::Full => serializer.serialize_i32(1),
9136 Self::UnknownValue(u) => u.0.serialize(serializer),
9137 }
9138 }
9139 }
9140
9141 impl<'de> serde::de::Deserialize<'de> for CryptoKeyVersionView {
9142 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9143 where
9144 D: serde::Deserializer<'de>,
9145 {
9146 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CryptoKeyVersionView>::new(
9147 ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView",
9148 ))
9149 }
9150 }
9151}
9152
9153/// Data with integrity verification field.
9154#[derive(Clone, Default, PartialEq)]
9155#[non_exhaustive]
9156pub struct ChecksummedData {
9157 /// Raw Data.
9158 pub data: ::bytes::Bytes,
9159
9160 /// Integrity verification field. A CRC32C
9161 /// checksum of the returned
9162 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data]. An
9163 /// integrity check of
9164 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] can be
9165 /// performed by computing the CRC32C checksum of
9166 /// [ChecksummedData.data][google.cloud.kms.v1.ChecksummedData.data] and
9167 /// comparing your results to this field. Discard the response in case of
9168 /// non-matching checksum values, and perform a limited number of retries. A
9169 /// persistent mismatch may indicate an issue in your computation of the CRC32C
9170 /// checksum. Note: This field is defined as int64 for reasons of compatibility
9171 /// across different languages. However, it is a non-negative integer, which
9172 /// will never exceed `2^32-1`, and can be safely downconverted to uint32 in
9173 /// languages that support this type.
9174 ///
9175 /// [google.cloud.kms.v1.ChecksummedData.data]: crate::model::ChecksummedData::data
9176 pub crc32c_checksum: std::option::Option<wkt::Int64Value>,
9177
9178 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9179}
9180
9181impl ChecksummedData {
9182 /// Creates a new default instance.
9183 pub fn new() -> Self {
9184 std::default::Default::default()
9185 }
9186
9187 /// Sets the value of [data][crate::model::ChecksummedData::data].
9188 ///
9189 /// # Example
9190 /// ```ignore,no_run
9191 /// # use google_cloud_kms_v1::model::ChecksummedData;
9192 /// let x = ChecksummedData::new().set_data(bytes::Bytes::from_static(b"example"));
9193 /// ```
9194 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9195 self.data = v.into();
9196 self
9197 }
9198
9199 /// Sets the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9200 ///
9201 /// # Example
9202 /// ```ignore,no_run
9203 /// # use google_cloud_kms_v1::model::ChecksummedData;
9204 /// use wkt::Int64Value;
9205 /// let x = ChecksummedData::new().set_crc32c_checksum(Int64Value::default()/* use setters */);
9206 /// ```
9207 pub fn set_crc32c_checksum<T>(mut self, v: T) -> Self
9208 where
9209 T: std::convert::Into<wkt::Int64Value>,
9210 {
9211 self.crc32c_checksum = std::option::Option::Some(v.into());
9212 self
9213 }
9214
9215 /// Sets or clears the value of [crc32c_checksum][crate::model::ChecksummedData::crc32c_checksum].
9216 ///
9217 /// # Example
9218 /// ```ignore,no_run
9219 /// # use google_cloud_kms_v1::model::ChecksummedData;
9220 /// use wkt::Int64Value;
9221 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(Some(Int64Value::default()/* use setters */));
9222 /// let x = ChecksummedData::new().set_or_clear_crc32c_checksum(None::<Int64Value>);
9223 /// ```
9224 pub fn set_or_clear_crc32c_checksum<T>(mut self, v: std::option::Option<T>) -> Self
9225 where
9226 T: std::convert::Into<wkt::Int64Value>,
9227 {
9228 self.crc32c_checksum = v.map(|x| x.into());
9229 self
9230 }
9231}
9232
9233impl wkt::message::Message for ChecksummedData {
9234 fn typename() -> &'static str {
9235 "type.googleapis.com/google.cloud.kms.v1.ChecksummedData"
9236 }
9237}
9238
9239/// The public keys for a given
9240/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via
9241/// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
9242///
9243/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9244/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
9245#[derive(Clone, Default, PartialEq)]
9246#[non_exhaustive]
9247pub struct PublicKey {
9248 /// The public key, encoded in PEM format. For more information, see the
9249 /// [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for
9250 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
9251 /// [Textual Encoding of Subject Public Key Info]
9252 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
9253 pub pem: std::string::String,
9254
9255 /// The
9256 /// [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
9257 /// associated with this key.
9258 ///
9259 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
9260 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
9261
9262 /// Integrity verification field. A CRC32C checksum of the returned
9263 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem]. An integrity check of
9264 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] can be performed by
9265 /// computing the CRC32C checksum of
9266 /// [PublicKey.pem][google.cloud.kms.v1.PublicKey.pem] and comparing your
9267 /// results to this field. Discard the response in case of non-matching
9268 /// checksum values, and perform a limited number of retries. A persistent
9269 /// mismatch may indicate an issue in your computation of the CRC32C checksum.
9270 /// Note: This field is defined as int64 for reasons of compatibility across
9271 /// different languages. However, it is a non-negative integer, which will
9272 /// never exceed `2^32-1`, and can be safely downconverted to uint32 in
9273 /// languages that support this type.
9274 ///
9275 /// NOTE: This field is in Beta.
9276 ///
9277 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9278 pub pem_crc32c: std::option::Option<wkt::Int64Value>,
9279
9280 /// The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
9281 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9282 /// Provided here for verification.
9283 ///
9284 /// NOTE: This field is in Beta.
9285 ///
9286 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9287 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
9288 pub name: std::string::String,
9289
9290 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
9291 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key.
9292 ///
9293 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9294 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9295 pub protection_level: crate::model::ProtectionLevel,
9296
9297 /// The [PublicKey][google.cloud.kms.v1.PublicKey] format specified by the
9298 /// customer through the
9299 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9300 /// field.
9301 ///
9302 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9303 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9304 pub public_key_format: crate::model::public_key::PublicKeyFormat,
9305
9306 /// This field contains the public key (with integrity verification), formatted
9307 /// according to the
9308 /// [public_key_format][google.cloud.kms.v1.PublicKey.public_key_format] field.
9309 ///
9310 /// [google.cloud.kms.v1.PublicKey.public_key_format]: crate::model::PublicKey::public_key_format
9311 pub public_key: std::option::Option<crate::model::ChecksummedData>,
9312
9313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9314}
9315
9316impl PublicKey {
9317 /// Creates a new default instance.
9318 pub fn new() -> Self {
9319 std::default::Default::default()
9320 }
9321
9322 /// Sets the value of [pem][crate::model::PublicKey::pem].
9323 ///
9324 /// # Example
9325 /// ```ignore,no_run
9326 /// # use google_cloud_kms_v1::model::PublicKey;
9327 /// let x = PublicKey::new().set_pem("example");
9328 /// ```
9329 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9330 self.pem = v.into();
9331 self
9332 }
9333
9334 /// Sets the value of [algorithm][crate::model::PublicKey::algorithm].
9335 ///
9336 /// # Example
9337 /// ```ignore,no_run
9338 /// # use google_cloud_kms_v1::model::PublicKey;
9339 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
9340 /// let x0 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
9341 /// let x1 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
9342 /// let x2 = PublicKey::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
9343 /// ```
9344 pub fn set_algorithm<
9345 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
9346 >(
9347 mut self,
9348 v: T,
9349 ) -> Self {
9350 self.algorithm = v.into();
9351 self
9352 }
9353
9354 /// Sets the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9355 ///
9356 /// # Example
9357 /// ```ignore,no_run
9358 /// # use google_cloud_kms_v1::model::PublicKey;
9359 /// use wkt::Int64Value;
9360 /// let x = PublicKey::new().set_pem_crc32c(Int64Value::default()/* use setters */);
9361 /// ```
9362 pub fn set_pem_crc32c<T>(mut self, v: T) -> Self
9363 where
9364 T: std::convert::Into<wkt::Int64Value>,
9365 {
9366 self.pem_crc32c = std::option::Option::Some(v.into());
9367 self
9368 }
9369
9370 /// Sets or clears the value of [pem_crc32c][crate::model::PublicKey::pem_crc32c].
9371 ///
9372 /// # Example
9373 /// ```ignore,no_run
9374 /// # use google_cloud_kms_v1::model::PublicKey;
9375 /// use wkt::Int64Value;
9376 /// let x = PublicKey::new().set_or_clear_pem_crc32c(Some(Int64Value::default()/* use setters */));
9377 /// let x = PublicKey::new().set_or_clear_pem_crc32c(None::<Int64Value>);
9378 /// ```
9379 pub fn set_or_clear_pem_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
9380 where
9381 T: std::convert::Into<wkt::Int64Value>,
9382 {
9383 self.pem_crc32c = v.map(|x| x.into());
9384 self
9385 }
9386
9387 /// Sets the value of [name][crate::model::PublicKey::name].
9388 ///
9389 /// # Example
9390 /// ```ignore,no_run
9391 /// # use google_cloud_kms_v1::model::PublicKey;
9392 /// # let project_id = "project_id";
9393 /// # let location_id = "location_id";
9394 /// # let key_ring_id = "key_ring_id";
9395 /// # let crypto_key_id = "crypto_key_id";
9396 /// # let crypto_key_version_id = "crypto_key_version_id";
9397 /// let x = PublicKey::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}/publicKey"));
9398 /// ```
9399 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9400 self.name = v.into();
9401 self
9402 }
9403
9404 /// Sets the value of [protection_level][crate::model::PublicKey::protection_level].
9405 ///
9406 /// # Example
9407 /// ```ignore,no_run
9408 /// # use google_cloud_kms_v1::model::PublicKey;
9409 /// use google_cloud_kms_v1::model::ProtectionLevel;
9410 /// let x0 = PublicKey::new().set_protection_level(ProtectionLevel::Software);
9411 /// let x1 = PublicKey::new().set_protection_level(ProtectionLevel::Hsm);
9412 /// let x2 = PublicKey::new().set_protection_level(ProtectionLevel::External);
9413 /// ```
9414 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9415 mut self,
9416 v: T,
9417 ) -> Self {
9418 self.protection_level = v.into();
9419 self
9420 }
9421
9422 /// Sets the value of [public_key_format][crate::model::PublicKey::public_key_format].
9423 ///
9424 /// # Example
9425 /// ```ignore,no_run
9426 /// # use google_cloud_kms_v1::model::PublicKey;
9427 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
9428 /// let x0 = PublicKey::new().set_public_key_format(PublicKeyFormat::Pem);
9429 /// let x1 = PublicKey::new().set_public_key_format(PublicKeyFormat::Der);
9430 /// let x2 = PublicKey::new().set_public_key_format(PublicKeyFormat::NistPqc);
9431 /// ```
9432 pub fn set_public_key_format<
9433 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
9434 >(
9435 mut self,
9436 v: T,
9437 ) -> Self {
9438 self.public_key_format = v.into();
9439 self
9440 }
9441
9442 /// Sets the value of [public_key][crate::model::PublicKey::public_key].
9443 ///
9444 /// # Example
9445 /// ```ignore,no_run
9446 /// # use google_cloud_kms_v1::model::PublicKey;
9447 /// use google_cloud_kms_v1::model::ChecksummedData;
9448 /// let x = PublicKey::new().set_public_key(ChecksummedData::default()/* use setters */);
9449 /// ```
9450 pub fn set_public_key<T>(mut self, v: T) -> Self
9451 where
9452 T: std::convert::Into<crate::model::ChecksummedData>,
9453 {
9454 self.public_key = std::option::Option::Some(v.into());
9455 self
9456 }
9457
9458 /// Sets or clears the value of [public_key][crate::model::PublicKey::public_key].
9459 ///
9460 /// # Example
9461 /// ```ignore,no_run
9462 /// # use google_cloud_kms_v1::model::PublicKey;
9463 /// use google_cloud_kms_v1::model::ChecksummedData;
9464 /// let x = PublicKey::new().set_or_clear_public_key(Some(ChecksummedData::default()/* use setters */));
9465 /// let x = PublicKey::new().set_or_clear_public_key(None::<ChecksummedData>);
9466 /// ```
9467 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
9468 where
9469 T: std::convert::Into<crate::model::ChecksummedData>,
9470 {
9471 self.public_key = v.map(|x| x.into());
9472 self
9473 }
9474}
9475
9476impl wkt::message::Message for PublicKey {
9477 fn typename() -> &'static str {
9478 "type.googleapis.com/google.cloud.kms.v1.PublicKey"
9479 }
9480}
9481
9482/// Defines additional types related to [PublicKey].
9483pub mod public_key {
9484 #[allow(unused_imports)]
9485 use super::*;
9486
9487 /// The supported [PublicKey][google.cloud.kms.v1.PublicKey] formats.
9488 ///
9489 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
9490 ///
9491 /// # Working with unknown values
9492 ///
9493 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9494 /// additional enum variants at any time. Adding new variants is not considered
9495 /// a breaking change. Applications should write their code in anticipation of:
9496 ///
9497 /// - New values appearing in future releases of the client library, **and**
9498 /// - New values received dynamically, without application changes.
9499 ///
9500 /// Please consult the [Working with enums] section in the user guide for some
9501 /// guidelines.
9502 ///
9503 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9504 #[derive(Clone, Debug, PartialEq)]
9505 #[non_exhaustive]
9506 pub enum PublicKeyFormat {
9507 /// If the
9508 /// [public_key_format][google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]
9509 /// field is not specified:
9510 ///
9511 /// - For PQC algorithms, an error will be returned.
9512 /// - For non-PQC algorithms, the default format is PEM, and the field
9513 /// [pem][google.cloud.kms.v1.PublicKey.pem] will be populated.
9514 ///
9515 /// Otherwise, the public key will be exported through the
9516 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
9517 /// requested format.
9518 ///
9519 /// [google.cloud.kms.v1.GetPublicKeyRequest.public_key_format]: crate::model::GetPublicKeyRequest::public_key_format
9520 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
9521 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
9522 Unspecified,
9523 /// The returned public key will be encoded in PEM format.
9524 /// See the [RFC7468](https://tools.ietf.org/html/rfc7468) sections for
9525 /// [General Considerations](https://tools.ietf.org/html/rfc7468#section-2)
9526 /// and [Textual Encoding of Subject Public Key Info]
9527 /// (<https://tools.ietf.org/html/rfc7468#section-13>) for more information.
9528 Pem,
9529 /// The returned public key will be encoded in DER format (the
9530 /// PrivateKeyInfo structure from RFC 5208).
9531 Der,
9532 /// This is supported only for PQC algorithms.
9533 /// The key material is returned in the format defined by NIST PQC
9534 /// standards (FIPS 203, FIPS 204, and FIPS 205).
9535 NistPqc,
9536 /// The returned public key is in raw bytes format defined in its standard
9537 /// <https://datatracker.ietf.org/doc/draft-connolly-cfrg-xwing-kem>.
9538 XwingRawBytes,
9539 /// If set, the enum was initialized with an unknown value.
9540 ///
9541 /// Applications can examine the value using [PublicKeyFormat::value] or
9542 /// [PublicKeyFormat::name].
9543 UnknownValue(public_key_format::UnknownValue),
9544 }
9545
9546 #[doc(hidden)]
9547 pub mod public_key_format {
9548 #[allow(unused_imports)]
9549 use super::*;
9550 #[derive(Clone, Debug, PartialEq)]
9551 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9552 }
9553
9554 impl PublicKeyFormat {
9555 /// Gets the enum value.
9556 ///
9557 /// Returns `None` if the enum contains an unknown value deserialized from
9558 /// the string representation of enums.
9559 pub fn value(&self) -> std::option::Option<i32> {
9560 match self {
9561 Self::Unspecified => std::option::Option::Some(0),
9562 Self::Pem => std::option::Option::Some(1),
9563 Self::Der => std::option::Option::Some(2),
9564 Self::NistPqc => std::option::Option::Some(3),
9565 Self::XwingRawBytes => std::option::Option::Some(4),
9566 Self::UnknownValue(u) => u.0.value(),
9567 }
9568 }
9569
9570 /// Gets the enum value as a string.
9571 ///
9572 /// Returns `None` if the enum contains an unknown value deserialized from
9573 /// the integer representation of enums.
9574 pub fn name(&self) -> std::option::Option<&str> {
9575 match self {
9576 Self::Unspecified => std::option::Option::Some("PUBLIC_KEY_FORMAT_UNSPECIFIED"),
9577 Self::Pem => std::option::Option::Some("PEM"),
9578 Self::Der => std::option::Option::Some("DER"),
9579 Self::NistPqc => std::option::Option::Some("NIST_PQC"),
9580 Self::XwingRawBytes => std::option::Option::Some("XWING_RAW_BYTES"),
9581 Self::UnknownValue(u) => u.0.name(),
9582 }
9583 }
9584 }
9585
9586 impl std::default::Default for PublicKeyFormat {
9587 fn default() -> Self {
9588 use std::convert::From;
9589 Self::from(0)
9590 }
9591 }
9592
9593 impl std::fmt::Display for PublicKeyFormat {
9594 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9595 wkt::internal::display_enum(f, self.name(), self.value())
9596 }
9597 }
9598
9599 impl std::convert::From<i32> for PublicKeyFormat {
9600 fn from(value: i32) -> Self {
9601 match value {
9602 0 => Self::Unspecified,
9603 1 => Self::Pem,
9604 2 => Self::Der,
9605 3 => Self::NistPqc,
9606 4 => Self::XwingRawBytes,
9607 _ => Self::UnknownValue(public_key_format::UnknownValue(
9608 wkt::internal::UnknownEnumValue::Integer(value),
9609 )),
9610 }
9611 }
9612 }
9613
9614 impl std::convert::From<&str> for PublicKeyFormat {
9615 fn from(value: &str) -> Self {
9616 use std::string::ToString;
9617 match value {
9618 "PUBLIC_KEY_FORMAT_UNSPECIFIED" => Self::Unspecified,
9619 "PEM" => Self::Pem,
9620 "DER" => Self::Der,
9621 "NIST_PQC" => Self::NistPqc,
9622 "XWING_RAW_BYTES" => Self::XwingRawBytes,
9623 _ => Self::UnknownValue(public_key_format::UnknownValue(
9624 wkt::internal::UnknownEnumValue::String(value.to_string()),
9625 )),
9626 }
9627 }
9628 }
9629
9630 impl serde::ser::Serialize for PublicKeyFormat {
9631 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9632 where
9633 S: serde::Serializer,
9634 {
9635 match self {
9636 Self::Unspecified => serializer.serialize_i32(0),
9637 Self::Pem => serializer.serialize_i32(1),
9638 Self::Der => serializer.serialize_i32(2),
9639 Self::NistPqc => serializer.serialize_i32(3),
9640 Self::XwingRawBytes => serializer.serialize_i32(4),
9641 Self::UnknownValue(u) => u.0.serialize(serializer),
9642 }
9643 }
9644 }
9645
9646 impl<'de> serde::de::Deserialize<'de> for PublicKeyFormat {
9647 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9648 where
9649 D: serde::Deserializer<'de>,
9650 {
9651 deserializer.deserialize_any(wkt::internal::EnumVisitor::<PublicKeyFormat>::new(
9652 ".google.cloud.kms.v1.PublicKey.PublicKeyFormat",
9653 ))
9654 }
9655 }
9656}
9657
9658/// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create
9659/// [CryptoKeys][google.cloud.kms.v1.CryptoKey] and
9660/// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing
9661/// key material, generated outside of Cloud KMS.
9662///
9663/// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will
9664/// generate a "wrapping key", which is a public/private key pair. You use the
9665/// wrapping key to encrypt (also known as wrap) the pre-existing key material to
9666/// protect it during the import process. The nature of the wrapping key depends
9667/// on the choice of
9668/// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the
9669/// wrapping key generation is complete, the
9670/// [state][google.cloud.kms.v1.ImportJob.state] will be set to
9671/// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the
9672/// [public_key][google.cloud.kms.v1.ImportJob.public_key] can be fetched. The
9673/// fetched public key can then be used to wrap your pre-existing key material.
9674///
9675/// Once the key material is wrapped, it can be imported into a new
9676/// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing
9677/// [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling
9678/// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
9679/// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be
9680/// imported with a single [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS
9681/// uses the private key portion of the wrapping key to unwrap the key material.
9682/// Only Cloud KMS has access to the private key.
9683///
9684/// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is
9685/// created. Once expired, Cloud KMS will no longer be able to import or unwrap
9686/// any key material that was wrapped with the
9687/// [ImportJob][google.cloud.kms.v1.ImportJob]'s public key.
9688///
9689/// For more information, see
9690/// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key).
9691///
9692/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9693/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
9694/// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9695/// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9696/// [google.cloud.kms.v1.ImportJob.import_method]: crate::model::ImportJob::import_method
9697/// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
9698/// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9699/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
9700#[derive(Clone, Default, PartialEq)]
9701#[non_exhaustive]
9702pub struct ImportJob {
9703 /// Output only. The resource name for this
9704 /// [ImportJob][google.cloud.kms.v1.ImportJob] in the format
9705 /// `projects/*/locations/*/keyRings/*/importJobs/*`.
9706 ///
9707 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9708 pub name: std::string::String,
9709
9710 /// Required. Immutable. The wrapping method to be used for incoming key
9711 /// material.
9712 pub import_method: crate::model::import_job::ImportMethod,
9713
9714 /// Required. Immutable. The protection level of the
9715 /// [ImportJob][google.cloud.kms.v1.ImportJob]. This must match the
9716 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
9717 /// of the [version_template][google.cloud.kms.v1.CryptoKey.version_template]
9718 /// on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you attempt to import
9719 /// into.
9720 ///
9721 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
9722 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
9723 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
9724 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9725 pub protection_level: crate::model::ProtectionLevel,
9726
9727 /// Output only. The time at which this
9728 /// [ImportJob][google.cloud.kms.v1.ImportJob] was created.
9729 ///
9730 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9731 pub create_time: std::option::Option<wkt::Timestamp>,
9732
9733 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key
9734 /// material was generated.
9735 ///
9736 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9737 pub generate_time: std::option::Option<wkt::Timestamp>,
9738
9739 /// Output only. The time at which this
9740 /// [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for expiration and
9741 /// can no longer be used to import key material.
9742 ///
9743 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9744 pub expire_time: std::option::Option<wkt::Timestamp>,
9745
9746 /// Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]
9747 /// expired. Only present if [state][google.cloud.kms.v1.ImportJob.state] is
9748 /// [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED].
9749 ///
9750 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9751 /// [google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]: crate::model::import_job::ImportJobState::Expired
9752 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9753 pub expire_event_time: std::option::Option<wkt::Timestamp>,
9754
9755 /// Output only. The current state of the
9756 /// [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used.
9757 ///
9758 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
9759 pub state: crate::model::import_job::ImportJobState,
9760
9761 /// Output only. The public key with which to wrap key material prior to
9762 /// import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is
9763 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE].
9764 ///
9765 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
9766 /// [google.cloud.kms.v1.ImportJob.state]: crate::model::ImportJob::state
9767 pub public_key: std::option::Option<crate::model::import_job::WrappingPublicKey>,
9768
9769 /// Output only. Statement that was generated and signed by the key creator
9770 /// (for example, an HSM) at key creation time. Use this statement to verify
9771 /// attributes of the key as stored on the HSM, independently of Google.
9772 /// Only present if the chosen
9773 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a
9774 /// protection level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM].
9775 ///
9776 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
9777 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
9778 pub attestation: std::option::Option<crate::model::KeyOperationAttestation>,
9779
9780 /// Immutable. The resource name of the backend environment where the key
9781 /// material for the wrapping key resides and where all related cryptographic
9782 /// operations are performed. Currently, this field is only populated for keys
9783 /// stored in HSM_SINGLE_TENANT. Note, this list is non-exhaustive and may
9784 /// apply to additional [ProtectionLevels][google.cloud.kms.v1.ProtectionLevel]
9785 /// in the future. Supported resources:
9786 ///
9787 /// * `"projects/*/locations/*/singleTenantHsmInstances/*"`
9788 ///
9789 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
9790 pub crypto_key_backend: std::string::String,
9791
9792 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9793}
9794
9795impl ImportJob {
9796 /// Creates a new default instance.
9797 pub fn new() -> Self {
9798 std::default::Default::default()
9799 }
9800
9801 /// Sets the value of [name][crate::model::ImportJob::name].
9802 ///
9803 /// # Example
9804 /// ```ignore,no_run
9805 /// # use google_cloud_kms_v1::model::ImportJob;
9806 /// # let project_id = "project_id";
9807 /// # let location_id = "location_id";
9808 /// # let key_ring_id = "key_ring_id";
9809 /// # let import_job_id = "import_job_id";
9810 /// let x = ImportJob::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/importJobs/{import_job_id}"));
9811 /// ```
9812 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9813 self.name = v.into();
9814 self
9815 }
9816
9817 /// Sets the value of [import_method][crate::model::ImportJob::import_method].
9818 ///
9819 /// # Example
9820 /// ```ignore,no_run
9821 /// # use google_cloud_kms_v1::model::ImportJob;
9822 /// use google_cloud_kms_v1::model::import_job::ImportMethod;
9823 /// let x0 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha1Aes256);
9824 /// let x1 = ImportJob::new().set_import_method(ImportMethod::RsaOaep4096Sha1Aes256);
9825 /// let x2 = ImportJob::new().set_import_method(ImportMethod::RsaOaep3072Sha256Aes256);
9826 /// ```
9827 pub fn set_import_method<T: std::convert::Into<crate::model::import_job::ImportMethod>>(
9828 mut self,
9829 v: T,
9830 ) -> Self {
9831 self.import_method = v.into();
9832 self
9833 }
9834
9835 /// Sets the value of [protection_level][crate::model::ImportJob::protection_level].
9836 ///
9837 /// # Example
9838 /// ```ignore,no_run
9839 /// # use google_cloud_kms_v1::model::ImportJob;
9840 /// use google_cloud_kms_v1::model::ProtectionLevel;
9841 /// let x0 = ImportJob::new().set_protection_level(ProtectionLevel::Software);
9842 /// let x1 = ImportJob::new().set_protection_level(ProtectionLevel::Hsm);
9843 /// let x2 = ImportJob::new().set_protection_level(ProtectionLevel::External);
9844 /// ```
9845 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
9846 mut self,
9847 v: T,
9848 ) -> Self {
9849 self.protection_level = v.into();
9850 self
9851 }
9852
9853 /// Sets the value of [create_time][crate::model::ImportJob::create_time].
9854 ///
9855 /// # Example
9856 /// ```ignore,no_run
9857 /// # use google_cloud_kms_v1::model::ImportJob;
9858 /// use wkt::Timestamp;
9859 /// let x = ImportJob::new().set_create_time(Timestamp::default()/* use setters */);
9860 /// ```
9861 pub fn set_create_time<T>(mut self, v: T) -> Self
9862 where
9863 T: std::convert::Into<wkt::Timestamp>,
9864 {
9865 self.create_time = std::option::Option::Some(v.into());
9866 self
9867 }
9868
9869 /// Sets or clears the value of [create_time][crate::model::ImportJob::create_time].
9870 ///
9871 /// # Example
9872 /// ```ignore,no_run
9873 /// # use google_cloud_kms_v1::model::ImportJob;
9874 /// use wkt::Timestamp;
9875 /// let x = ImportJob::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
9876 /// let x = ImportJob::new().set_or_clear_create_time(None::<Timestamp>);
9877 /// ```
9878 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
9879 where
9880 T: std::convert::Into<wkt::Timestamp>,
9881 {
9882 self.create_time = v.map(|x| x.into());
9883 self
9884 }
9885
9886 /// Sets the value of [generate_time][crate::model::ImportJob::generate_time].
9887 ///
9888 /// # Example
9889 /// ```ignore,no_run
9890 /// # use google_cloud_kms_v1::model::ImportJob;
9891 /// use wkt::Timestamp;
9892 /// let x = ImportJob::new().set_generate_time(Timestamp::default()/* use setters */);
9893 /// ```
9894 pub fn set_generate_time<T>(mut self, v: T) -> Self
9895 where
9896 T: std::convert::Into<wkt::Timestamp>,
9897 {
9898 self.generate_time = std::option::Option::Some(v.into());
9899 self
9900 }
9901
9902 /// Sets or clears the value of [generate_time][crate::model::ImportJob::generate_time].
9903 ///
9904 /// # Example
9905 /// ```ignore,no_run
9906 /// # use google_cloud_kms_v1::model::ImportJob;
9907 /// use wkt::Timestamp;
9908 /// let x = ImportJob::new().set_or_clear_generate_time(Some(Timestamp::default()/* use setters */));
9909 /// let x = ImportJob::new().set_or_clear_generate_time(None::<Timestamp>);
9910 /// ```
9911 pub fn set_or_clear_generate_time<T>(mut self, v: std::option::Option<T>) -> Self
9912 where
9913 T: std::convert::Into<wkt::Timestamp>,
9914 {
9915 self.generate_time = v.map(|x| x.into());
9916 self
9917 }
9918
9919 /// Sets the value of [expire_time][crate::model::ImportJob::expire_time].
9920 ///
9921 /// # Example
9922 /// ```ignore,no_run
9923 /// # use google_cloud_kms_v1::model::ImportJob;
9924 /// use wkt::Timestamp;
9925 /// let x = ImportJob::new().set_expire_time(Timestamp::default()/* use setters */);
9926 /// ```
9927 pub fn set_expire_time<T>(mut self, v: T) -> Self
9928 where
9929 T: std::convert::Into<wkt::Timestamp>,
9930 {
9931 self.expire_time = std::option::Option::Some(v.into());
9932 self
9933 }
9934
9935 /// Sets or clears the value of [expire_time][crate::model::ImportJob::expire_time].
9936 ///
9937 /// # Example
9938 /// ```ignore,no_run
9939 /// # use google_cloud_kms_v1::model::ImportJob;
9940 /// use wkt::Timestamp;
9941 /// let x = ImportJob::new().set_or_clear_expire_time(Some(Timestamp::default()/* use setters */));
9942 /// let x = ImportJob::new().set_or_clear_expire_time(None::<Timestamp>);
9943 /// ```
9944 pub fn set_or_clear_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
9945 where
9946 T: std::convert::Into<wkt::Timestamp>,
9947 {
9948 self.expire_time = v.map(|x| x.into());
9949 self
9950 }
9951
9952 /// Sets the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9953 ///
9954 /// # Example
9955 /// ```ignore,no_run
9956 /// # use google_cloud_kms_v1::model::ImportJob;
9957 /// use wkt::Timestamp;
9958 /// let x = ImportJob::new().set_expire_event_time(Timestamp::default()/* use setters */);
9959 /// ```
9960 pub fn set_expire_event_time<T>(mut self, v: T) -> Self
9961 where
9962 T: std::convert::Into<wkt::Timestamp>,
9963 {
9964 self.expire_event_time = std::option::Option::Some(v.into());
9965 self
9966 }
9967
9968 /// Sets or clears the value of [expire_event_time][crate::model::ImportJob::expire_event_time].
9969 ///
9970 /// # Example
9971 /// ```ignore,no_run
9972 /// # use google_cloud_kms_v1::model::ImportJob;
9973 /// use wkt::Timestamp;
9974 /// let x = ImportJob::new().set_or_clear_expire_event_time(Some(Timestamp::default()/* use setters */));
9975 /// let x = ImportJob::new().set_or_clear_expire_event_time(None::<Timestamp>);
9976 /// ```
9977 pub fn set_or_clear_expire_event_time<T>(mut self, v: std::option::Option<T>) -> Self
9978 where
9979 T: std::convert::Into<wkt::Timestamp>,
9980 {
9981 self.expire_event_time = v.map(|x| x.into());
9982 self
9983 }
9984
9985 /// Sets the value of [state][crate::model::ImportJob::state].
9986 ///
9987 /// # Example
9988 /// ```ignore,no_run
9989 /// # use google_cloud_kms_v1::model::ImportJob;
9990 /// use google_cloud_kms_v1::model::import_job::ImportJobState;
9991 /// let x0 = ImportJob::new().set_state(ImportJobState::PendingGeneration);
9992 /// let x1 = ImportJob::new().set_state(ImportJobState::Active);
9993 /// let x2 = ImportJob::new().set_state(ImportJobState::Expired);
9994 /// ```
9995 pub fn set_state<T: std::convert::Into<crate::model::import_job::ImportJobState>>(
9996 mut self,
9997 v: T,
9998 ) -> Self {
9999 self.state = v.into();
10000 self
10001 }
10002
10003 /// Sets the value of [public_key][crate::model::ImportJob::public_key].
10004 ///
10005 /// # Example
10006 /// ```ignore,no_run
10007 /// # use google_cloud_kms_v1::model::ImportJob;
10008 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10009 /// let x = ImportJob::new().set_public_key(WrappingPublicKey::default()/* use setters */);
10010 /// ```
10011 pub fn set_public_key<T>(mut self, v: T) -> Self
10012 where
10013 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
10014 {
10015 self.public_key = std::option::Option::Some(v.into());
10016 self
10017 }
10018
10019 /// Sets or clears the value of [public_key][crate::model::ImportJob::public_key].
10020 ///
10021 /// # Example
10022 /// ```ignore,no_run
10023 /// # use google_cloud_kms_v1::model::ImportJob;
10024 /// use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10025 /// let x = ImportJob::new().set_or_clear_public_key(Some(WrappingPublicKey::default()/* use setters */));
10026 /// let x = ImportJob::new().set_or_clear_public_key(None::<WrappingPublicKey>);
10027 /// ```
10028 pub fn set_or_clear_public_key<T>(mut self, v: std::option::Option<T>) -> Self
10029 where
10030 T: std::convert::Into<crate::model::import_job::WrappingPublicKey>,
10031 {
10032 self.public_key = v.map(|x| x.into());
10033 self
10034 }
10035
10036 /// Sets the value of [attestation][crate::model::ImportJob::attestation].
10037 ///
10038 /// # Example
10039 /// ```ignore,no_run
10040 /// # use google_cloud_kms_v1::model::ImportJob;
10041 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
10042 /// let x = ImportJob::new().set_attestation(KeyOperationAttestation::default()/* use setters */);
10043 /// ```
10044 pub fn set_attestation<T>(mut self, v: T) -> Self
10045 where
10046 T: std::convert::Into<crate::model::KeyOperationAttestation>,
10047 {
10048 self.attestation = std::option::Option::Some(v.into());
10049 self
10050 }
10051
10052 /// Sets or clears the value of [attestation][crate::model::ImportJob::attestation].
10053 ///
10054 /// # Example
10055 /// ```ignore,no_run
10056 /// # use google_cloud_kms_v1::model::ImportJob;
10057 /// use google_cloud_kms_v1::model::KeyOperationAttestation;
10058 /// let x = ImportJob::new().set_or_clear_attestation(Some(KeyOperationAttestation::default()/* use setters */));
10059 /// let x = ImportJob::new().set_or_clear_attestation(None::<KeyOperationAttestation>);
10060 /// ```
10061 pub fn set_or_clear_attestation<T>(mut self, v: std::option::Option<T>) -> Self
10062 where
10063 T: std::convert::Into<crate::model::KeyOperationAttestation>,
10064 {
10065 self.attestation = v.map(|x| x.into());
10066 self
10067 }
10068
10069 /// Sets the value of [crypto_key_backend][crate::model::ImportJob::crypto_key_backend].
10070 ///
10071 /// # Example
10072 /// ```ignore,no_run
10073 /// # use google_cloud_kms_v1::model::ImportJob;
10074 /// let x = ImportJob::new().set_crypto_key_backend("example");
10075 /// ```
10076 pub fn set_crypto_key_backend<T: std::convert::Into<std::string::String>>(
10077 mut self,
10078 v: T,
10079 ) -> Self {
10080 self.crypto_key_backend = v.into();
10081 self
10082 }
10083}
10084
10085impl wkt::message::Message for ImportJob {
10086 fn typename() -> &'static str {
10087 "type.googleapis.com/google.cloud.kms.v1.ImportJob"
10088 }
10089}
10090
10091/// Defines additional types related to [ImportJob].
10092pub mod import_job {
10093 #[allow(unused_imports)]
10094 use super::*;
10095
10096 /// The public key component of the wrapping key. For details of the type of
10097 /// key this public key corresponds to, see the
10098 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod].
10099 ///
10100 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10101 #[derive(Clone, Default, PartialEq)]
10102 #[non_exhaustive]
10103 pub struct WrappingPublicKey {
10104 /// The public key, encoded in PEM format. For more information, see the [RFC
10105 /// 7468](https://tools.ietf.org/html/rfc7468) sections for [General
10106 /// Considerations](https://tools.ietf.org/html/rfc7468#section-2) and
10107 /// [Textual Encoding of Subject Public Key Info]
10108 /// (<https://tools.ietf.org/html/rfc7468#section-13>).
10109 pub pem: std::string::String,
10110
10111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10112 }
10113
10114 impl WrappingPublicKey {
10115 /// Creates a new default instance.
10116 pub fn new() -> Self {
10117 std::default::Default::default()
10118 }
10119
10120 /// Sets the value of [pem][crate::model::import_job::WrappingPublicKey::pem].
10121 ///
10122 /// # Example
10123 /// ```ignore,no_run
10124 /// # use google_cloud_kms_v1::model::import_job::WrappingPublicKey;
10125 /// let x = WrappingPublicKey::new().set_pem("example");
10126 /// ```
10127 pub fn set_pem<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10128 self.pem = v.into();
10129 self
10130 }
10131 }
10132
10133 impl wkt::message::Message for WrappingPublicKey {
10134 fn typename() -> &'static str {
10135 "type.googleapis.com/google.cloud.kms.v1.ImportJob.WrappingPublicKey"
10136 }
10137 }
10138
10139 /// [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the
10140 /// key wrapping method chosen for this
10141 /// [ImportJob][google.cloud.kms.v1.ImportJob].
10142 ///
10143 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10144 /// [google.cloud.kms.v1.ImportJob.ImportMethod]: crate::model::import_job::ImportMethod
10145 ///
10146 /// # Working with unknown values
10147 ///
10148 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10149 /// additional enum variants at any time. Adding new variants is not considered
10150 /// a breaking change. Applications should write their code in anticipation of:
10151 ///
10152 /// - New values appearing in future releases of the client library, **and**
10153 /// - New values received dynamically, without application changes.
10154 ///
10155 /// Please consult the [Working with enums] section in the user guide for some
10156 /// guidelines.
10157 ///
10158 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10159 #[derive(Clone, Debug, PartialEq)]
10160 #[non_exhaustive]
10161 pub enum ImportMethod {
10162 /// Not specified.
10163 Unspecified,
10164 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10165 /// scheme defined in the PKCS #11 standard. In summary, this involves
10166 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10167 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10168 /// [RSA AES key wrap
10169 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10170 RsaOaep3072Sha1Aes256,
10171 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10172 /// scheme defined in the PKCS #11 standard. In summary, this involves
10173 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10174 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10175 /// [RSA AES key wrap
10176 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10177 RsaOaep4096Sha1Aes256,
10178 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10179 /// scheme defined in the PKCS #11 standard. In summary, this involves
10180 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10181 /// ephemeral AES key with a 3072 bit RSA key. For more details, see
10182 /// [RSA AES key wrap
10183 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10184 RsaOaep3072Sha256Aes256,
10185 /// This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping
10186 /// scheme defined in the PKCS #11 standard. In summary, this involves
10187 /// wrapping the raw key with an ephemeral AES key, and wrapping the
10188 /// ephemeral AES key with a 4096 bit RSA key. For more details, see
10189 /// [RSA AES key wrap
10190 /// mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908).
10191 RsaOaep4096Sha256Aes256,
10192 /// This ImportMethod represents RSAES-OAEP with a 3072 bit RSA key. The
10193 /// key material to be imported is wrapped directly with the RSA key. Due
10194 /// to technical limitations of RSA wrapping, this method cannot be used to
10195 /// wrap RSA keys for import.
10196 RsaOaep3072Sha256,
10197 /// This ImportMethod represents RSAES-OAEP with a 4096 bit RSA key. The
10198 /// key material to be imported is wrapped directly with the RSA key. Due
10199 /// to technical limitations of RSA wrapping, this method cannot be used to
10200 /// wrap RSA keys for import.
10201 RsaOaep4096Sha256,
10202 /// If set, the enum was initialized with an unknown value.
10203 ///
10204 /// Applications can examine the value using [ImportMethod::value] or
10205 /// [ImportMethod::name].
10206 UnknownValue(import_method::UnknownValue),
10207 }
10208
10209 #[doc(hidden)]
10210 pub mod import_method {
10211 #[allow(unused_imports)]
10212 use super::*;
10213 #[derive(Clone, Debug, PartialEq)]
10214 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10215 }
10216
10217 impl ImportMethod {
10218 /// Gets the enum value.
10219 ///
10220 /// Returns `None` if the enum contains an unknown value deserialized from
10221 /// the string representation of enums.
10222 pub fn value(&self) -> std::option::Option<i32> {
10223 match self {
10224 Self::Unspecified => std::option::Option::Some(0),
10225 Self::RsaOaep3072Sha1Aes256 => std::option::Option::Some(1),
10226 Self::RsaOaep4096Sha1Aes256 => std::option::Option::Some(2),
10227 Self::RsaOaep3072Sha256Aes256 => std::option::Option::Some(3),
10228 Self::RsaOaep4096Sha256Aes256 => std::option::Option::Some(4),
10229 Self::RsaOaep3072Sha256 => std::option::Option::Some(5),
10230 Self::RsaOaep4096Sha256 => std::option::Option::Some(6),
10231 Self::UnknownValue(u) => u.0.value(),
10232 }
10233 }
10234
10235 /// Gets the enum value as a string.
10236 ///
10237 /// Returns `None` if the enum contains an unknown value deserialized from
10238 /// the integer representation of enums.
10239 pub fn name(&self) -> std::option::Option<&str> {
10240 match self {
10241 Self::Unspecified => std::option::Option::Some("IMPORT_METHOD_UNSPECIFIED"),
10242 Self::RsaOaep3072Sha1Aes256 => {
10243 std::option::Option::Some("RSA_OAEP_3072_SHA1_AES_256")
10244 }
10245 Self::RsaOaep4096Sha1Aes256 => {
10246 std::option::Option::Some("RSA_OAEP_4096_SHA1_AES_256")
10247 }
10248 Self::RsaOaep3072Sha256Aes256 => {
10249 std::option::Option::Some("RSA_OAEP_3072_SHA256_AES_256")
10250 }
10251 Self::RsaOaep4096Sha256Aes256 => {
10252 std::option::Option::Some("RSA_OAEP_4096_SHA256_AES_256")
10253 }
10254 Self::RsaOaep3072Sha256 => std::option::Option::Some("RSA_OAEP_3072_SHA256"),
10255 Self::RsaOaep4096Sha256 => std::option::Option::Some("RSA_OAEP_4096_SHA256"),
10256 Self::UnknownValue(u) => u.0.name(),
10257 }
10258 }
10259 }
10260
10261 impl std::default::Default for ImportMethod {
10262 fn default() -> Self {
10263 use std::convert::From;
10264 Self::from(0)
10265 }
10266 }
10267
10268 impl std::fmt::Display for ImportMethod {
10269 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10270 wkt::internal::display_enum(f, self.name(), self.value())
10271 }
10272 }
10273
10274 impl std::convert::From<i32> for ImportMethod {
10275 fn from(value: i32) -> Self {
10276 match value {
10277 0 => Self::Unspecified,
10278 1 => Self::RsaOaep3072Sha1Aes256,
10279 2 => Self::RsaOaep4096Sha1Aes256,
10280 3 => Self::RsaOaep3072Sha256Aes256,
10281 4 => Self::RsaOaep4096Sha256Aes256,
10282 5 => Self::RsaOaep3072Sha256,
10283 6 => Self::RsaOaep4096Sha256,
10284 _ => Self::UnknownValue(import_method::UnknownValue(
10285 wkt::internal::UnknownEnumValue::Integer(value),
10286 )),
10287 }
10288 }
10289 }
10290
10291 impl std::convert::From<&str> for ImportMethod {
10292 fn from(value: &str) -> Self {
10293 use std::string::ToString;
10294 match value {
10295 "IMPORT_METHOD_UNSPECIFIED" => Self::Unspecified,
10296 "RSA_OAEP_3072_SHA1_AES_256" => Self::RsaOaep3072Sha1Aes256,
10297 "RSA_OAEP_4096_SHA1_AES_256" => Self::RsaOaep4096Sha1Aes256,
10298 "RSA_OAEP_3072_SHA256_AES_256" => Self::RsaOaep3072Sha256Aes256,
10299 "RSA_OAEP_4096_SHA256_AES_256" => Self::RsaOaep4096Sha256Aes256,
10300 "RSA_OAEP_3072_SHA256" => Self::RsaOaep3072Sha256,
10301 "RSA_OAEP_4096_SHA256" => Self::RsaOaep4096Sha256,
10302 _ => Self::UnknownValue(import_method::UnknownValue(
10303 wkt::internal::UnknownEnumValue::String(value.to_string()),
10304 )),
10305 }
10306 }
10307 }
10308
10309 impl serde::ser::Serialize for ImportMethod {
10310 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10311 where
10312 S: serde::Serializer,
10313 {
10314 match self {
10315 Self::Unspecified => serializer.serialize_i32(0),
10316 Self::RsaOaep3072Sha1Aes256 => serializer.serialize_i32(1),
10317 Self::RsaOaep4096Sha1Aes256 => serializer.serialize_i32(2),
10318 Self::RsaOaep3072Sha256Aes256 => serializer.serialize_i32(3),
10319 Self::RsaOaep4096Sha256Aes256 => serializer.serialize_i32(4),
10320 Self::RsaOaep3072Sha256 => serializer.serialize_i32(5),
10321 Self::RsaOaep4096Sha256 => serializer.serialize_i32(6),
10322 Self::UnknownValue(u) => u.0.serialize(serializer),
10323 }
10324 }
10325 }
10326
10327 impl<'de> serde::de::Deserialize<'de> for ImportMethod {
10328 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10329 where
10330 D: serde::Deserializer<'de>,
10331 {
10332 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportMethod>::new(
10333 ".google.cloud.kms.v1.ImportJob.ImportMethod",
10334 ))
10335 }
10336 }
10337
10338 /// The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if
10339 /// it can be used.
10340 ///
10341 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
10342 ///
10343 /// # Working with unknown values
10344 ///
10345 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10346 /// additional enum variants at any time. Adding new variants is not considered
10347 /// a breaking change. Applications should write their code in anticipation of:
10348 ///
10349 /// - New values appearing in future releases of the client library, **and**
10350 /// - New values received dynamically, without application changes.
10351 ///
10352 /// Please consult the [Working with enums] section in the user guide for some
10353 /// guidelines.
10354 ///
10355 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
10356 #[derive(Clone, Debug, PartialEq)]
10357 #[non_exhaustive]
10358 pub enum ImportJobState {
10359 /// Not specified.
10360 Unspecified,
10361 /// The wrapping key for this job is still being generated. It may not be
10362 /// used. Cloud KMS will automatically mark this job as
10363 /// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as
10364 /// the wrapping key is generated.
10365 ///
10366 /// [google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]: crate::model::import_job::ImportJobState::Active
10367 PendingGeneration,
10368 /// This job may be used in
10369 /// [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]
10370 /// and
10371 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
10372 /// requests.
10373 ///
10374 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
10375 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
10376 Active,
10377 /// This job can no longer be used and may not leave this state once entered.
10378 Expired,
10379 /// If set, the enum was initialized with an unknown value.
10380 ///
10381 /// Applications can examine the value using [ImportJobState::value] or
10382 /// [ImportJobState::name].
10383 UnknownValue(import_job_state::UnknownValue),
10384 }
10385
10386 #[doc(hidden)]
10387 pub mod import_job_state {
10388 #[allow(unused_imports)]
10389 use super::*;
10390 #[derive(Clone, Debug, PartialEq)]
10391 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10392 }
10393
10394 impl ImportJobState {
10395 /// Gets the enum value.
10396 ///
10397 /// Returns `None` if the enum contains an unknown value deserialized from
10398 /// the string representation of enums.
10399 pub fn value(&self) -> std::option::Option<i32> {
10400 match self {
10401 Self::Unspecified => std::option::Option::Some(0),
10402 Self::PendingGeneration => std::option::Option::Some(1),
10403 Self::Active => std::option::Option::Some(2),
10404 Self::Expired => std::option::Option::Some(3),
10405 Self::UnknownValue(u) => u.0.value(),
10406 }
10407 }
10408
10409 /// Gets the enum value as a string.
10410 ///
10411 /// Returns `None` if the enum contains an unknown value deserialized from
10412 /// the integer representation of enums.
10413 pub fn name(&self) -> std::option::Option<&str> {
10414 match self {
10415 Self::Unspecified => std::option::Option::Some("IMPORT_JOB_STATE_UNSPECIFIED"),
10416 Self::PendingGeneration => std::option::Option::Some("PENDING_GENERATION"),
10417 Self::Active => std::option::Option::Some("ACTIVE"),
10418 Self::Expired => std::option::Option::Some("EXPIRED"),
10419 Self::UnknownValue(u) => u.0.name(),
10420 }
10421 }
10422 }
10423
10424 impl std::default::Default for ImportJobState {
10425 fn default() -> Self {
10426 use std::convert::From;
10427 Self::from(0)
10428 }
10429 }
10430
10431 impl std::fmt::Display for ImportJobState {
10432 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10433 wkt::internal::display_enum(f, self.name(), self.value())
10434 }
10435 }
10436
10437 impl std::convert::From<i32> for ImportJobState {
10438 fn from(value: i32) -> Self {
10439 match value {
10440 0 => Self::Unspecified,
10441 1 => Self::PendingGeneration,
10442 2 => Self::Active,
10443 3 => Self::Expired,
10444 _ => Self::UnknownValue(import_job_state::UnknownValue(
10445 wkt::internal::UnknownEnumValue::Integer(value),
10446 )),
10447 }
10448 }
10449 }
10450
10451 impl std::convert::From<&str> for ImportJobState {
10452 fn from(value: &str) -> Self {
10453 use std::string::ToString;
10454 match value {
10455 "IMPORT_JOB_STATE_UNSPECIFIED" => Self::Unspecified,
10456 "PENDING_GENERATION" => Self::PendingGeneration,
10457 "ACTIVE" => Self::Active,
10458 "EXPIRED" => Self::Expired,
10459 _ => Self::UnknownValue(import_job_state::UnknownValue(
10460 wkt::internal::UnknownEnumValue::String(value.to_string()),
10461 )),
10462 }
10463 }
10464 }
10465
10466 impl serde::ser::Serialize for ImportJobState {
10467 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10468 where
10469 S: serde::Serializer,
10470 {
10471 match self {
10472 Self::Unspecified => serializer.serialize_i32(0),
10473 Self::PendingGeneration => serializer.serialize_i32(1),
10474 Self::Active => serializer.serialize_i32(2),
10475 Self::Expired => serializer.serialize_i32(3),
10476 Self::UnknownValue(u) => u.0.serialize(serializer),
10477 }
10478 }
10479 }
10480
10481 impl<'de> serde::de::Deserialize<'de> for ImportJobState {
10482 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10483 where
10484 D: serde::Deserializer<'de>,
10485 {
10486 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ImportJobState>::new(
10487 ".google.cloud.kms.v1.ImportJob.ImportJobState",
10488 ))
10489 }
10490 }
10491}
10492
10493/// ExternalProtectionLevelOptions stores a group of additional fields for
10494/// configuring a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that
10495/// are specific to the [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL]
10496/// protection level and
10497/// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] protection
10498/// levels.
10499///
10500/// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10501/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
10502/// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
10503#[derive(Clone, Default, PartialEq)]
10504#[non_exhaustive]
10505pub struct ExternalProtectionLevelOptions {
10506 /// The URI for an external resource that this
10507 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents.
10508 ///
10509 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
10510 pub external_key_uri: std::string::String,
10511
10512 /// The path to the external key material on the EKM when using
10513 /// [EkmConnection][google.cloud.kms.v1.EkmConnection] e.g., "v0/my/key". Set
10514 /// this field instead of external_key_uri when using an
10515 /// [EkmConnection][google.cloud.kms.v1.EkmConnection].
10516 ///
10517 /// [google.cloud.kms.v1.EkmConnection]: crate::model::EkmConnection
10518 pub ekm_connection_key_path: std::string::String,
10519
10520 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10521}
10522
10523impl ExternalProtectionLevelOptions {
10524 /// Creates a new default instance.
10525 pub fn new() -> Self {
10526 std::default::Default::default()
10527 }
10528
10529 /// Sets the value of [external_key_uri][crate::model::ExternalProtectionLevelOptions::external_key_uri].
10530 ///
10531 /// # Example
10532 /// ```ignore,no_run
10533 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10534 /// let x = ExternalProtectionLevelOptions::new().set_external_key_uri("example");
10535 /// ```
10536 pub fn set_external_key_uri<T: std::convert::Into<std::string::String>>(
10537 mut self,
10538 v: T,
10539 ) -> Self {
10540 self.external_key_uri = v.into();
10541 self
10542 }
10543
10544 /// Sets the value of [ekm_connection_key_path][crate::model::ExternalProtectionLevelOptions::ekm_connection_key_path].
10545 ///
10546 /// # Example
10547 /// ```ignore,no_run
10548 /// # use google_cloud_kms_v1::model::ExternalProtectionLevelOptions;
10549 /// let x = ExternalProtectionLevelOptions::new().set_ekm_connection_key_path("example");
10550 /// ```
10551 pub fn set_ekm_connection_key_path<T: std::convert::Into<std::string::String>>(
10552 mut self,
10553 v: T,
10554 ) -> Self {
10555 self.ekm_connection_key_path = v.into();
10556 self
10557 }
10558}
10559
10560impl wkt::message::Message for ExternalProtectionLevelOptions {
10561 fn typename() -> &'static str {
10562 "type.googleapis.com/google.cloud.kms.v1.ExternalProtectionLevelOptions"
10563 }
10564}
10565
10566/// A
10567/// [KeyAccessJustificationsPolicy][google.cloud.kms.v1.KeyAccessJustificationsPolicy]
10568/// specifies zero or more allowed
10569/// [AccessReason][google.cloud.kms.v1.AccessReason] values for encrypt, decrypt,
10570/// and sign operations on a [CryptoKey][google.cloud.kms.v1.CryptoKey] or
10571/// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig]
10572/// (the default Key Access Justifications policy).
10573///
10574/// [google.cloud.kms.v1.AccessReason]: crate::model::AccessReason
10575/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10576/// [google.cloud.kms.v1.KeyAccessJustificationsPolicy]: crate::model::KeyAccessJustificationsPolicy
10577#[derive(Clone, Default, PartialEq)]
10578#[non_exhaustive]
10579pub struct KeyAccessJustificationsPolicy {
10580 /// The list of allowed reasons for access to a
10581 /// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Note that empty
10582 /// allowed_access_reasons has a different meaning depending on where this
10583 /// message appears. If this is under
10584 /// [KeyAccessJustificationsPolicyConfig][google.cloud.kms.v1.KeyAccessJustificationsPolicyConfig],
10585 /// it means allow-all. If this is under
10586 /// [CryptoKey][google.cloud.kms.v1.CryptoKey], it means deny-all.
10587 ///
10588 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10589 pub allowed_access_reasons: std::vec::Vec<crate::model::AccessReason>,
10590
10591 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10592}
10593
10594impl KeyAccessJustificationsPolicy {
10595 /// Creates a new default instance.
10596 pub fn new() -> Self {
10597 std::default::Default::default()
10598 }
10599
10600 /// Sets the value of [allowed_access_reasons][crate::model::KeyAccessJustificationsPolicy::allowed_access_reasons].
10601 ///
10602 /// # Example
10603 /// ```ignore,no_run
10604 /// # use google_cloud_kms_v1::model::KeyAccessJustificationsPolicy;
10605 /// use google_cloud_kms_v1::model::AccessReason;
10606 /// let x = KeyAccessJustificationsPolicy::new().set_allowed_access_reasons([
10607 /// AccessReason::CustomerInitiatedSupport,
10608 /// AccessReason::GoogleInitiatedService,
10609 /// AccessReason::ThirdPartyDataRequest,
10610 /// ]);
10611 /// ```
10612 pub fn set_allowed_access_reasons<T, V>(mut self, v: T) -> Self
10613 where
10614 T: std::iter::IntoIterator<Item = V>,
10615 V: std::convert::Into<crate::model::AccessReason>,
10616 {
10617 use std::iter::Iterator;
10618 self.allowed_access_reasons = v.into_iter().map(|i| i.into()).collect();
10619 self
10620 }
10621}
10622
10623impl wkt::message::Message for KeyAccessJustificationsPolicy {
10624 fn typename() -> &'static str {
10625 "type.googleapis.com/google.cloud.kms.v1.KeyAccessJustificationsPolicy"
10626 }
10627}
10628
10629/// A RetiredResource resource represents the record of a deleted
10630/// [CryptoKey][google.cloud.kms.v1.CryptoKey]. Its purpose is to provide
10631/// visibility into retained user data and to prevent reuse of these names for
10632/// new [CryptoKeys][google.cloud.kms.v1.CryptoKey].
10633///
10634/// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10635#[derive(Clone, Default, PartialEq)]
10636#[non_exhaustive]
10637pub struct RetiredResource {
10638 /// Output only. Identifier. The resource name for this
10639 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] in the format
10640 /// `projects/*/locations/*/retiredResources/*`.
10641 ///
10642 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
10643 pub name: std::string::String,
10644
10645 /// Output only. The full resource name of the original
10646 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] that was deleted in the format
10647 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
10648 ///
10649 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10650 pub original_resource: std::string::String,
10651
10652 /// Output only. The resource type of the original deleted resource.
10653 pub resource_type: std::string::String,
10654
10655 /// Output only. The time at which the original resource was deleted and this
10656 /// RetiredResource record was created.
10657 pub delete_time: std::option::Option<wkt::Timestamp>,
10658
10659 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10660}
10661
10662impl RetiredResource {
10663 /// Creates a new default instance.
10664 pub fn new() -> Self {
10665 std::default::Default::default()
10666 }
10667
10668 /// Sets the value of [name][crate::model::RetiredResource::name].
10669 ///
10670 /// # Example
10671 /// ```ignore,no_run
10672 /// # use google_cloud_kms_v1::model::RetiredResource;
10673 /// # let project_id = "project_id";
10674 /// # let location_id = "location_id";
10675 /// # let retired_resource_id = "retired_resource_id";
10676 /// let x = RetiredResource::new().set_name(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
10677 /// ```
10678 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10679 self.name = v.into();
10680 self
10681 }
10682
10683 /// Sets the value of [original_resource][crate::model::RetiredResource::original_resource].
10684 ///
10685 /// # Example
10686 /// ```ignore,no_run
10687 /// # use google_cloud_kms_v1::model::RetiredResource;
10688 /// let x = RetiredResource::new().set_original_resource("example");
10689 /// ```
10690 pub fn set_original_resource<T: std::convert::Into<std::string::String>>(
10691 mut self,
10692 v: T,
10693 ) -> Self {
10694 self.original_resource = v.into();
10695 self
10696 }
10697
10698 /// Sets the value of [resource_type][crate::model::RetiredResource::resource_type].
10699 ///
10700 /// # Example
10701 /// ```ignore,no_run
10702 /// # use google_cloud_kms_v1::model::RetiredResource;
10703 /// let x = RetiredResource::new().set_resource_type("example");
10704 /// ```
10705 pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10706 self.resource_type = v.into();
10707 self
10708 }
10709
10710 /// Sets the value of [delete_time][crate::model::RetiredResource::delete_time].
10711 ///
10712 /// # Example
10713 /// ```ignore,no_run
10714 /// # use google_cloud_kms_v1::model::RetiredResource;
10715 /// use wkt::Timestamp;
10716 /// let x = RetiredResource::new().set_delete_time(Timestamp::default()/* use setters */);
10717 /// ```
10718 pub fn set_delete_time<T>(mut self, v: T) -> Self
10719 where
10720 T: std::convert::Into<wkt::Timestamp>,
10721 {
10722 self.delete_time = std::option::Option::Some(v.into());
10723 self
10724 }
10725
10726 /// Sets or clears the value of [delete_time][crate::model::RetiredResource::delete_time].
10727 ///
10728 /// # Example
10729 /// ```ignore,no_run
10730 /// # use google_cloud_kms_v1::model::RetiredResource;
10731 /// use wkt::Timestamp;
10732 /// let x = RetiredResource::new().set_or_clear_delete_time(Some(Timestamp::default()/* use setters */));
10733 /// let x = RetiredResource::new().set_or_clear_delete_time(None::<Timestamp>);
10734 /// ```
10735 pub fn set_or_clear_delete_time<T>(mut self, v: std::option::Option<T>) -> Self
10736 where
10737 T: std::convert::Into<wkt::Timestamp>,
10738 {
10739 self.delete_time = v.map(|x| x.into());
10740 self
10741 }
10742}
10743
10744impl wkt::message::Message for RetiredResource {
10745 fn typename() -> &'static str {
10746 "type.googleapis.com/google.cloud.kms.v1.RetiredResource"
10747 }
10748}
10749
10750/// Request message for
10751/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
10752///
10753/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
10754#[derive(Clone, Default, PartialEq)]
10755#[non_exhaustive]
10756pub struct ListKeyRingsRequest {
10757 /// Required. The resource name of the location associated with the
10758 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
10759 /// `projects/*/locations/*`.
10760 ///
10761 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10762 pub parent: std::string::String,
10763
10764 /// Optional. Optional limit on the number of
10765 /// [KeyRings][google.cloud.kms.v1.KeyRing] to include in the response. Further
10766 /// [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by
10767 /// including the
10768 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]
10769 /// in a subsequent request. If unspecified, the server will pick an
10770 /// appropriate default.
10771 ///
10772 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10773 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10774 pub page_size: i32,
10775
10776 /// Optional. Optional pagination token, returned earlier via
10777 /// [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token].
10778 ///
10779 /// [google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]: crate::model::ListKeyRingsResponse::next_page_token
10780 pub page_token: std::string::String,
10781
10782 /// Optional. Only include resources that match the filter in the response. For
10783 /// more information, see
10784 /// [Sorting and filtering list
10785 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10786 pub filter: std::string::String,
10787
10788 /// Optional. Specify how the results should be sorted. If not specified, the
10789 /// results will be sorted in the default order. For more information, see
10790 /// [Sorting and filtering list
10791 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10792 pub order_by: std::string::String,
10793
10794 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10795}
10796
10797impl ListKeyRingsRequest {
10798 /// Creates a new default instance.
10799 pub fn new() -> Self {
10800 std::default::Default::default()
10801 }
10802
10803 /// Sets the value of [parent][crate::model::ListKeyRingsRequest::parent].
10804 ///
10805 /// # Example
10806 /// ```ignore,no_run
10807 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10808 /// let x = ListKeyRingsRequest::new().set_parent("example");
10809 /// ```
10810 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10811 self.parent = v.into();
10812 self
10813 }
10814
10815 /// Sets the value of [page_size][crate::model::ListKeyRingsRequest::page_size].
10816 ///
10817 /// # Example
10818 /// ```ignore,no_run
10819 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10820 /// let x = ListKeyRingsRequest::new().set_page_size(42);
10821 /// ```
10822 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10823 self.page_size = v.into();
10824 self
10825 }
10826
10827 /// Sets the value of [page_token][crate::model::ListKeyRingsRequest::page_token].
10828 ///
10829 /// # Example
10830 /// ```ignore,no_run
10831 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10832 /// let x = ListKeyRingsRequest::new().set_page_token("example");
10833 /// ```
10834 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10835 self.page_token = v.into();
10836 self
10837 }
10838
10839 /// Sets the value of [filter][crate::model::ListKeyRingsRequest::filter].
10840 ///
10841 /// # Example
10842 /// ```ignore,no_run
10843 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10844 /// let x = ListKeyRingsRequest::new().set_filter("example");
10845 /// ```
10846 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10847 self.filter = v.into();
10848 self
10849 }
10850
10851 /// Sets the value of [order_by][crate::model::ListKeyRingsRequest::order_by].
10852 ///
10853 /// # Example
10854 /// ```ignore,no_run
10855 /// # use google_cloud_kms_v1::model::ListKeyRingsRequest;
10856 /// let x = ListKeyRingsRequest::new().set_order_by("example");
10857 /// ```
10858 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10859 self.order_by = v.into();
10860 self
10861 }
10862}
10863
10864impl wkt::message::Message for ListKeyRingsRequest {
10865 fn typename() -> &'static str {
10866 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsRequest"
10867 }
10868}
10869
10870/// Request message for
10871/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
10872///
10873/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
10874#[derive(Clone, Default, PartialEq)]
10875#[non_exhaustive]
10876pub struct ListCryptoKeysRequest {
10877 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
10878 /// to list, in the format `projects/*/locations/*/keyRings/*`.
10879 ///
10880 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
10881 pub parent: std::string::String,
10882
10883 /// Optional. Optional limit on the number of
10884 /// [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the response.
10885 /// Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be
10886 /// obtained by including the
10887 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]
10888 /// in a subsequent request. If unspecified, the server will pick an
10889 /// appropriate default.
10890 ///
10891 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
10892 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10893 pub page_size: i32,
10894
10895 /// Optional. Optional pagination token, returned earlier via
10896 /// [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token].
10897 ///
10898 /// [google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]: crate::model::ListCryptoKeysResponse::next_page_token
10899 pub page_token: std::string::String,
10900
10901 /// The fields of the primary version to include in the response.
10902 pub version_view: crate::model::crypto_key_version::CryptoKeyVersionView,
10903
10904 /// Optional. Only include resources that match the filter in the response. For
10905 /// more information, see
10906 /// [Sorting and filtering list
10907 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10908 pub filter: std::string::String,
10909
10910 /// Optional. Specify how the results should be sorted. If not specified, the
10911 /// results will be sorted in the default order. For more information, see
10912 /// [Sorting and filtering list
10913 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
10914 pub order_by: std::string::String,
10915
10916 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10917}
10918
10919impl ListCryptoKeysRequest {
10920 /// Creates a new default instance.
10921 pub fn new() -> Self {
10922 std::default::Default::default()
10923 }
10924
10925 /// Sets the value of [parent][crate::model::ListCryptoKeysRequest::parent].
10926 ///
10927 /// # Example
10928 /// ```ignore,no_run
10929 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10930 /// # let project_id = "project_id";
10931 /// # let location_id = "location_id";
10932 /// # let key_ring_id = "key_ring_id";
10933 /// let x = ListCryptoKeysRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
10934 /// ```
10935 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10936 self.parent = v.into();
10937 self
10938 }
10939
10940 /// Sets the value of [page_size][crate::model::ListCryptoKeysRequest::page_size].
10941 ///
10942 /// # Example
10943 /// ```ignore,no_run
10944 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10945 /// let x = ListCryptoKeysRequest::new().set_page_size(42);
10946 /// ```
10947 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10948 self.page_size = v.into();
10949 self
10950 }
10951
10952 /// Sets the value of [page_token][crate::model::ListCryptoKeysRequest::page_token].
10953 ///
10954 /// # Example
10955 /// ```ignore,no_run
10956 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10957 /// let x = ListCryptoKeysRequest::new().set_page_token("example");
10958 /// ```
10959 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10960 self.page_token = v.into();
10961 self
10962 }
10963
10964 /// Sets the value of [version_view][crate::model::ListCryptoKeysRequest::version_view].
10965 ///
10966 /// # Example
10967 /// ```ignore,no_run
10968 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10969 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
10970 /// let x0 = ListCryptoKeysRequest::new().set_version_view(CryptoKeyVersionView::Full);
10971 /// ```
10972 pub fn set_version_view<
10973 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
10974 >(
10975 mut self,
10976 v: T,
10977 ) -> Self {
10978 self.version_view = v.into();
10979 self
10980 }
10981
10982 /// Sets the value of [filter][crate::model::ListCryptoKeysRequest::filter].
10983 ///
10984 /// # Example
10985 /// ```ignore,no_run
10986 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10987 /// let x = ListCryptoKeysRequest::new().set_filter("example");
10988 /// ```
10989 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10990 self.filter = v.into();
10991 self
10992 }
10993
10994 /// Sets the value of [order_by][crate::model::ListCryptoKeysRequest::order_by].
10995 ///
10996 /// # Example
10997 /// ```ignore,no_run
10998 /// # use google_cloud_kms_v1::model::ListCryptoKeysRequest;
10999 /// let x = ListCryptoKeysRequest::new().set_order_by("example");
11000 /// ```
11001 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11002 self.order_by = v.into();
11003 self
11004 }
11005}
11006
11007impl wkt::message::Message for ListCryptoKeysRequest {
11008 fn typename() -> &'static str {
11009 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysRequest"
11010 }
11011}
11012
11013/// Request message for
11014/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11015///
11016/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11017#[derive(Clone, Default, PartialEq)]
11018#[non_exhaustive]
11019pub struct ListCryptoKeyVersionsRequest {
11020 /// Required. The resource name of the
11021 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format
11022 /// `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
11023 ///
11024 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11025 pub parent: std::string::String,
11026
11027 /// Optional. Optional limit on the number of
11028 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to include in the
11029 /// response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]
11030 /// can subsequently be obtained by including the
11031 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]
11032 /// in a subsequent request. If unspecified, the server will pick an
11033 /// appropriate default.
11034 ///
11035 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11036 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
11037 pub page_size: i32,
11038
11039 /// Optional. Optional pagination token, returned earlier via
11040 /// [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token].
11041 ///
11042 /// [google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]: crate::model::ListCryptoKeyVersionsResponse::next_page_token
11043 pub page_token: std::string::String,
11044
11045 /// The fields to include in the response.
11046 pub view: crate::model::crypto_key_version::CryptoKeyVersionView,
11047
11048 /// Optional. Only include resources that match the filter in the response. For
11049 /// more information, see
11050 /// [Sorting and filtering list
11051 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11052 pub filter: std::string::String,
11053
11054 /// Optional. Specify how the results should be sorted. If not specified, the
11055 /// results will be sorted in the default order. For more information, see
11056 /// [Sorting and filtering list
11057 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11058 pub order_by: std::string::String,
11059
11060 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11061}
11062
11063impl ListCryptoKeyVersionsRequest {
11064 /// Creates a new default instance.
11065 pub fn new() -> Self {
11066 std::default::Default::default()
11067 }
11068
11069 /// Sets the value of [parent][crate::model::ListCryptoKeyVersionsRequest::parent].
11070 ///
11071 /// # Example
11072 /// ```ignore,no_run
11073 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11074 /// # let project_id = "project_id";
11075 /// # let location_id = "location_id";
11076 /// # let key_ring_id = "key_ring_id";
11077 /// # let crypto_key_id = "crypto_key_id";
11078 /// let x = ListCryptoKeyVersionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
11079 /// ```
11080 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11081 self.parent = v.into();
11082 self
11083 }
11084
11085 /// Sets the value of [page_size][crate::model::ListCryptoKeyVersionsRequest::page_size].
11086 ///
11087 /// # Example
11088 /// ```ignore,no_run
11089 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11090 /// let x = ListCryptoKeyVersionsRequest::new().set_page_size(42);
11091 /// ```
11092 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11093 self.page_size = v.into();
11094 self
11095 }
11096
11097 /// Sets the value of [page_token][crate::model::ListCryptoKeyVersionsRequest::page_token].
11098 ///
11099 /// # Example
11100 /// ```ignore,no_run
11101 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11102 /// let x = ListCryptoKeyVersionsRequest::new().set_page_token("example");
11103 /// ```
11104 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11105 self.page_token = v.into();
11106 self
11107 }
11108
11109 /// Sets the value of [view][crate::model::ListCryptoKeyVersionsRequest::view].
11110 ///
11111 /// # Example
11112 /// ```ignore,no_run
11113 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11114 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionView;
11115 /// let x0 = ListCryptoKeyVersionsRequest::new().set_view(CryptoKeyVersionView::Full);
11116 /// ```
11117 pub fn set_view<
11118 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionView>,
11119 >(
11120 mut self,
11121 v: T,
11122 ) -> Self {
11123 self.view = v.into();
11124 self
11125 }
11126
11127 /// Sets the value of [filter][crate::model::ListCryptoKeyVersionsRequest::filter].
11128 ///
11129 /// # Example
11130 /// ```ignore,no_run
11131 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11132 /// let x = ListCryptoKeyVersionsRequest::new().set_filter("example");
11133 /// ```
11134 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11135 self.filter = v.into();
11136 self
11137 }
11138
11139 /// Sets the value of [order_by][crate::model::ListCryptoKeyVersionsRequest::order_by].
11140 ///
11141 /// # Example
11142 /// ```ignore,no_run
11143 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsRequest;
11144 /// let x = ListCryptoKeyVersionsRequest::new().set_order_by("example");
11145 /// ```
11146 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11147 self.order_by = v.into();
11148 self
11149 }
11150}
11151
11152impl wkt::message::Message for ListCryptoKeyVersionsRequest {
11153 fn typename() -> &'static str {
11154 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsRequest"
11155 }
11156}
11157
11158/// Request message for
11159/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11160///
11161/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11162#[derive(Clone, Default, PartialEq)]
11163#[non_exhaustive]
11164pub struct ListImportJobsRequest {
11165 /// Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing]
11166 /// to list, in the format `projects/*/locations/*/keyRings/*`.
11167 ///
11168 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11169 pub parent: std::string::String,
11170
11171 /// Optional. Optional limit on the number of
11172 /// [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the response.
11173 /// Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be
11174 /// obtained by including the
11175 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]
11176 /// in a subsequent request. If unspecified, the server will pick an
11177 /// appropriate default.
11178 ///
11179 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11180 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11181 pub page_size: i32,
11182
11183 /// Optional. Optional pagination token, returned earlier via
11184 /// [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token].
11185 ///
11186 /// [google.cloud.kms.v1.ListImportJobsResponse.next_page_token]: crate::model::ListImportJobsResponse::next_page_token
11187 pub page_token: std::string::String,
11188
11189 /// Optional. Only include resources that match the filter in the response. For
11190 /// more information, see
11191 /// [Sorting and filtering list
11192 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11193 pub filter: std::string::String,
11194
11195 /// Optional. Specify how the results should be sorted. If not specified, the
11196 /// results will be sorted in the default order. For more information, see
11197 /// [Sorting and filtering list
11198 /// results](https://cloud.google.com/kms/docs/sorting-and-filtering).
11199 pub order_by: std::string::String,
11200
11201 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11202}
11203
11204impl ListImportJobsRequest {
11205 /// Creates a new default instance.
11206 pub fn new() -> Self {
11207 std::default::Default::default()
11208 }
11209
11210 /// Sets the value of [parent][crate::model::ListImportJobsRequest::parent].
11211 ///
11212 /// # Example
11213 /// ```ignore,no_run
11214 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11215 /// # let project_id = "project_id";
11216 /// # let location_id = "location_id";
11217 /// # let key_ring_id = "key_ring_id";
11218 /// let x = ListImportJobsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
11219 /// ```
11220 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11221 self.parent = v.into();
11222 self
11223 }
11224
11225 /// Sets the value of [page_size][crate::model::ListImportJobsRequest::page_size].
11226 ///
11227 /// # Example
11228 /// ```ignore,no_run
11229 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11230 /// let x = ListImportJobsRequest::new().set_page_size(42);
11231 /// ```
11232 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11233 self.page_size = v.into();
11234 self
11235 }
11236
11237 /// Sets the value of [page_token][crate::model::ListImportJobsRequest::page_token].
11238 ///
11239 /// # Example
11240 /// ```ignore,no_run
11241 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11242 /// let x = ListImportJobsRequest::new().set_page_token("example");
11243 /// ```
11244 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11245 self.page_token = v.into();
11246 self
11247 }
11248
11249 /// Sets the value of [filter][crate::model::ListImportJobsRequest::filter].
11250 ///
11251 /// # Example
11252 /// ```ignore,no_run
11253 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11254 /// let x = ListImportJobsRequest::new().set_filter("example");
11255 /// ```
11256 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11257 self.filter = v.into();
11258 self
11259 }
11260
11261 /// Sets the value of [order_by][crate::model::ListImportJobsRequest::order_by].
11262 ///
11263 /// # Example
11264 /// ```ignore,no_run
11265 /// # use google_cloud_kms_v1::model::ListImportJobsRequest;
11266 /// let x = ListImportJobsRequest::new().set_order_by("example");
11267 /// ```
11268 pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11269 self.order_by = v.into();
11270 self
11271 }
11272}
11273
11274impl wkt::message::Message for ListImportJobsRequest {
11275 fn typename() -> &'static str {
11276 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsRequest"
11277 }
11278}
11279
11280/// Request message for
11281/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11282///
11283/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11284#[derive(Clone, Default, PartialEq)]
11285#[non_exhaustive]
11286pub struct ListRetiredResourcesRequest {
11287 /// Required. The project-specific location holding the
11288 /// [RetiredResources][google.cloud.kms.v1.RetiredResource], in the format
11289 /// `projects/*/locations/*`.
11290 ///
11291 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11292 pub parent: std::string::String,
11293
11294 /// Optional. Optional limit on the number of
11295 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] to be included in
11296 /// the response. Further
11297 /// [RetiredResources][google.cloud.kms.v1.RetiredResource] can subsequently be
11298 /// obtained by including the
11299 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]
11300 /// in a subsequent request. If unspecified, the server will pick an
11301 /// appropriate default.
11302 ///
11303 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11304 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11305 pub page_size: i32,
11306
11307 /// Optional. Optional pagination token, returned earlier via
11308 /// [ListRetiredResourcesResponse.next_page_token][google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token].
11309 ///
11310 /// [google.cloud.kms.v1.ListRetiredResourcesResponse.next_page_token]: crate::model::ListRetiredResourcesResponse::next_page_token
11311 pub page_token: std::string::String,
11312
11313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11314}
11315
11316impl ListRetiredResourcesRequest {
11317 /// Creates a new default instance.
11318 pub fn new() -> Self {
11319 std::default::Default::default()
11320 }
11321
11322 /// Sets the value of [parent][crate::model::ListRetiredResourcesRequest::parent].
11323 ///
11324 /// # Example
11325 /// ```ignore,no_run
11326 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11327 /// # let project_id = "project_id";
11328 /// # let location_id = "location_id";
11329 /// let x = ListRetiredResourcesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
11330 /// ```
11331 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11332 self.parent = v.into();
11333 self
11334 }
11335
11336 /// Sets the value of [page_size][crate::model::ListRetiredResourcesRequest::page_size].
11337 ///
11338 /// # Example
11339 /// ```ignore,no_run
11340 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11341 /// let x = ListRetiredResourcesRequest::new().set_page_size(42);
11342 /// ```
11343 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11344 self.page_size = v.into();
11345 self
11346 }
11347
11348 /// Sets the value of [page_token][crate::model::ListRetiredResourcesRequest::page_token].
11349 ///
11350 /// # Example
11351 /// ```ignore,no_run
11352 /// # use google_cloud_kms_v1::model::ListRetiredResourcesRequest;
11353 /// let x = ListRetiredResourcesRequest::new().set_page_token("example");
11354 /// ```
11355 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11356 self.page_token = v.into();
11357 self
11358 }
11359}
11360
11361impl wkt::message::Message for ListRetiredResourcesRequest {
11362 fn typename() -> &'static str {
11363 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesRequest"
11364 }
11365}
11366
11367/// Response message for
11368/// [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings].
11369///
11370/// [google.cloud.kms.v1.KeyManagementService.ListKeyRings]: crate::client::KeyManagementService::list_key_rings
11371#[derive(Clone, Default, PartialEq)]
11372#[non_exhaustive]
11373pub struct ListKeyRingsResponse {
11374 /// The list of [KeyRings][google.cloud.kms.v1.KeyRing].
11375 ///
11376 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11377 pub key_rings: std::vec::Vec<crate::model::KeyRing>,
11378
11379 /// A token to retrieve next page of results. Pass this value in
11380 /// [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token]
11381 /// to retrieve the next page of results.
11382 ///
11383 /// [google.cloud.kms.v1.ListKeyRingsRequest.page_token]: crate::model::ListKeyRingsRequest::page_token
11384 pub next_page_token: std::string::String,
11385
11386 /// The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched
11387 /// the query.
11388 ///
11389 /// This field is not populated if
11390 /// [ListKeyRingsRequest.filter][google.cloud.kms.v1.ListKeyRingsRequest.filter]
11391 /// is applied.
11392 ///
11393 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11394 /// [google.cloud.kms.v1.ListKeyRingsRequest.filter]: crate::model::ListKeyRingsRequest::filter
11395 pub total_size: i32,
11396
11397 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11398}
11399
11400impl ListKeyRingsResponse {
11401 /// Creates a new default instance.
11402 pub fn new() -> Self {
11403 std::default::Default::default()
11404 }
11405
11406 /// Sets the value of [key_rings][crate::model::ListKeyRingsResponse::key_rings].
11407 ///
11408 /// # Example
11409 /// ```ignore,no_run
11410 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11411 /// use google_cloud_kms_v1::model::KeyRing;
11412 /// let x = ListKeyRingsResponse::new()
11413 /// .set_key_rings([
11414 /// KeyRing::default()/* use setters */,
11415 /// KeyRing::default()/* use (different) setters */,
11416 /// ]);
11417 /// ```
11418 pub fn set_key_rings<T, V>(mut self, v: T) -> Self
11419 where
11420 T: std::iter::IntoIterator<Item = V>,
11421 V: std::convert::Into<crate::model::KeyRing>,
11422 {
11423 use std::iter::Iterator;
11424 self.key_rings = v.into_iter().map(|i| i.into()).collect();
11425 self
11426 }
11427
11428 /// Sets the value of [next_page_token][crate::model::ListKeyRingsResponse::next_page_token].
11429 ///
11430 /// # Example
11431 /// ```ignore,no_run
11432 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11433 /// let x = ListKeyRingsResponse::new().set_next_page_token("example");
11434 /// ```
11435 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11436 self.next_page_token = v.into();
11437 self
11438 }
11439
11440 /// Sets the value of [total_size][crate::model::ListKeyRingsResponse::total_size].
11441 ///
11442 /// # Example
11443 /// ```ignore,no_run
11444 /// # use google_cloud_kms_v1::model::ListKeyRingsResponse;
11445 /// let x = ListKeyRingsResponse::new().set_total_size(42);
11446 /// ```
11447 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11448 self.total_size = v.into();
11449 self
11450 }
11451}
11452
11453impl wkt::message::Message for ListKeyRingsResponse {
11454 fn typename() -> &'static str {
11455 "type.googleapis.com/google.cloud.kms.v1.ListKeyRingsResponse"
11456 }
11457}
11458
11459#[doc(hidden)]
11460impl google_cloud_gax::paginator::internal::PageableResponse for ListKeyRingsResponse {
11461 type PageItem = crate::model::KeyRing;
11462
11463 fn items(self) -> std::vec::Vec<Self::PageItem> {
11464 self.key_rings
11465 }
11466
11467 fn next_page_token(&self) -> std::string::String {
11468 use std::clone::Clone;
11469 self.next_page_token.clone()
11470 }
11471}
11472
11473/// Response message for
11474/// [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys].
11475///
11476/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]: crate::client::KeyManagementService::list_crypto_keys
11477#[derive(Clone, Default, PartialEq)]
11478#[non_exhaustive]
11479pub struct ListCryptoKeysResponse {
11480 /// The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey].
11481 ///
11482 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11483 pub crypto_keys: std::vec::Vec<crate::model::CryptoKey>,
11484
11485 /// A token to retrieve next page of results. Pass this value in
11486 /// [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token]
11487 /// to retrieve the next page of results.
11488 ///
11489 /// [google.cloud.kms.v1.ListCryptoKeysRequest.page_token]: crate::model::ListCryptoKeysRequest::page_token
11490 pub next_page_token: std::string::String,
11491
11492 /// The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that
11493 /// matched the query.
11494 ///
11495 /// This field is not populated if
11496 /// [ListCryptoKeysRequest.filter][google.cloud.kms.v1.ListCryptoKeysRequest.filter]
11497 /// is applied.
11498 ///
11499 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11500 /// [google.cloud.kms.v1.ListCryptoKeysRequest.filter]: crate::model::ListCryptoKeysRequest::filter
11501 pub total_size: i32,
11502
11503 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11504}
11505
11506impl ListCryptoKeysResponse {
11507 /// Creates a new default instance.
11508 pub fn new() -> Self {
11509 std::default::Default::default()
11510 }
11511
11512 /// Sets the value of [crypto_keys][crate::model::ListCryptoKeysResponse::crypto_keys].
11513 ///
11514 /// # Example
11515 /// ```ignore,no_run
11516 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11517 /// use google_cloud_kms_v1::model::CryptoKey;
11518 /// let x = ListCryptoKeysResponse::new()
11519 /// .set_crypto_keys([
11520 /// CryptoKey::default()/* use setters */,
11521 /// CryptoKey::default()/* use (different) setters */,
11522 /// ]);
11523 /// ```
11524 pub fn set_crypto_keys<T, V>(mut self, v: T) -> Self
11525 where
11526 T: std::iter::IntoIterator<Item = V>,
11527 V: std::convert::Into<crate::model::CryptoKey>,
11528 {
11529 use std::iter::Iterator;
11530 self.crypto_keys = v.into_iter().map(|i| i.into()).collect();
11531 self
11532 }
11533
11534 /// Sets the value of [next_page_token][crate::model::ListCryptoKeysResponse::next_page_token].
11535 ///
11536 /// # Example
11537 /// ```ignore,no_run
11538 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11539 /// let x = ListCryptoKeysResponse::new().set_next_page_token("example");
11540 /// ```
11541 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11542 self.next_page_token = v.into();
11543 self
11544 }
11545
11546 /// Sets the value of [total_size][crate::model::ListCryptoKeysResponse::total_size].
11547 ///
11548 /// # Example
11549 /// ```ignore,no_run
11550 /// # use google_cloud_kms_v1::model::ListCryptoKeysResponse;
11551 /// let x = ListCryptoKeysResponse::new().set_total_size(42);
11552 /// ```
11553 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11554 self.total_size = v.into();
11555 self
11556 }
11557}
11558
11559impl wkt::message::Message for ListCryptoKeysResponse {
11560 fn typename() -> &'static str {
11561 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeysResponse"
11562 }
11563}
11564
11565#[doc(hidden)]
11566impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeysResponse {
11567 type PageItem = crate::model::CryptoKey;
11568
11569 fn items(self) -> std::vec::Vec<Self::PageItem> {
11570 self.crypto_keys
11571 }
11572
11573 fn next_page_token(&self) -> std::string::String {
11574 use std::clone::Clone;
11575 self.next_page_token.clone()
11576 }
11577}
11578
11579/// Response message for
11580/// [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions].
11581///
11582/// [google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]: crate::client::KeyManagementService::list_crypto_key_versions
11583#[derive(Clone, Default, PartialEq)]
11584#[non_exhaustive]
11585pub struct ListCryptoKeyVersionsResponse {
11586 /// The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
11587 ///
11588 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11589 pub crypto_key_versions: std::vec::Vec<crate::model::CryptoKeyVersion>,
11590
11591 /// A token to retrieve next page of results. Pass this value in
11592 /// [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]
11593 /// to retrieve the next page of results.
11594 ///
11595 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token]: crate::model::ListCryptoKeyVersionsRequest::page_token
11596 pub next_page_token: std::string::String,
11597
11598 /// The total number of
11599 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the
11600 /// query.
11601 ///
11602 /// This field is not populated if
11603 /// [ListCryptoKeyVersionsRequest.filter][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]
11604 /// is applied.
11605 ///
11606 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11607 /// [google.cloud.kms.v1.ListCryptoKeyVersionsRequest.filter]: crate::model::ListCryptoKeyVersionsRequest::filter
11608 pub total_size: i32,
11609
11610 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11611}
11612
11613impl ListCryptoKeyVersionsResponse {
11614 /// Creates a new default instance.
11615 pub fn new() -> Self {
11616 std::default::Default::default()
11617 }
11618
11619 /// Sets the value of [crypto_key_versions][crate::model::ListCryptoKeyVersionsResponse::crypto_key_versions].
11620 ///
11621 /// # Example
11622 /// ```ignore,no_run
11623 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11624 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
11625 /// let x = ListCryptoKeyVersionsResponse::new()
11626 /// .set_crypto_key_versions([
11627 /// CryptoKeyVersion::default()/* use setters */,
11628 /// CryptoKeyVersion::default()/* use (different) setters */,
11629 /// ]);
11630 /// ```
11631 pub fn set_crypto_key_versions<T, V>(mut self, v: T) -> Self
11632 where
11633 T: std::iter::IntoIterator<Item = V>,
11634 V: std::convert::Into<crate::model::CryptoKeyVersion>,
11635 {
11636 use std::iter::Iterator;
11637 self.crypto_key_versions = v.into_iter().map(|i| i.into()).collect();
11638 self
11639 }
11640
11641 /// Sets the value of [next_page_token][crate::model::ListCryptoKeyVersionsResponse::next_page_token].
11642 ///
11643 /// # Example
11644 /// ```ignore,no_run
11645 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11646 /// let x = ListCryptoKeyVersionsResponse::new().set_next_page_token("example");
11647 /// ```
11648 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11649 self.next_page_token = v.into();
11650 self
11651 }
11652
11653 /// Sets the value of [total_size][crate::model::ListCryptoKeyVersionsResponse::total_size].
11654 ///
11655 /// # Example
11656 /// ```ignore,no_run
11657 /// # use google_cloud_kms_v1::model::ListCryptoKeyVersionsResponse;
11658 /// let x = ListCryptoKeyVersionsResponse::new().set_total_size(42);
11659 /// ```
11660 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11661 self.total_size = v.into();
11662 self
11663 }
11664}
11665
11666impl wkt::message::Message for ListCryptoKeyVersionsResponse {
11667 fn typename() -> &'static str {
11668 "type.googleapis.com/google.cloud.kms.v1.ListCryptoKeyVersionsResponse"
11669 }
11670}
11671
11672#[doc(hidden)]
11673impl google_cloud_gax::paginator::internal::PageableResponse for ListCryptoKeyVersionsResponse {
11674 type PageItem = crate::model::CryptoKeyVersion;
11675
11676 fn items(self) -> std::vec::Vec<Self::PageItem> {
11677 self.crypto_key_versions
11678 }
11679
11680 fn next_page_token(&self) -> std::string::String {
11681 use std::clone::Clone;
11682 self.next_page_token.clone()
11683 }
11684}
11685
11686/// Response message for
11687/// [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs].
11688///
11689/// [google.cloud.kms.v1.KeyManagementService.ListImportJobs]: crate::client::KeyManagementService::list_import_jobs
11690#[derive(Clone, Default, PartialEq)]
11691#[non_exhaustive]
11692pub struct ListImportJobsResponse {
11693 /// The list of [ImportJobs][google.cloud.kms.v1.ImportJob].
11694 ///
11695 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11696 pub import_jobs: std::vec::Vec<crate::model::ImportJob>,
11697
11698 /// A token to retrieve next page of results. Pass this value in
11699 /// [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token]
11700 /// to retrieve the next page of results.
11701 ///
11702 /// [google.cloud.kms.v1.ListImportJobsRequest.page_token]: crate::model::ListImportJobsRequest::page_token
11703 pub next_page_token: std::string::String,
11704
11705 /// The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that
11706 /// matched the query.
11707 ///
11708 /// This field is not populated if
11709 /// [ListImportJobsRequest.filter][google.cloud.kms.v1.ListImportJobsRequest.filter]
11710 /// is applied.
11711 ///
11712 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
11713 /// [google.cloud.kms.v1.ListImportJobsRequest.filter]: crate::model::ListImportJobsRequest::filter
11714 pub total_size: i32,
11715
11716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11717}
11718
11719impl ListImportJobsResponse {
11720 /// Creates a new default instance.
11721 pub fn new() -> Self {
11722 std::default::Default::default()
11723 }
11724
11725 /// Sets the value of [import_jobs][crate::model::ListImportJobsResponse::import_jobs].
11726 ///
11727 /// # Example
11728 /// ```ignore,no_run
11729 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11730 /// use google_cloud_kms_v1::model::ImportJob;
11731 /// let x = ListImportJobsResponse::new()
11732 /// .set_import_jobs([
11733 /// ImportJob::default()/* use setters */,
11734 /// ImportJob::default()/* use (different) setters */,
11735 /// ]);
11736 /// ```
11737 pub fn set_import_jobs<T, V>(mut self, v: T) -> Self
11738 where
11739 T: std::iter::IntoIterator<Item = V>,
11740 V: std::convert::Into<crate::model::ImportJob>,
11741 {
11742 use std::iter::Iterator;
11743 self.import_jobs = v.into_iter().map(|i| i.into()).collect();
11744 self
11745 }
11746
11747 /// Sets the value of [next_page_token][crate::model::ListImportJobsResponse::next_page_token].
11748 ///
11749 /// # Example
11750 /// ```ignore,no_run
11751 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11752 /// let x = ListImportJobsResponse::new().set_next_page_token("example");
11753 /// ```
11754 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11755 self.next_page_token = v.into();
11756 self
11757 }
11758
11759 /// Sets the value of [total_size][crate::model::ListImportJobsResponse::total_size].
11760 ///
11761 /// # Example
11762 /// ```ignore,no_run
11763 /// # use google_cloud_kms_v1::model::ListImportJobsResponse;
11764 /// let x = ListImportJobsResponse::new().set_total_size(42);
11765 /// ```
11766 pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11767 self.total_size = v.into();
11768 self
11769 }
11770}
11771
11772impl wkt::message::Message for ListImportJobsResponse {
11773 fn typename() -> &'static str {
11774 "type.googleapis.com/google.cloud.kms.v1.ListImportJobsResponse"
11775 }
11776}
11777
11778#[doc(hidden)]
11779impl google_cloud_gax::paginator::internal::PageableResponse for ListImportJobsResponse {
11780 type PageItem = crate::model::ImportJob;
11781
11782 fn items(self) -> std::vec::Vec<Self::PageItem> {
11783 self.import_jobs
11784 }
11785
11786 fn next_page_token(&self) -> std::string::String {
11787 use std::clone::Clone;
11788 self.next_page_token.clone()
11789 }
11790}
11791
11792/// Response message for
11793/// [KeyManagementService.ListRetiredResources][google.cloud.kms.v1.KeyManagementService.ListRetiredResources].
11794///
11795/// [google.cloud.kms.v1.KeyManagementService.ListRetiredResources]: crate::client::KeyManagementService::list_retired_resources
11796#[derive(Clone, Default, PartialEq)]
11797#[non_exhaustive]
11798pub struct ListRetiredResourcesResponse {
11799 /// The list of [RetiredResources][google.cloud.kms.v1.RetiredResource].
11800 ///
11801 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11802 pub retired_resources: std::vec::Vec<crate::model::RetiredResource>,
11803
11804 /// A token to retrieve the next page of results. Pass this value in
11805 /// [ListRetiredResourcesRequest.page_token][google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]
11806 /// to retrieve the next page of results.
11807 ///
11808 /// [google.cloud.kms.v1.ListRetiredResourcesRequest.page_token]: crate::model::ListRetiredResourcesRequest::page_token
11809 pub next_page_token: std::string::String,
11810
11811 /// The total number of [RetiredResources][google.cloud.kms.v1.RetiredResource]
11812 /// that matched the query.
11813 ///
11814 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
11815 pub total_size: i64,
11816
11817 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11818}
11819
11820impl ListRetiredResourcesResponse {
11821 /// Creates a new default instance.
11822 pub fn new() -> Self {
11823 std::default::Default::default()
11824 }
11825
11826 /// Sets the value of [retired_resources][crate::model::ListRetiredResourcesResponse::retired_resources].
11827 ///
11828 /// # Example
11829 /// ```ignore,no_run
11830 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11831 /// use google_cloud_kms_v1::model::RetiredResource;
11832 /// let x = ListRetiredResourcesResponse::new()
11833 /// .set_retired_resources([
11834 /// RetiredResource::default()/* use setters */,
11835 /// RetiredResource::default()/* use (different) setters */,
11836 /// ]);
11837 /// ```
11838 pub fn set_retired_resources<T, V>(mut self, v: T) -> Self
11839 where
11840 T: std::iter::IntoIterator<Item = V>,
11841 V: std::convert::Into<crate::model::RetiredResource>,
11842 {
11843 use std::iter::Iterator;
11844 self.retired_resources = v.into_iter().map(|i| i.into()).collect();
11845 self
11846 }
11847
11848 /// Sets the value of [next_page_token][crate::model::ListRetiredResourcesResponse::next_page_token].
11849 ///
11850 /// # Example
11851 /// ```ignore,no_run
11852 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11853 /// let x = ListRetiredResourcesResponse::new().set_next_page_token("example");
11854 /// ```
11855 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11856 self.next_page_token = v.into();
11857 self
11858 }
11859
11860 /// Sets the value of [total_size][crate::model::ListRetiredResourcesResponse::total_size].
11861 ///
11862 /// # Example
11863 /// ```ignore,no_run
11864 /// # use google_cloud_kms_v1::model::ListRetiredResourcesResponse;
11865 /// let x = ListRetiredResourcesResponse::new().set_total_size(42);
11866 /// ```
11867 pub fn set_total_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
11868 self.total_size = v.into();
11869 self
11870 }
11871}
11872
11873impl wkt::message::Message for ListRetiredResourcesResponse {
11874 fn typename() -> &'static str {
11875 "type.googleapis.com/google.cloud.kms.v1.ListRetiredResourcesResponse"
11876 }
11877}
11878
11879#[doc(hidden)]
11880impl google_cloud_gax::paginator::internal::PageableResponse for ListRetiredResourcesResponse {
11881 type PageItem = crate::model::RetiredResource;
11882
11883 fn items(self) -> std::vec::Vec<Self::PageItem> {
11884 self.retired_resources
11885 }
11886
11887 fn next_page_token(&self) -> std::string::String {
11888 use std::clone::Clone;
11889 self.next_page_token.clone()
11890 }
11891}
11892
11893/// Request message for
11894/// [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing].
11895///
11896/// [google.cloud.kms.v1.KeyManagementService.GetKeyRing]: crate::client::KeyManagementService::get_key_ring
11897#[derive(Clone, Default, PartialEq)]
11898#[non_exhaustive]
11899pub struct GetKeyRingRequest {
11900 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
11901 /// [KeyRing][google.cloud.kms.v1.KeyRing] to get.
11902 ///
11903 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
11904 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
11905 pub name: std::string::String,
11906
11907 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11908}
11909
11910impl GetKeyRingRequest {
11911 /// Creates a new default instance.
11912 pub fn new() -> Self {
11913 std::default::Default::default()
11914 }
11915
11916 /// Sets the value of [name][crate::model::GetKeyRingRequest::name].
11917 ///
11918 /// # Example
11919 /// ```ignore,no_run
11920 /// # use google_cloud_kms_v1::model::GetKeyRingRequest;
11921 /// # let project_id = "project_id";
11922 /// # let location_id = "location_id";
11923 /// # let key_ring_id = "key_ring_id";
11924 /// let x = GetKeyRingRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
11925 /// ```
11926 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11927 self.name = v.into();
11928 self
11929 }
11930}
11931
11932impl wkt::message::Message for GetKeyRingRequest {
11933 fn typename() -> &'static str {
11934 "type.googleapis.com/google.cloud.kms.v1.GetKeyRingRequest"
11935 }
11936}
11937
11938/// Request message for
11939/// [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey].
11940///
11941/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKey]: crate::client::KeyManagementService::get_crypto_key
11942#[derive(Clone, Default, PartialEq)]
11943#[non_exhaustive]
11944pub struct GetCryptoKeyRequest {
11945 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
11946 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.
11947 ///
11948 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
11949 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
11950 pub name: std::string::String,
11951
11952 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11953}
11954
11955impl GetCryptoKeyRequest {
11956 /// Creates a new default instance.
11957 pub fn new() -> Self {
11958 std::default::Default::default()
11959 }
11960
11961 /// Sets the value of [name][crate::model::GetCryptoKeyRequest::name].
11962 ///
11963 /// # Example
11964 /// ```ignore,no_run
11965 /// # use google_cloud_kms_v1::model::GetCryptoKeyRequest;
11966 /// # let project_id = "project_id";
11967 /// # let location_id = "location_id";
11968 /// # let key_ring_id = "key_ring_id";
11969 /// # let crypto_key_id = "crypto_key_id";
11970 /// let x = GetCryptoKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
11971 /// ```
11972 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11973 self.name = v.into();
11974 self
11975 }
11976}
11977
11978impl wkt::message::Message for GetCryptoKeyRequest {
11979 fn typename() -> &'static str {
11980 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyRequest"
11981 }
11982}
11983
11984/// Request message for
11985/// [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion].
11986///
11987/// [google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]: crate::client::KeyManagementService::get_crypto_key_version
11988#[derive(Clone, Default, PartialEq)]
11989#[non_exhaustive]
11990pub struct GetCryptoKeyVersionRequest {
11991 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
11992 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.
11993 ///
11994 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
11995 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
11996 pub name: std::string::String,
11997
11998 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11999}
12000
12001impl GetCryptoKeyVersionRequest {
12002 /// Creates a new default instance.
12003 pub fn new() -> Self {
12004 std::default::Default::default()
12005 }
12006
12007 /// Sets the value of [name][crate::model::GetCryptoKeyVersionRequest::name].
12008 ///
12009 /// # Example
12010 /// ```ignore,no_run
12011 /// # use google_cloud_kms_v1::model::GetCryptoKeyVersionRequest;
12012 /// # let project_id = "project_id";
12013 /// # let location_id = "location_id";
12014 /// # let key_ring_id = "key_ring_id";
12015 /// # let crypto_key_id = "crypto_key_id";
12016 /// # let crypto_key_version_id = "crypto_key_version_id";
12017 /// let x = GetCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12018 /// ```
12019 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12020 self.name = v.into();
12021 self
12022 }
12023}
12024
12025impl wkt::message::Message for GetCryptoKeyVersionRequest {
12026 fn typename() -> &'static str {
12027 "type.googleapis.com/google.cloud.kms.v1.GetCryptoKeyVersionRequest"
12028 }
12029}
12030
12031/// Request message for
12032/// [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].
12033///
12034/// [google.cloud.kms.v1.KeyManagementService.GetPublicKey]: crate::client::KeyManagementService::get_public_key
12035#[derive(Clone, Default, PartialEq)]
12036#[non_exhaustive]
12037pub struct GetPublicKeyRequest {
12038 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12039 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.
12040 ///
12041 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12042 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12043 pub name: std::string::String,
12044
12045 /// Optional. The [PublicKey][google.cloud.kms.v1.PublicKey] format specified
12046 /// by the user. This field is required for PQC algorithms. If specified, the
12047 /// public key will be exported through the
12048 /// [public_key][google.cloud.kms.v1.PublicKey.public_key] field in the
12049 /// requested format. Otherwise, the [pem][google.cloud.kms.v1.PublicKey.pem]
12050 /// field will be populated for non-PQC algorithms, and an error will be
12051 /// returned for PQC algorithms.
12052 ///
12053 /// [google.cloud.kms.v1.PublicKey]: crate::model::PublicKey
12054 /// [google.cloud.kms.v1.PublicKey.pem]: crate::model::PublicKey::pem
12055 /// [google.cloud.kms.v1.PublicKey.public_key]: crate::model::PublicKey::public_key
12056 pub public_key_format: crate::model::public_key::PublicKeyFormat,
12057
12058 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12059}
12060
12061impl GetPublicKeyRequest {
12062 /// Creates a new default instance.
12063 pub fn new() -> Self {
12064 std::default::Default::default()
12065 }
12066
12067 /// Sets the value of [name][crate::model::GetPublicKeyRequest::name].
12068 ///
12069 /// # Example
12070 /// ```ignore,no_run
12071 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
12072 /// # let project_id = "project_id";
12073 /// # let location_id = "location_id";
12074 /// # let key_ring_id = "key_ring_id";
12075 /// # let crypto_key_id = "crypto_key_id";
12076 /// # let crypto_key_version_id = "crypto_key_version_id";
12077 /// let x = GetPublicKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12078 /// ```
12079 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12080 self.name = v.into();
12081 self
12082 }
12083
12084 /// Sets the value of [public_key_format][crate::model::GetPublicKeyRequest::public_key_format].
12085 ///
12086 /// # Example
12087 /// ```ignore,no_run
12088 /// # use google_cloud_kms_v1::model::GetPublicKeyRequest;
12089 /// use google_cloud_kms_v1::model::public_key::PublicKeyFormat;
12090 /// let x0 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Pem);
12091 /// let x1 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::Der);
12092 /// let x2 = GetPublicKeyRequest::new().set_public_key_format(PublicKeyFormat::NistPqc);
12093 /// ```
12094 pub fn set_public_key_format<
12095 T: std::convert::Into<crate::model::public_key::PublicKeyFormat>,
12096 >(
12097 mut self,
12098 v: T,
12099 ) -> Self {
12100 self.public_key_format = v.into();
12101 self
12102 }
12103}
12104
12105impl wkt::message::Message for GetPublicKeyRequest {
12106 fn typename() -> &'static str {
12107 "type.googleapis.com/google.cloud.kms.v1.GetPublicKeyRequest"
12108 }
12109}
12110
12111/// Request message for
12112/// [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob].
12113///
12114/// [google.cloud.kms.v1.KeyManagementService.GetImportJob]: crate::client::KeyManagementService::get_import_job
12115#[derive(Clone, Default, PartialEq)]
12116#[non_exhaustive]
12117pub struct GetImportJobRequest {
12118 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12119 /// [ImportJob][google.cloud.kms.v1.ImportJob] to get.
12120 ///
12121 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12122 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12123 pub name: std::string::String,
12124
12125 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12126}
12127
12128impl GetImportJobRequest {
12129 /// Creates a new default instance.
12130 pub fn new() -> Self {
12131 std::default::Default::default()
12132 }
12133
12134 /// Sets the value of [name][crate::model::GetImportJobRequest::name].
12135 ///
12136 /// # Example
12137 /// ```ignore,no_run
12138 /// # use google_cloud_kms_v1::model::GetImportJobRequest;
12139 /// # let project_id = "project_id";
12140 /// # let location_id = "location_id";
12141 /// # let key_ring_id = "key_ring_id";
12142 /// # let import_job_id = "import_job_id";
12143 /// let x = GetImportJobRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/importJobs/{import_job_id}"));
12144 /// ```
12145 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12146 self.name = v.into();
12147 self
12148 }
12149}
12150
12151impl wkt::message::Message for GetImportJobRequest {
12152 fn typename() -> &'static str {
12153 "type.googleapis.com/google.cloud.kms.v1.GetImportJobRequest"
12154 }
12155}
12156
12157/// Request message for
12158/// [KeyManagementService.GetRetiredResource][google.cloud.kms.v1.KeyManagementService.GetRetiredResource].
12159///
12160/// [google.cloud.kms.v1.KeyManagementService.GetRetiredResource]: crate::client::KeyManagementService::get_retired_resource
12161#[derive(Clone, Default, PartialEq)]
12162#[non_exhaustive]
12163pub struct GetRetiredResourceRequest {
12164 /// Required. The [name][google.cloud.kms.v1.RetiredResource.name] of the
12165 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] to get.
12166 ///
12167 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
12168 /// [google.cloud.kms.v1.RetiredResource.name]: crate::model::RetiredResource::name
12169 pub name: std::string::String,
12170
12171 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12172}
12173
12174impl GetRetiredResourceRequest {
12175 /// Creates a new default instance.
12176 pub fn new() -> Self {
12177 std::default::Default::default()
12178 }
12179
12180 /// Sets the value of [name][crate::model::GetRetiredResourceRequest::name].
12181 ///
12182 /// # Example
12183 /// ```ignore,no_run
12184 /// # use google_cloud_kms_v1::model::GetRetiredResourceRequest;
12185 /// # let project_id = "project_id";
12186 /// # let location_id = "location_id";
12187 /// # let retired_resource_id = "retired_resource_id";
12188 /// let x = GetRetiredResourceRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
12189 /// ```
12190 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12191 self.name = v.into();
12192 self
12193 }
12194}
12195
12196impl wkt::message::Message for GetRetiredResourceRequest {
12197 fn typename() -> &'static str {
12198 "type.googleapis.com/google.cloud.kms.v1.GetRetiredResourceRequest"
12199 }
12200}
12201
12202/// Request message for
12203/// [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing].
12204///
12205/// [google.cloud.kms.v1.KeyManagementService.CreateKeyRing]: crate::client::KeyManagementService::create_key_ring
12206#[derive(Clone, Default, PartialEq)]
12207#[non_exhaustive]
12208pub struct CreateKeyRingRequest {
12209 /// Required. The resource name of the location associated with the
12210 /// [KeyRings][google.cloud.kms.v1.KeyRing], in the format
12211 /// `projects/*/locations/*`.
12212 ///
12213 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12214 pub parent: std::string::String,
12215
12216 /// Required. It must be unique within a location and match the regular
12217 /// expression `[a-zA-Z0-9_-]{1,63}`
12218 pub key_ring_id: std::string::String,
12219
12220 /// Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field
12221 /// values.
12222 ///
12223 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12224 pub key_ring: std::option::Option<crate::model::KeyRing>,
12225
12226 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12227}
12228
12229impl CreateKeyRingRequest {
12230 /// Creates a new default instance.
12231 pub fn new() -> Self {
12232 std::default::Default::default()
12233 }
12234
12235 /// Sets the value of [parent][crate::model::CreateKeyRingRequest::parent].
12236 ///
12237 /// # Example
12238 /// ```ignore,no_run
12239 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12240 /// let x = CreateKeyRingRequest::new().set_parent("example");
12241 /// ```
12242 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12243 self.parent = v.into();
12244 self
12245 }
12246
12247 /// Sets the value of [key_ring_id][crate::model::CreateKeyRingRequest::key_ring_id].
12248 ///
12249 /// # Example
12250 /// ```ignore,no_run
12251 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12252 /// let x = CreateKeyRingRequest::new().set_key_ring_id("example");
12253 /// ```
12254 pub fn set_key_ring_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12255 self.key_ring_id = v.into();
12256 self
12257 }
12258
12259 /// Sets the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12260 ///
12261 /// # Example
12262 /// ```ignore,no_run
12263 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12264 /// use google_cloud_kms_v1::model::KeyRing;
12265 /// let x = CreateKeyRingRequest::new().set_key_ring(KeyRing::default()/* use setters */);
12266 /// ```
12267 pub fn set_key_ring<T>(mut self, v: T) -> Self
12268 where
12269 T: std::convert::Into<crate::model::KeyRing>,
12270 {
12271 self.key_ring = std::option::Option::Some(v.into());
12272 self
12273 }
12274
12275 /// Sets or clears the value of [key_ring][crate::model::CreateKeyRingRequest::key_ring].
12276 ///
12277 /// # Example
12278 /// ```ignore,no_run
12279 /// # use google_cloud_kms_v1::model::CreateKeyRingRequest;
12280 /// use google_cloud_kms_v1::model::KeyRing;
12281 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(Some(KeyRing::default()/* use setters */));
12282 /// let x = CreateKeyRingRequest::new().set_or_clear_key_ring(None::<KeyRing>);
12283 /// ```
12284 pub fn set_or_clear_key_ring<T>(mut self, v: std::option::Option<T>) -> Self
12285 where
12286 T: std::convert::Into<crate::model::KeyRing>,
12287 {
12288 self.key_ring = v.map(|x| x.into());
12289 self
12290 }
12291}
12292
12293impl wkt::message::Message for CreateKeyRingRequest {
12294 fn typename() -> &'static str {
12295 "type.googleapis.com/google.cloud.kms.v1.CreateKeyRingRequest"
12296 }
12297}
12298
12299/// Request message for
12300/// [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey].
12301///
12302/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]: crate::client::KeyManagementService::create_crypto_key
12303#[derive(Clone, Default, PartialEq)]
12304#[non_exhaustive]
12305pub struct CreateCryptoKeyRequest {
12306 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing
12307 /// associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].
12308 ///
12309 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12310 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12311 pub parent: std::string::String,
12312
12313 /// Required. It must be unique within a KeyRing and match the regular
12314 /// expression `[a-zA-Z0-9_-]{1,63}`
12315 pub crypto_key_id: std::string::String,
12316
12317 /// Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field
12318 /// values.
12319 ///
12320 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12321 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
12322
12323 /// If set to true, the request will create a
12324 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] without any
12325 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must
12326 /// manually call
12327 /// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]
12328 /// or
12329 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]
12330 /// before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey].
12331 ///
12332 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12333 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12334 /// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12335 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12336 pub skip_initial_version_creation: bool,
12337
12338 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12339}
12340
12341impl CreateCryptoKeyRequest {
12342 /// Creates a new default instance.
12343 pub fn new() -> Self {
12344 std::default::Default::default()
12345 }
12346
12347 /// Sets the value of [parent][crate::model::CreateCryptoKeyRequest::parent].
12348 ///
12349 /// # Example
12350 /// ```ignore,no_run
12351 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12352 /// # let project_id = "project_id";
12353 /// # let location_id = "location_id";
12354 /// # let key_ring_id = "key_ring_id";
12355 /// let x = CreateCryptoKeyRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
12356 /// ```
12357 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12358 self.parent = v.into();
12359 self
12360 }
12361
12362 /// Sets the value of [crypto_key_id][crate::model::CreateCryptoKeyRequest::crypto_key_id].
12363 ///
12364 /// # Example
12365 /// ```ignore,no_run
12366 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12367 /// let x = CreateCryptoKeyRequest::new().set_crypto_key_id("example");
12368 /// ```
12369 pub fn set_crypto_key_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12370 self.crypto_key_id = v.into();
12371 self
12372 }
12373
12374 /// Sets the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12375 ///
12376 /// # Example
12377 /// ```ignore,no_run
12378 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12379 /// use google_cloud_kms_v1::model::CryptoKey;
12380 /// let x = CreateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
12381 /// ```
12382 pub fn set_crypto_key<T>(mut self, v: T) -> Self
12383 where
12384 T: std::convert::Into<crate::model::CryptoKey>,
12385 {
12386 self.crypto_key = std::option::Option::Some(v.into());
12387 self
12388 }
12389
12390 /// Sets or clears the value of [crypto_key][crate::model::CreateCryptoKeyRequest::crypto_key].
12391 ///
12392 /// # Example
12393 /// ```ignore,no_run
12394 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12395 /// use google_cloud_kms_v1::model::CryptoKey;
12396 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
12397 /// let x = CreateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
12398 /// ```
12399 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
12400 where
12401 T: std::convert::Into<crate::model::CryptoKey>,
12402 {
12403 self.crypto_key = v.map(|x| x.into());
12404 self
12405 }
12406
12407 /// Sets the value of [skip_initial_version_creation][crate::model::CreateCryptoKeyRequest::skip_initial_version_creation].
12408 ///
12409 /// # Example
12410 /// ```ignore,no_run
12411 /// # use google_cloud_kms_v1::model::CreateCryptoKeyRequest;
12412 /// let x = CreateCryptoKeyRequest::new().set_skip_initial_version_creation(true);
12413 /// ```
12414 pub fn set_skip_initial_version_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
12415 self.skip_initial_version_creation = v.into();
12416 self
12417 }
12418}
12419
12420impl wkt::message::Message for CreateCryptoKeyRequest {
12421 fn typename() -> &'static str {
12422 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyRequest"
12423 }
12424}
12425
12426/// Request message for
12427/// [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion].
12428///
12429/// [google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]: crate::client::KeyManagementService::create_crypto_key_version
12430#[derive(Clone, Default, PartialEq)]
12431#[non_exhaustive]
12432pub struct CreateCryptoKeyVersionRequest {
12433 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12434 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with the
12435 /// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].
12436 ///
12437 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12438 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12439 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12440 pub parent: std::string::String,
12441
12442 /// Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
12443 /// initial field values.
12444 ///
12445 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12446 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
12447
12448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12449}
12450
12451impl CreateCryptoKeyVersionRequest {
12452 /// Creates a new default instance.
12453 pub fn new() -> Self {
12454 std::default::Default::default()
12455 }
12456
12457 /// Sets the value of [parent][crate::model::CreateCryptoKeyVersionRequest::parent].
12458 ///
12459 /// # Example
12460 /// ```ignore,no_run
12461 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12462 /// # let project_id = "project_id";
12463 /// # let location_id = "location_id";
12464 /// # let key_ring_id = "key_ring_id";
12465 /// # let crypto_key_id = "crypto_key_id";
12466 /// let x = CreateCryptoKeyVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12467 /// ```
12468 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12469 self.parent = v.into();
12470 self
12471 }
12472
12473 /// Sets the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12474 ///
12475 /// # Example
12476 /// ```ignore,no_run
12477 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12478 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12479 /// let x = CreateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
12480 /// ```
12481 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
12482 where
12483 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12484 {
12485 self.crypto_key_version = std::option::Option::Some(v.into());
12486 self
12487 }
12488
12489 /// Sets or clears the value of [crypto_key_version][crate::model::CreateCryptoKeyVersionRequest::crypto_key_version].
12490 ///
12491 /// # Example
12492 /// ```ignore,no_run
12493 /// # use google_cloud_kms_v1::model::CreateCryptoKeyVersionRequest;
12494 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
12495 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
12496 /// let x = CreateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
12497 /// ```
12498 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
12499 where
12500 T: std::convert::Into<crate::model::CryptoKeyVersion>,
12501 {
12502 self.crypto_key_version = v.map(|x| x.into());
12503 self
12504 }
12505}
12506
12507impl wkt::message::Message for CreateCryptoKeyVersionRequest {
12508 fn typename() -> &'static str {
12509 "type.googleapis.com/google.cloud.kms.v1.CreateCryptoKeyVersionRequest"
12510 }
12511}
12512
12513/// Request message for
12514/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey].
12515///
12516/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
12517#[derive(Clone, Default, PartialEq)]
12518#[non_exhaustive]
12519pub struct DeleteCryptoKeyRequest {
12520 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12521 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to delete.
12522 ///
12523 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12524 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12525 pub name: std::string::String,
12526
12527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12528}
12529
12530impl DeleteCryptoKeyRequest {
12531 /// Creates a new default instance.
12532 pub fn new() -> Self {
12533 std::default::Default::default()
12534 }
12535
12536 /// Sets the value of [name][crate::model::DeleteCryptoKeyRequest::name].
12537 ///
12538 /// # Example
12539 /// ```ignore,no_run
12540 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyRequest;
12541 /// # let project_id = "project_id";
12542 /// # let location_id = "location_id";
12543 /// # let key_ring_id = "key_ring_id";
12544 /// # let crypto_key_id = "crypto_key_id";
12545 /// let x = DeleteCryptoKeyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12546 /// ```
12547 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12548 self.name = v.into();
12549 self
12550 }
12551}
12552
12553impl wkt::message::Message for DeleteCryptoKeyRequest {
12554 fn typename() -> &'static str {
12555 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyRequest"
12556 }
12557}
12558
12559/// Request message for
12560/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion].
12561///
12562/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
12563#[derive(Clone, Default, PartialEq)]
12564#[non_exhaustive]
12565pub struct DeleteCryptoKeyVersionRequest {
12566 /// Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the
12567 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to delete.
12568 ///
12569 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12570 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12571 pub name: std::string::String,
12572
12573 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12574}
12575
12576impl DeleteCryptoKeyVersionRequest {
12577 /// Creates a new default instance.
12578 pub fn new() -> Self {
12579 std::default::Default::default()
12580 }
12581
12582 /// Sets the value of [name][crate::model::DeleteCryptoKeyVersionRequest::name].
12583 ///
12584 /// # Example
12585 /// ```ignore,no_run
12586 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyVersionRequest;
12587 /// # let project_id = "project_id";
12588 /// # let location_id = "location_id";
12589 /// # let key_ring_id = "key_ring_id";
12590 /// # let crypto_key_id = "crypto_key_id";
12591 /// # let crypto_key_version_id = "crypto_key_version_id";
12592 /// let x = DeleteCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12593 /// ```
12594 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12595 self.name = v.into();
12596 self
12597 }
12598}
12599
12600impl wkt::message::Message for DeleteCryptoKeyVersionRequest {
12601 fn typename() -> &'static str {
12602 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionRequest"
12603 }
12604}
12605
12606/// Request message for
12607/// [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion].
12608///
12609/// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12610#[derive(Clone, Default, PartialEq)]
12611#[non_exhaustive]
12612pub struct ImportCryptoKeyVersionRequest {
12613 /// Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the
12614 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to be imported into.
12615 ///
12616 /// The create permission is only required on this key when creating a new
12617 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].
12618 ///
12619 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12620 /// [google.cloud.kms.v1.CryptoKey.name]: crate::model::CryptoKey::name
12621 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12622 pub parent: std::string::String,
12623
12624 /// Optional. The optional [name][google.cloud.kms.v1.CryptoKeyVersion.name] of
12625 /// an existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to
12626 /// target for an import operation. If this field is not present, a new
12627 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] containing the
12628 /// supplied key material is created.
12629 ///
12630 /// If this field is present, the supplied key material is imported into
12631 /// the existing [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. To
12632 /// import into an existing
12633 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], the
12634 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] must be a child of
12635 /// [ImportCryptoKeyVersionRequest.parent][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent],
12636 /// have been previously created via
12637 /// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion],
12638 /// and be in
12639 /// [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]
12640 /// or
12641 /// [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]
12642 /// state. The key material and algorithm must match the previous
12643 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] exactly if the
12644 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] has ever contained
12645 /// key material.
12646 ///
12647 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
12648 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]: crate::model::crypto_key_version::CryptoKeyVersionState::Destroyed
12649 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]: crate::model::crypto_key_version::CryptoKeyVersionState::ImportFailed
12650 /// [google.cloud.kms.v1.CryptoKeyVersion.name]: crate::model::CryptoKeyVersion::name
12651 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent]: crate::model::ImportCryptoKeyVersionRequest::parent
12652 /// [google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]: crate::client::KeyManagementService::import_crypto_key_version
12653 pub crypto_key_version: std::string::String,
12654
12655 /// Required. The
12656 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]
12657 /// of the key being imported. This does not need to match the
12658 /// [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the
12659 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] this version imports into.
12660 ///
12661 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
12662 /// [google.cloud.kms.v1.CryptoKey.version_template]: crate::model::CryptoKey::version_template
12663 /// [google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm]: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm
12664 pub algorithm: crate::model::crypto_key_version::CryptoKeyVersionAlgorithm,
12665
12666 /// Required. The [name][google.cloud.kms.v1.ImportJob.name] of the
12667 /// [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key
12668 /// material.
12669 ///
12670 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12671 /// [google.cloud.kms.v1.ImportJob.name]: crate::model::ImportJob::name
12672 pub import_job: std::string::String,
12673
12674 /// Optional. The wrapped key material to import.
12675 ///
12676 /// Before wrapping, key material must be formatted. If importing symmetric key
12677 /// material, the expected key material format is plain bytes. If importing
12678 /// asymmetric key material, the expected key material format is PKCS#8-encoded
12679 /// DER (the PrivateKeyInfo structure from RFC 5208).
12680 ///
12681 /// When wrapping with import methods
12682 /// ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]
12683 /// or
12684 /// [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]
12685 /// or
12686 /// [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]
12687 /// or
12688 /// [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]),
12689 ///
12690 /// this field must contain the concatenation of:
12691 ///
12692 /// This format is the same as the format produced by PKCS#11 mechanism
12693 /// CKM_RSA_AES_KEY_WRAP.
12694 ///
12695 /// When wrapping with import methods
12696 /// ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]
12697 /// or
12698 /// [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]),
12699 ///
12700 /// this field must contain the formatted key to be imported, wrapped with the
12701 /// [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP
12702 /// with SHA-256, MGF1 with SHA-256, and an empty label.
12703 ///
12704 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha1Aes256
12705 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256
12706 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep3072Sha256Aes256
12707 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha1Aes256
12708 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256
12709 /// [google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]: crate::model::import_job::ImportMethod::RsaOaep4096Sha256Aes256
12710 /// [google.cloud.kms.v1.ImportJob.public_key]: crate::model::ImportJob::public_key
12711 pub wrapped_key: ::bytes::Bytes,
12712
12713 /// This field is legacy. Use the field
12714 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12715 /// instead.
12716 ///
12717 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12718 pub wrapped_key_material:
12719 std::option::Option<crate::model::import_crypto_key_version_request::WrappedKeyMaterial>,
12720
12721 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12722}
12723
12724impl ImportCryptoKeyVersionRequest {
12725 /// Creates a new default instance.
12726 pub fn new() -> Self {
12727 std::default::Default::default()
12728 }
12729
12730 /// Sets the value of [parent][crate::model::ImportCryptoKeyVersionRequest::parent].
12731 ///
12732 /// # Example
12733 /// ```ignore,no_run
12734 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12735 /// # let project_id = "project_id";
12736 /// # let location_id = "location_id";
12737 /// # let key_ring_id = "key_ring_id";
12738 /// # let crypto_key_id = "crypto_key_id";
12739 /// let x = ImportCryptoKeyVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
12740 /// ```
12741 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12742 self.parent = v.into();
12743 self
12744 }
12745
12746 /// Sets the value of [crypto_key_version][crate::model::ImportCryptoKeyVersionRequest::crypto_key_version].
12747 ///
12748 /// # Example
12749 /// ```ignore,no_run
12750 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12751 /// # let project_id = "project_id";
12752 /// # let location_id = "location_id";
12753 /// # let key_ring_id = "key_ring_id";
12754 /// # let crypto_key_id = "crypto_key_id";
12755 /// # let crypto_key_version_id = "crypto_key_version_id";
12756 /// let x = ImportCryptoKeyVersionRequest::new().set_crypto_key_version(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
12757 /// ```
12758 pub fn set_crypto_key_version<T: std::convert::Into<std::string::String>>(
12759 mut self,
12760 v: T,
12761 ) -> Self {
12762 self.crypto_key_version = v.into();
12763 self
12764 }
12765
12766 /// Sets the value of [algorithm][crate::model::ImportCryptoKeyVersionRequest::algorithm].
12767 ///
12768 /// # Example
12769 /// ```ignore,no_run
12770 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12771 /// use google_cloud_kms_v1::model::crypto_key_version::CryptoKeyVersionAlgorithm;
12772 /// let x0 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::GoogleSymmetricEncryption);
12773 /// let x1 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes128Gcm);
12774 /// let x2 = ImportCryptoKeyVersionRequest::new().set_algorithm(CryptoKeyVersionAlgorithm::Aes256Gcm);
12775 /// ```
12776 pub fn set_algorithm<
12777 T: std::convert::Into<crate::model::crypto_key_version::CryptoKeyVersionAlgorithm>,
12778 >(
12779 mut self,
12780 v: T,
12781 ) -> Self {
12782 self.algorithm = v.into();
12783 self
12784 }
12785
12786 /// Sets the value of [import_job][crate::model::ImportCryptoKeyVersionRequest::import_job].
12787 ///
12788 /// # Example
12789 /// ```ignore,no_run
12790 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12791 /// let x = ImportCryptoKeyVersionRequest::new().set_import_job("example");
12792 /// ```
12793 pub fn set_import_job<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12794 self.import_job = v.into();
12795 self
12796 }
12797
12798 /// Sets the value of [wrapped_key][crate::model::ImportCryptoKeyVersionRequest::wrapped_key].
12799 ///
12800 /// # Example
12801 /// ```ignore,no_run
12802 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12803 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key(bytes::Bytes::from_static(b"example"));
12804 /// ```
12805 pub fn set_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12806 self.wrapped_key = v.into();
12807 self
12808 }
12809
12810 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material].
12811 ///
12812 /// Note that all the setters affecting `wrapped_key_material` are mutually
12813 /// exclusive.
12814 ///
12815 /// # Example
12816 /// ```ignore,no_run
12817 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12818 /// use google_cloud_kms_v1::model::import_crypto_key_version_request::WrappedKeyMaterial;
12819 /// let x = ImportCryptoKeyVersionRequest::new().set_wrapped_key_material(Some(WrappedKeyMaterial::RsaAesWrappedKey(bytes::Bytes::from_static(b"example"))));
12820 /// ```
12821 pub fn set_wrapped_key_material<
12822 T: std::convert::Into<
12823 std::option::Option<
12824 crate::model::import_crypto_key_version_request::WrappedKeyMaterial,
12825 >,
12826 >,
12827 >(
12828 mut self,
12829 v: T,
12830 ) -> Self {
12831 self.wrapped_key_material = v.into();
12832 self
12833 }
12834
12835 /// The value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12836 /// if it holds a `RsaAesWrappedKey`, `None` if the field is not set or
12837 /// holds a different branch.
12838 pub fn rsa_aes_wrapped_key(&self) -> std::option::Option<&::bytes::Bytes> {
12839 #[allow(unreachable_patterns)]
12840 self.wrapped_key_material.as_ref().and_then(|v| match v {
12841 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(v) => std::option::Option::Some(v),
12842 _ => std::option::Option::None,
12843 })
12844 }
12845
12846 /// Sets the value of [wrapped_key_material][crate::model::ImportCryptoKeyVersionRequest::wrapped_key_material]
12847 /// to hold a `RsaAesWrappedKey`.
12848 ///
12849 /// Note that all the setters affecting `wrapped_key_material` are
12850 /// mutually exclusive.
12851 ///
12852 /// # Example
12853 /// ```ignore,no_run
12854 /// # use google_cloud_kms_v1::model::ImportCryptoKeyVersionRequest;
12855 /// let x = ImportCryptoKeyVersionRequest::new().set_rsa_aes_wrapped_key(bytes::Bytes::from_static(b"example"));
12856 /// assert!(x.rsa_aes_wrapped_key().is_some());
12857 /// ```
12858 pub fn set_rsa_aes_wrapped_key<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
12859 self.wrapped_key_material = std::option::Option::Some(
12860 crate::model::import_crypto_key_version_request::WrappedKeyMaterial::RsaAesWrappedKey(
12861 v.into(),
12862 ),
12863 );
12864 self
12865 }
12866}
12867
12868impl wkt::message::Message for ImportCryptoKeyVersionRequest {
12869 fn typename() -> &'static str {
12870 "type.googleapis.com/google.cloud.kms.v1.ImportCryptoKeyVersionRequest"
12871 }
12872}
12873
12874/// Defines additional types related to [ImportCryptoKeyVersionRequest].
12875pub mod import_crypto_key_version_request {
12876 #[allow(unused_imports)]
12877 use super::*;
12878
12879 /// This field is legacy. Use the field
12880 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]
12881 /// instead.
12882 ///
12883 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12884 #[derive(Clone, Debug, PartialEq)]
12885 #[non_exhaustive]
12886 pub enum WrappedKeyMaterial {
12887 /// Optional. This field has the same meaning as
12888 /// [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key].
12889 /// Prefer to use that field in new work. Either that field or this field
12890 /// (but not both) must be specified.
12891 ///
12892 /// [google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]: crate::model::ImportCryptoKeyVersionRequest::wrapped_key
12893 RsaAesWrappedKey(::bytes::Bytes),
12894 }
12895}
12896
12897/// Request message for
12898/// [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob].
12899///
12900/// [google.cloud.kms.v1.KeyManagementService.CreateImportJob]: crate::client::KeyManagementService::create_import_job
12901#[derive(Clone, Default, PartialEq)]
12902#[non_exhaustive]
12903pub struct CreateImportJobRequest {
12904 /// Required. The [name][google.cloud.kms.v1.KeyRing.name] of the
12905 /// [KeyRing][google.cloud.kms.v1.KeyRing] associated with the
12906 /// [ImportJobs][google.cloud.kms.v1.ImportJob].
12907 ///
12908 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12909 /// [google.cloud.kms.v1.KeyRing]: crate::model::KeyRing
12910 /// [google.cloud.kms.v1.KeyRing.name]: crate::model::KeyRing::name
12911 pub parent: std::string::String,
12912
12913 /// Required. It must be unique within a KeyRing and match the regular
12914 /// expression `[a-zA-Z0-9_-]{1,63}`
12915 pub import_job_id: std::string::String,
12916
12917 /// Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field
12918 /// values.
12919 ///
12920 /// [google.cloud.kms.v1.ImportJob]: crate::model::ImportJob
12921 pub import_job: std::option::Option<crate::model::ImportJob>,
12922
12923 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12924}
12925
12926impl CreateImportJobRequest {
12927 /// Creates a new default instance.
12928 pub fn new() -> Self {
12929 std::default::Default::default()
12930 }
12931
12932 /// Sets the value of [parent][crate::model::CreateImportJobRequest::parent].
12933 ///
12934 /// # Example
12935 /// ```ignore,no_run
12936 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12937 /// # let project_id = "project_id";
12938 /// # let location_id = "location_id";
12939 /// # let key_ring_id = "key_ring_id";
12940 /// let x = CreateImportJobRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}"));
12941 /// ```
12942 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12943 self.parent = v.into();
12944 self
12945 }
12946
12947 /// Sets the value of [import_job_id][crate::model::CreateImportJobRequest::import_job_id].
12948 ///
12949 /// # Example
12950 /// ```ignore,no_run
12951 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12952 /// let x = CreateImportJobRequest::new().set_import_job_id("example");
12953 /// ```
12954 pub fn set_import_job_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12955 self.import_job_id = v.into();
12956 self
12957 }
12958
12959 /// Sets the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12960 ///
12961 /// # Example
12962 /// ```ignore,no_run
12963 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12964 /// use google_cloud_kms_v1::model::ImportJob;
12965 /// let x = CreateImportJobRequest::new().set_import_job(ImportJob::default()/* use setters */);
12966 /// ```
12967 pub fn set_import_job<T>(mut self, v: T) -> Self
12968 where
12969 T: std::convert::Into<crate::model::ImportJob>,
12970 {
12971 self.import_job = std::option::Option::Some(v.into());
12972 self
12973 }
12974
12975 /// Sets or clears the value of [import_job][crate::model::CreateImportJobRequest::import_job].
12976 ///
12977 /// # Example
12978 /// ```ignore,no_run
12979 /// # use google_cloud_kms_v1::model::CreateImportJobRequest;
12980 /// use google_cloud_kms_v1::model::ImportJob;
12981 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(Some(ImportJob::default()/* use setters */));
12982 /// let x = CreateImportJobRequest::new().set_or_clear_import_job(None::<ImportJob>);
12983 /// ```
12984 pub fn set_or_clear_import_job<T>(mut self, v: std::option::Option<T>) -> Self
12985 where
12986 T: std::convert::Into<crate::model::ImportJob>,
12987 {
12988 self.import_job = v.map(|x| x.into());
12989 self
12990 }
12991}
12992
12993impl wkt::message::Message for CreateImportJobRequest {
12994 fn typename() -> &'static str {
12995 "type.googleapis.com/google.cloud.kms.v1.CreateImportJobRequest"
12996 }
12997}
12998
12999/// Request message for
13000/// [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey].
13001///
13002/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]: crate::client::KeyManagementService::update_crypto_key
13003#[derive(Clone, Default, PartialEq)]
13004#[non_exhaustive]
13005pub struct UpdateCryptoKeyRequest {
13006 /// Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.
13007 ///
13008 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13009 pub crypto_key: std::option::Option<crate::model::CryptoKey>,
13010
13011 /// Required. List of fields to be updated in this request.
13012 pub update_mask: std::option::Option<wkt::FieldMask>,
13013
13014 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13015}
13016
13017impl UpdateCryptoKeyRequest {
13018 /// Creates a new default instance.
13019 pub fn new() -> Self {
13020 std::default::Default::default()
13021 }
13022
13023 /// Sets the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
13024 ///
13025 /// # Example
13026 /// ```ignore,no_run
13027 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13028 /// use google_cloud_kms_v1::model::CryptoKey;
13029 /// let x = UpdateCryptoKeyRequest::new().set_crypto_key(CryptoKey::default()/* use setters */);
13030 /// ```
13031 pub fn set_crypto_key<T>(mut self, v: T) -> Self
13032 where
13033 T: std::convert::Into<crate::model::CryptoKey>,
13034 {
13035 self.crypto_key = std::option::Option::Some(v.into());
13036 self
13037 }
13038
13039 /// Sets or clears the value of [crypto_key][crate::model::UpdateCryptoKeyRequest::crypto_key].
13040 ///
13041 /// # Example
13042 /// ```ignore,no_run
13043 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13044 /// use google_cloud_kms_v1::model::CryptoKey;
13045 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(Some(CryptoKey::default()/* use setters */));
13046 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_crypto_key(None::<CryptoKey>);
13047 /// ```
13048 pub fn set_or_clear_crypto_key<T>(mut self, v: std::option::Option<T>) -> Self
13049 where
13050 T: std::convert::Into<crate::model::CryptoKey>,
13051 {
13052 self.crypto_key = v.map(|x| x.into());
13053 self
13054 }
13055
13056 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
13057 ///
13058 /// # Example
13059 /// ```ignore,no_run
13060 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13061 /// use wkt::FieldMask;
13062 /// let x = UpdateCryptoKeyRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13063 /// ```
13064 pub fn set_update_mask<T>(mut self, v: T) -> Self
13065 where
13066 T: std::convert::Into<wkt::FieldMask>,
13067 {
13068 self.update_mask = std::option::Option::Some(v.into());
13069 self
13070 }
13071
13072 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyRequest::update_mask].
13073 ///
13074 /// # Example
13075 /// ```ignore,no_run
13076 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyRequest;
13077 /// use wkt::FieldMask;
13078 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13079 /// let x = UpdateCryptoKeyRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13080 /// ```
13081 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13082 where
13083 T: std::convert::Into<wkt::FieldMask>,
13084 {
13085 self.update_mask = v.map(|x| x.into());
13086 self
13087 }
13088}
13089
13090impl wkt::message::Message for UpdateCryptoKeyRequest {
13091 fn typename() -> &'static str {
13092 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyRequest"
13093 }
13094}
13095
13096/// Request message for
13097/// [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion].
13098///
13099/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]: crate::client::KeyManagementService::update_crypto_key_version
13100#[derive(Clone, Default, PartialEq)]
13101#[non_exhaustive]
13102pub struct UpdateCryptoKeyVersionRequest {
13103 /// Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with
13104 /// updated values.
13105 ///
13106 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13107 pub crypto_key_version: std::option::Option<crate::model::CryptoKeyVersion>,
13108
13109 /// Required. List of fields to be updated in this request.
13110 pub update_mask: std::option::Option<wkt::FieldMask>,
13111
13112 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13113}
13114
13115impl UpdateCryptoKeyVersionRequest {
13116 /// Creates a new default instance.
13117 pub fn new() -> Self {
13118 std::default::Default::default()
13119 }
13120
13121 /// Sets the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
13122 ///
13123 /// # Example
13124 /// ```ignore,no_run
13125 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13126 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
13127 /// let x = UpdateCryptoKeyVersionRequest::new().set_crypto_key_version(CryptoKeyVersion::default()/* use setters */);
13128 /// ```
13129 pub fn set_crypto_key_version<T>(mut self, v: T) -> Self
13130 where
13131 T: std::convert::Into<crate::model::CryptoKeyVersion>,
13132 {
13133 self.crypto_key_version = std::option::Option::Some(v.into());
13134 self
13135 }
13136
13137 /// Sets or clears the value of [crypto_key_version][crate::model::UpdateCryptoKeyVersionRequest::crypto_key_version].
13138 ///
13139 /// # Example
13140 /// ```ignore,no_run
13141 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13142 /// use google_cloud_kms_v1::model::CryptoKeyVersion;
13143 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(Some(CryptoKeyVersion::default()/* use setters */));
13144 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_crypto_key_version(None::<CryptoKeyVersion>);
13145 /// ```
13146 pub fn set_or_clear_crypto_key_version<T>(mut self, v: std::option::Option<T>) -> Self
13147 where
13148 T: std::convert::Into<crate::model::CryptoKeyVersion>,
13149 {
13150 self.crypto_key_version = v.map(|x| x.into());
13151 self
13152 }
13153
13154 /// Sets the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13155 ///
13156 /// # Example
13157 /// ```ignore,no_run
13158 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13159 /// use wkt::FieldMask;
13160 /// let x = UpdateCryptoKeyVersionRequest::new().set_update_mask(FieldMask::default()/* use setters */);
13161 /// ```
13162 pub fn set_update_mask<T>(mut self, v: T) -> Self
13163 where
13164 T: std::convert::Into<wkt::FieldMask>,
13165 {
13166 self.update_mask = std::option::Option::Some(v.into());
13167 self
13168 }
13169
13170 /// Sets or clears the value of [update_mask][crate::model::UpdateCryptoKeyVersionRequest::update_mask].
13171 ///
13172 /// # Example
13173 /// ```ignore,no_run
13174 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyVersionRequest;
13175 /// use wkt::FieldMask;
13176 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
13177 /// let x = UpdateCryptoKeyVersionRequest::new().set_or_clear_update_mask(None::<FieldMask>);
13178 /// ```
13179 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
13180 where
13181 T: std::convert::Into<wkt::FieldMask>,
13182 {
13183 self.update_mask = v.map(|x| x.into());
13184 self
13185 }
13186}
13187
13188impl wkt::message::Message for UpdateCryptoKeyVersionRequest {
13189 fn typename() -> &'static str {
13190 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyVersionRequest"
13191 }
13192}
13193
13194/// Request message for
13195/// [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion].
13196///
13197/// [google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]: crate::client::KeyManagementService::update_crypto_key_primary_version
13198#[derive(Clone, Default, PartialEq)]
13199#[non_exhaustive]
13200pub struct UpdateCryptoKeyPrimaryVersionRequest {
13201 /// Required. The resource name of the
13202 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.
13203 ///
13204 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13205 pub name: std::string::String,
13206
13207 /// Required. The id of the child
13208 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.
13209 ///
13210 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13211 pub crypto_key_version_id: std::string::String,
13212
13213 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13214}
13215
13216impl UpdateCryptoKeyPrimaryVersionRequest {
13217 /// Creates a new default instance.
13218 pub fn new() -> Self {
13219 std::default::Default::default()
13220 }
13221
13222 /// Sets the value of [name][crate::model::UpdateCryptoKeyPrimaryVersionRequest::name].
13223 ///
13224 /// # Example
13225 /// ```ignore,no_run
13226 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13227 /// # let project_id = "project_id";
13228 /// # let location_id = "location_id";
13229 /// # let key_ring_id = "key_ring_id";
13230 /// # let crypto_key_id = "crypto_key_id";
13231 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
13232 /// ```
13233 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13234 self.name = v.into();
13235 self
13236 }
13237
13238 /// Sets the value of [crypto_key_version_id][crate::model::UpdateCryptoKeyPrimaryVersionRequest::crypto_key_version_id].
13239 ///
13240 /// # Example
13241 /// ```ignore,no_run
13242 /// # use google_cloud_kms_v1::model::UpdateCryptoKeyPrimaryVersionRequest;
13243 /// let x = UpdateCryptoKeyPrimaryVersionRequest::new().set_crypto_key_version_id("example");
13244 /// ```
13245 pub fn set_crypto_key_version_id<T: std::convert::Into<std::string::String>>(
13246 mut self,
13247 v: T,
13248 ) -> Self {
13249 self.crypto_key_version_id = v.into();
13250 self
13251 }
13252}
13253
13254impl wkt::message::Message for UpdateCryptoKeyPrimaryVersionRequest {
13255 fn typename() -> &'static str {
13256 "type.googleapis.com/google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest"
13257 }
13258}
13259
13260/// Request message for
13261/// [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion].
13262///
13263/// [google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]: crate::client::KeyManagementService::destroy_crypto_key_version
13264#[derive(Clone, Default, PartialEq)]
13265#[non_exhaustive]
13266pub struct DestroyCryptoKeyVersionRequest {
13267 /// Required. The resource name of the
13268 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.
13269 ///
13270 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13271 pub name: std::string::String,
13272
13273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13274}
13275
13276impl DestroyCryptoKeyVersionRequest {
13277 /// Creates a new default instance.
13278 pub fn new() -> Self {
13279 std::default::Default::default()
13280 }
13281
13282 /// Sets the value of [name][crate::model::DestroyCryptoKeyVersionRequest::name].
13283 ///
13284 /// # Example
13285 /// ```ignore,no_run
13286 /// # use google_cloud_kms_v1::model::DestroyCryptoKeyVersionRequest;
13287 /// # let project_id = "project_id";
13288 /// # let location_id = "location_id";
13289 /// # let key_ring_id = "key_ring_id";
13290 /// # let crypto_key_id = "crypto_key_id";
13291 /// # let crypto_key_version_id = "crypto_key_version_id";
13292 /// let x = DestroyCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
13293 /// ```
13294 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13295 self.name = v.into();
13296 self
13297 }
13298}
13299
13300impl wkt::message::Message for DestroyCryptoKeyVersionRequest {
13301 fn typename() -> &'static str {
13302 "type.googleapis.com/google.cloud.kms.v1.DestroyCryptoKeyVersionRequest"
13303 }
13304}
13305
13306/// Request message for
13307/// [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion].
13308///
13309/// [google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]: crate::client::KeyManagementService::restore_crypto_key_version
13310#[derive(Clone, Default, PartialEq)]
13311#[non_exhaustive]
13312pub struct RestoreCryptoKeyVersionRequest {
13313 /// Required. The resource name of the
13314 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.
13315 ///
13316 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13317 pub name: std::string::String,
13318
13319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13320}
13321
13322impl RestoreCryptoKeyVersionRequest {
13323 /// Creates a new default instance.
13324 pub fn new() -> Self {
13325 std::default::Default::default()
13326 }
13327
13328 /// Sets the value of [name][crate::model::RestoreCryptoKeyVersionRequest::name].
13329 ///
13330 /// # Example
13331 /// ```ignore,no_run
13332 /// # use google_cloud_kms_v1::model::RestoreCryptoKeyVersionRequest;
13333 /// # let project_id = "project_id";
13334 /// # let location_id = "location_id";
13335 /// # let key_ring_id = "key_ring_id";
13336 /// # let crypto_key_id = "crypto_key_id";
13337 /// # let crypto_key_version_id = "crypto_key_version_id";
13338 /// let x = RestoreCryptoKeyVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
13339 /// ```
13340 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13341 self.name = v.into();
13342 self
13343 }
13344}
13345
13346impl wkt::message::Message for RestoreCryptoKeyVersionRequest {
13347 fn typename() -> &'static str {
13348 "type.googleapis.com/google.cloud.kms.v1.RestoreCryptoKeyVersionRequest"
13349 }
13350}
13351
13352/// Request message for
13353/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
13354///
13355/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
13356#[derive(Clone, Default, PartialEq)]
13357#[non_exhaustive]
13358pub struct EncryptRequest {
13359 /// Required. The resource name of the
13360 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] or
13361 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13362 /// encryption.
13363 ///
13364 /// If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server
13365 /// will use its [primary version][google.cloud.kms.v1.CryptoKey.primary].
13366 ///
13367 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13368 /// [google.cloud.kms.v1.CryptoKey.primary]: crate::model::CryptoKey::primary
13369 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13370 pub name: std::string::String,
13371
13372 /// Required. The data to encrypt. Must be no larger than 64KiB.
13373 ///
13374 /// The maximum size depends on the key version's
13375 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13376 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13377 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13378 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the
13379 /// plaintext must be no larger than 64KiB. For
13380 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13381 /// the plaintext and additional_authenticated_data fields must be no larger
13382 /// than 8KiB.
13383 ///
13384 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13385 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13386 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13387 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13388 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13389 pub plaintext: ::bytes::Bytes,
13390
13391 /// Optional. Optional data that, if specified, must also be provided during
13392 /// decryption through
13393 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13394 ///
13395 /// The maximum size depends on the key version's
13396 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13397 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE],
13398 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], and
13399 /// [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys the
13400 /// AAD must be no larger than 64KiB. For
13401 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13402 /// the plaintext and additional_authenticated_data fields must be no larger
13403 /// than 8KiB.
13404 ///
13405 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13406 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13407 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
13408 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC]: crate::model::ProtectionLevel::ExternalVpc
13409 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13410 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13411 pub additional_authenticated_data: ::bytes::Bytes,
13412
13413 /// Optional. An optional CRC32C checksum of the
13414 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
13415 /// If specified,
13416 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13417 /// verify the integrity of the received
13418 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]
13419 /// using this checksum.
13420 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13421 /// report an error if the checksum verification fails. If you receive a
13422 /// checksum error, your client should verify that
13423 /// CRC32C([EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext])
13424 /// is equal to
13425 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c],
13426 /// and if so, perform a limited number of retries. A persistent mismatch may
13427 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13428 /// field is defined as int64 for reasons of compatibility across different
13429 /// languages. However, it is a non-negative integer, which will never exceed
13430 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13431 /// this type.
13432 ///
13433 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
13434 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
13435 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13436 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13437
13438 /// Optional. An optional CRC32C checksum of the
13439 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13440 /// If specified,
13441 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13442 /// verify the integrity of the received
13443 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]
13444 /// using this checksum.
13445 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13446 /// report an error if the checksum verification fails. If you receive a
13447 /// checksum error, your client should verify that
13448 /// CRC32C([EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data])
13449 /// is equal to
13450 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c],
13451 /// and if so, perform a limited number of retries. A persistent mismatch may
13452 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13453 /// field is defined as int64 for reasons of compatibility across different
13454 /// languages. However, it is a non-negative integer, which will never exceed
13455 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13456 /// this type.
13457 ///
13458 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13459 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
13460 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13461 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13462
13463 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13464}
13465
13466impl EncryptRequest {
13467 /// Creates a new default instance.
13468 pub fn new() -> Self {
13469 std::default::Default::default()
13470 }
13471
13472 /// Sets the value of [name][crate::model::EncryptRequest::name].
13473 ///
13474 /// # Example
13475 /// ```ignore,no_run
13476 /// # use google_cloud_kms_v1::model::EncryptRequest;
13477 /// let x = EncryptRequest::new().set_name("example");
13478 /// ```
13479 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13480 self.name = v.into();
13481 self
13482 }
13483
13484 /// Sets the value of [plaintext][crate::model::EncryptRequest::plaintext].
13485 ///
13486 /// # Example
13487 /// ```ignore,no_run
13488 /// # use google_cloud_kms_v1::model::EncryptRequest;
13489 /// let x = EncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13490 /// ```
13491 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13492 self.plaintext = v.into();
13493 self
13494 }
13495
13496 /// Sets the value of [additional_authenticated_data][crate::model::EncryptRequest::additional_authenticated_data].
13497 ///
13498 /// # Example
13499 /// ```ignore,no_run
13500 /// # use google_cloud_kms_v1::model::EncryptRequest;
13501 /// let x = EncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13502 /// ```
13503 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13504 mut self,
13505 v: T,
13506 ) -> Self {
13507 self.additional_authenticated_data = v.into();
13508 self
13509 }
13510
13511 /// Sets the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13512 ///
13513 /// # Example
13514 /// ```ignore,no_run
13515 /// # use google_cloud_kms_v1::model::EncryptRequest;
13516 /// use wkt::Int64Value;
13517 /// let x = EncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13518 /// ```
13519 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13520 where
13521 T: std::convert::Into<wkt::Int64Value>,
13522 {
13523 self.plaintext_crc32c = std::option::Option::Some(v.into());
13524 self
13525 }
13526
13527 /// Sets or clears the value of [plaintext_crc32c][crate::model::EncryptRequest::plaintext_crc32c].
13528 ///
13529 /// # Example
13530 /// ```ignore,no_run
13531 /// # use google_cloud_kms_v1::model::EncryptRequest;
13532 /// use wkt::Int64Value;
13533 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13534 /// let x = EncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13535 /// ```
13536 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13537 where
13538 T: std::convert::Into<wkt::Int64Value>,
13539 {
13540 self.plaintext_crc32c = v.map(|x| x.into());
13541 self
13542 }
13543
13544 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13545 ///
13546 /// # Example
13547 /// ```ignore,no_run
13548 /// # use google_cloud_kms_v1::model::EncryptRequest;
13549 /// use wkt::Int64Value;
13550 /// let x = EncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13551 /// ```
13552 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13553 where
13554 T: std::convert::Into<wkt::Int64Value>,
13555 {
13556 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13557 self
13558 }
13559
13560 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::EncryptRequest::additional_authenticated_data_crc32c].
13561 ///
13562 /// # Example
13563 /// ```ignore,no_run
13564 /// # use google_cloud_kms_v1::model::EncryptRequest;
13565 /// use wkt::Int64Value;
13566 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13567 /// let x = EncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13568 /// ```
13569 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13570 mut self,
13571 v: std::option::Option<T>,
13572 ) -> Self
13573 where
13574 T: std::convert::Into<wkt::Int64Value>,
13575 {
13576 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13577 self
13578 }
13579}
13580
13581impl wkt::message::Message for EncryptRequest {
13582 fn typename() -> &'static str {
13583 "type.googleapis.com/google.cloud.kms.v1.EncryptRequest"
13584 }
13585}
13586
13587/// Request message for
13588/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
13589///
13590/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
13591#[derive(Clone, Default, PartialEq)]
13592#[non_exhaustive]
13593pub struct DecryptRequest {
13594 /// Required. The resource name of the
13595 /// [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The
13596 /// server will choose the appropriate version.
13597 ///
13598 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
13599 pub name: std::string::String,
13600
13601 /// Required. The encrypted data originally returned in
13602 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
13603 ///
13604 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
13605 pub ciphertext: ::bytes::Bytes,
13606
13607 /// Optional. Optional data that must match the data originally supplied in
13608 /// [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data].
13609 ///
13610 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
13611 pub additional_authenticated_data: ::bytes::Bytes,
13612
13613 /// Optional. An optional CRC32C checksum of the
13614 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext].
13615 /// If specified,
13616 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13617 /// verify the integrity of the received
13618 /// [DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]
13619 /// using this checksum.
13620 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13621 /// report an error if the checksum verification fails. If you receive a
13622 /// checksum error, your client should verify that
13623 /// CRC32C([DecryptRequest.ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext])
13624 /// is equal to
13625 /// [DecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c],
13626 /// and if so, perform a limited number of retries. A persistent mismatch may
13627 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13628 /// field is defined as int64 for reasons of compatibility across different
13629 /// languages. However, it is a non-negative integer, which will never exceed
13630 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13631 /// this type.
13632 ///
13633 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
13634 /// [google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c]: crate::model::DecryptRequest::ciphertext_crc32c
13635 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13636 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
13637
13638 /// Optional. An optional CRC32C checksum of the
13639 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data].
13640 /// If specified,
13641 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13642 /// verify the integrity of the received
13643 /// [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]
13644 /// using this checksum.
13645 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13646 /// report an error if the checksum verification fails. If you receive a
13647 /// checksum error, your client should verify that
13648 /// CRC32C([DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data])
13649 /// is equal to
13650 /// [DecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c],
13651 /// and if so, perform a limited number of retries. A persistent mismatch may
13652 /// indicate an issue in your computation of the CRC32C checksum. Note: This
13653 /// field is defined as int64 for reasons of compatibility across different
13654 /// languages. However, it is a non-negative integer, which will never exceed
13655 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
13656 /// this type.
13657 ///
13658 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]: crate::model::DecryptRequest::additional_authenticated_data
13659 /// [google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c]: crate::model::DecryptRequest::additional_authenticated_data_crc32c
13660 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13661 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13662
13663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13664}
13665
13666impl DecryptRequest {
13667 /// Creates a new default instance.
13668 pub fn new() -> Self {
13669 std::default::Default::default()
13670 }
13671
13672 /// Sets the value of [name][crate::model::DecryptRequest::name].
13673 ///
13674 /// # Example
13675 /// ```ignore,no_run
13676 /// # use google_cloud_kms_v1::model::DecryptRequest;
13677 /// # let project_id = "project_id";
13678 /// # let location_id = "location_id";
13679 /// # let key_ring_id = "key_ring_id";
13680 /// # let crypto_key_id = "crypto_key_id";
13681 /// let x = DecryptRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}"));
13682 /// ```
13683 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13684 self.name = v.into();
13685 self
13686 }
13687
13688 /// Sets the value of [ciphertext][crate::model::DecryptRequest::ciphertext].
13689 ///
13690 /// # Example
13691 /// ```ignore,no_run
13692 /// # use google_cloud_kms_v1::model::DecryptRequest;
13693 /// let x = DecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
13694 /// ```
13695 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13696 self.ciphertext = v.into();
13697 self
13698 }
13699
13700 /// Sets the value of [additional_authenticated_data][crate::model::DecryptRequest::additional_authenticated_data].
13701 ///
13702 /// # Example
13703 /// ```ignore,no_run
13704 /// # use google_cloud_kms_v1::model::DecryptRequest;
13705 /// let x = DecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13706 /// ```
13707 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13708 mut self,
13709 v: T,
13710 ) -> Self {
13711 self.additional_authenticated_data = v.into();
13712 self
13713 }
13714
13715 /// Sets the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13716 ///
13717 /// # Example
13718 /// ```ignore,no_run
13719 /// # use google_cloud_kms_v1::model::DecryptRequest;
13720 /// use wkt::Int64Value;
13721 /// let x = DecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
13722 /// ```
13723 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
13724 where
13725 T: std::convert::Into<wkt::Int64Value>,
13726 {
13727 self.ciphertext_crc32c = std::option::Option::Some(v.into());
13728 self
13729 }
13730
13731 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecryptRequest::ciphertext_crc32c].
13732 ///
13733 /// # Example
13734 /// ```ignore,no_run
13735 /// # use google_cloud_kms_v1::model::DecryptRequest;
13736 /// use wkt::Int64Value;
13737 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
13738 /// let x = DecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
13739 /// ```
13740 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13741 where
13742 T: std::convert::Into<wkt::Int64Value>,
13743 {
13744 self.ciphertext_crc32c = v.map(|x| x.into());
13745 self
13746 }
13747
13748 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13749 ///
13750 /// # Example
13751 /// ```ignore,no_run
13752 /// # use google_cloud_kms_v1::model::DecryptRequest;
13753 /// use wkt::Int64Value;
13754 /// let x = DecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
13755 /// ```
13756 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
13757 where
13758 T: std::convert::Into<wkt::Int64Value>,
13759 {
13760 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
13761 self
13762 }
13763
13764 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::DecryptRequest::additional_authenticated_data_crc32c].
13765 ///
13766 /// # Example
13767 /// ```ignore,no_run
13768 /// # use google_cloud_kms_v1::model::DecryptRequest;
13769 /// use wkt::Int64Value;
13770 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
13771 /// let x = DecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
13772 /// ```
13773 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
13774 mut self,
13775 v: std::option::Option<T>,
13776 ) -> Self
13777 where
13778 T: std::convert::Into<wkt::Int64Value>,
13779 {
13780 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
13781 self
13782 }
13783}
13784
13785impl wkt::message::Message for DecryptRequest {
13786 fn typename() -> &'static str {
13787 "type.googleapis.com/google.cloud.kms.v1.DecryptRequest"
13788 }
13789}
13790
13791/// Request message for
13792/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
13793///
13794/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
13795#[derive(Clone, Default, PartialEq)]
13796#[non_exhaustive]
13797pub struct RawEncryptRequest {
13798 /// Required. The resource name of the
13799 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
13800 /// encryption.
13801 ///
13802 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
13803 pub name: std::string::String,
13804
13805 /// Required. The data to encrypt. Must be no larger than 64KiB.
13806 ///
13807 /// The maximum size depends on the key version's
13808 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13809 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13810 /// plaintext must be no larger than 64KiB. For
13811 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13812 /// the plaintext and additional_authenticated_data fields must be no larger
13813 /// than 8KiB.
13814 ///
13815 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13816 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13817 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13818 pub plaintext: ::bytes::Bytes,
13819
13820 /// Optional. Optional data that, if specified, must also be provided during
13821 /// decryption through
13822 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
13823 ///
13824 /// This field may only be used in conjunction with an
13825 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm] that accepts
13826 /// additional authenticated data (for example, AES-GCM).
13827 ///
13828 /// The maximum size depends on the key version's
13829 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level].
13830 /// For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the
13831 /// plaintext must be no larger than 64KiB. For
13832 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of
13833 /// the plaintext and additional_authenticated_data fields must be no larger
13834 /// than 8KiB.
13835 ///
13836 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
13837 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
13838 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
13839 /// [google.cloud.kms.v1.ProtectionLevel.SOFTWARE]: crate::model::ProtectionLevel::Software
13840 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
13841 pub additional_authenticated_data: ::bytes::Bytes,
13842
13843 /// Optional. An optional CRC32C checksum of the
13844 /// [RawEncryptRequest.plaintext][google.cloud.kms.v1.RawEncryptRequest.plaintext].
13845 /// If specified,
13846 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13847 /// verify the integrity of the received plaintext using this checksum.
13848 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13849 /// report an error if the checksum verification fails. If you receive a
13850 /// checksum error, your client should verify that CRC32C(plaintext) is equal
13851 /// to plaintext_crc32c, and if so, perform a limited number of retries. A
13852 /// persistent mismatch may indicate an issue in your computation of the CRC32C
13853 /// checksum. Note: This field is defined as int64 for reasons of compatibility
13854 /// across different languages. However, it is a non-negative integer, which
13855 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
13856 /// languages that support this type.
13857 ///
13858 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13859 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext]: crate::model::RawEncryptRequest::plaintext
13860 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
13861
13862 /// Optional. An optional CRC32C checksum of the
13863 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
13864 /// If specified,
13865 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13866 /// verify the integrity of the received additional_authenticated_data using
13867 /// this checksum.
13868 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13869 /// report an error if the checksum verification fails. If you receive a
13870 /// checksum error, your client should verify that
13871 /// CRC32C(additional_authenticated_data) is equal to
13872 /// additional_authenticated_data_crc32c, and if so, perform
13873 /// a limited number of retries. A persistent mismatch may indicate an issue in
13874 /// your computation of the CRC32C checksum.
13875 /// Note: This field is defined as int64 for reasons of compatibility across
13876 /// different languages. However, it is a non-negative integer, which will
13877 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13878 /// that support this type.
13879 ///
13880 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13881 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
13882 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
13883
13884 /// Optional. A customer-supplied initialization vector that will be used for
13885 /// encryption. If it is not provided for AES-CBC and AES-CTR, one will be
13886 /// generated. It will be returned in
13887 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
13888 ///
13889 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
13890 pub initialization_vector: ::bytes::Bytes,
13891
13892 /// Optional. An optional CRC32C checksum of the
13893 /// [RawEncryptRequest.initialization_vector][google.cloud.kms.v1.RawEncryptRequest.initialization_vector].
13894 /// If specified,
13895 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
13896 /// verify the integrity of the received initialization_vector using this
13897 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
13898 /// will report an error if the checksum verification fails. If you receive a
13899 /// checksum error, your client should verify that
13900 /// CRC32C(initialization_vector) is equal to
13901 /// initialization_vector_crc32c, and if so, perform
13902 /// a limited number of retries. A persistent mismatch may indicate an issue in
13903 /// your computation of the CRC32C checksum.
13904 /// Note: This field is defined as int64 for reasons of compatibility across
13905 /// different languages. However, it is a non-negative integer, which will
13906 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
13907 /// that support this type.
13908 ///
13909 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
13910 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector]: crate::model::RawEncryptRequest::initialization_vector
13911 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
13912
13913 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13914}
13915
13916impl RawEncryptRequest {
13917 /// Creates a new default instance.
13918 pub fn new() -> Self {
13919 std::default::Default::default()
13920 }
13921
13922 /// Sets the value of [name][crate::model::RawEncryptRequest::name].
13923 ///
13924 /// # Example
13925 /// ```ignore,no_run
13926 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13927 /// let x = RawEncryptRequest::new().set_name("example");
13928 /// ```
13929 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13930 self.name = v.into();
13931 self
13932 }
13933
13934 /// Sets the value of [plaintext][crate::model::RawEncryptRequest::plaintext].
13935 ///
13936 /// # Example
13937 /// ```ignore,no_run
13938 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13939 /// let x = RawEncryptRequest::new().set_plaintext(bytes::Bytes::from_static(b"example"));
13940 /// ```
13941 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
13942 self.plaintext = v.into();
13943 self
13944 }
13945
13946 /// Sets the value of [additional_authenticated_data][crate::model::RawEncryptRequest::additional_authenticated_data].
13947 ///
13948 /// # Example
13949 /// ```ignore,no_run
13950 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13951 /// let x = RawEncryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
13952 /// ```
13953 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
13954 mut self,
13955 v: T,
13956 ) -> Self {
13957 self.additional_authenticated_data = v.into();
13958 self
13959 }
13960
13961 /// Sets the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13962 ///
13963 /// # Example
13964 /// ```ignore,no_run
13965 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13966 /// use wkt::Int64Value;
13967 /// let x = RawEncryptRequest::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
13968 /// ```
13969 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
13970 where
13971 T: std::convert::Into<wkt::Int64Value>,
13972 {
13973 self.plaintext_crc32c = std::option::Option::Some(v.into());
13974 self
13975 }
13976
13977 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawEncryptRequest::plaintext_crc32c].
13978 ///
13979 /// # Example
13980 /// ```ignore,no_run
13981 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13982 /// use wkt::Int64Value;
13983 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
13984 /// let x = RawEncryptRequest::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
13985 /// ```
13986 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
13987 where
13988 T: std::convert::Into<wkt::Int64Value>,
13989 {
13990 self.plaintext_crc32c = v.map(|x| x.into());
13991 self
13992 }
13993
13994 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
13995 ///
13996 /// # Example
13997 /// ```ignore,no_run
13998 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
13999 /// use wkt::Int64Value;
14000 /// let x = RawEncryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14001 /// ```
14002 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14003 where
14004 T: std::convert::Into<wkt::Int64Value>,
14005 {
14006 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14007 self
14008 }
14009
14010 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawEncryptRequest::additional_authenticated_data_crc32c].
14011 ///
14012 /// # Example
14013 /// ```ignore,no_run
14014 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14015 /// use wkt::Int64Value;
14016 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14017 /// let x = RawEncryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14018 /// ```
14019 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14020 mut self,
14021 v: std::option::Option<T>,
14022 ) -> Self
14023 where
14024 T: std::convert::Into<wkt::Int64Value>,
14025 {
14026 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14027 self
14028 }
14029
14030 /// Sets the value of [initialization_vector][crate::model::RawEncryptRequest::initialization_vector].
14031 ///
14032 /// # Example
14033 /// ```ignore,no_run
14034 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14035 /// let x = RawEncryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14036 /// ```
14037 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14038 mut self,
14039 v: T,
14040 ) -> Self {
14041 self.initialization_vector = v.into();
14042 self
14043 }
14044
14045 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
14046 ///
14047 /// # Example
14048 /// ```ignore,no_run
14049 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14050 /// use wkt::Int64Value;
14051 /// let x = RawEncryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14052 /// ```
14053 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14054 where
14055 T: std::convert::Into<wkt::Int64Value>,
14056 {
14057 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14058 self
14059 }
14060
14061 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptRequest::initialization_vector_crc32c].
14062 ///
14063 /// # Example
14064 /// ```ignore,no_run
14065 /// # use google_cloud_kms_v1::model::RawEncryptRequest;
14066 /// use wkt::Int64Value;
14067 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14068 /// let x = RawEncryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14069 /// ```
14070 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14071 where
14072 T: std::convert::Into<wkt::Int64Value>,
14073 {
14074 self.initialization_vector_crc32c = v.map(|x| x.into());
14075 self
14076 }
14077}
14078
14079impl wkt::message::Message for RawEncryptRequest {
14080 fn typename() -> &'static str {
14081 "type.googleapis.com/google.cloud.kms.v1.RawEncryptRequest"
14082 }
14083}
14084
14085/// Request message for
14086/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
14087///
14088/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
14089#[derive(Clone, Default, PartialEq)]
14090#[non_exhaustive]
14091pub struct RawDecryptRequest {
14092 /// Required. The resource name of the
14093 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14094 /// decryption.
14095 ///
14096 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14097 pub name: std::string::String,
14098
14099 /// Required. The encrypted data originally returned in
14100 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
14101 ///
14102 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
14103 pub ciphertext: ::bytes::Bytes,
14104
14105 /// Optional. Optional data that must match the data originally supplied in
14106 /// [RawEncryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data].
14107 ///
14108 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data]: crate::model::RawEncryptRequest::additional_authenticated_data
14109 pub additional_authenticated_data: ::bytes::Bytes,
14110
14111 /// Required. The initialization vector (IV) used during encryption, which must
14112 /// match the data originally provided in
14113 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
14114 ///
14115 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
14116 pub initialization_vector: ::bytes::Bytes,
14117
14118 /// The length of the authentication tag that is appended to the end of
14119 /// the ciphertext. If unspecified (0), the default value for the key's
14120 /// algorithm will be used (for AES-GCM, the default value is 16).
14121 pub tag_length: i32,
14122
14123 /// Optional. An optional CRC32C checksum of the
14124 /// [RawDecryptRequest.ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
14125 /// If specified,
14126 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14127 /// verify the integrity of the received ciphertext using this checksum.
14128 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14129 /// report an error if the checksum verification fails. If you receive a
14130 /// checksum error, your client should verify that CRC32C(ciphertext) is equal
14131 /// to ciphertext_crc32c, and if so, perform a limited number of retries. A
14132 /// persistent mismatch may indicate an issue in your computation of the CRC32C
14133 /// checksum. Note: This field is defined as int64 for reasons of compatibility
14134 /// across different languages. However, it is a non-negative integer, which
14135 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
14136 /// languages that support this type.
14137 ///
14138 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14139 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
14140 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14141
14142 /// Optional. An optional CRC32C checksum of the
14143 /// [RawDecryptRequest.additional_authenticated_data][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data].
14144 /// If specified,
14145 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14146 /// verify the integrity of the received additional_authenticated_data using
14147 /// this checksum.
14148 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14149 /// report an error if the checksum verification fails. If you receive a
14150 /// checksum error, your client should verify that
14151 /// CRC32C(additional_authenticated_data) is equal to
14152 /// additional_authenticated_data_crc32c, and if so, perform
14153 /// a limited number of retries. A persistent mismatch may indicate an issue in
14154 /// your computation of the CRC32C checksum.
14155 /// Note: This field is defined as int64 for reasons of compatibility across
14156 /// different languages. However, it is a non-negative integer, which will
14157 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14158 /// that support this type.
14159 ///
14160 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14161 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data]: crate::model::RawDecryptRequest::additional_authenticated_data
14162 pub additional_authenticated_data_crc32c: std::option::Option<wkt::Int64Value>,
14163
14164 /// Optional. An optional CRC32C checksum of the
14165 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector].
14166 /// If specified,
14167 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14168 /// verify the integrity of the received initialization_vector using this
14169 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14170 /// will report an error if the checksum verification fails. If you receive a
14171 /// checksum error, your client should verify that
14172 /// CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
14173 /// if so, perform a limited number of retries. A persistent mismatch may
14174 /// indicate an issue in your computation of the CRC32C checksum.
14175 /// Note: This field is defined as int64 for reasons of compatibility across
14176 /// different languages. However, it is a non-negative integer, which will
14177 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
14178 /// that support this type.
14179 ///
14180 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14181 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
14182 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
14183
14184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14185}
14186
14187impl RawDecryptRequest {
14188 /// Creates a new default instance.
14189 pub fn new() -> Self {
14190 std::default::Default::default()
14191 }
14192
14193 /// Sets the value of [name][crate::model::RawDecryptRequest::name].
14194 ///
14195 /// # Example
14196 /// ```ignore,no_run
14197 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14198 /// let x = RawDecryptRequest::new().set_name("example");
14199 /// ```
14200 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14201 self.name = v.into();
14202 self
14203 }
14204
14205 /// Sets the value of [ciphertext][crate::model::RawDecryptRequest::ciphertext].
14206 ///
14207 /// # Example
14208 /// ```ignore,no_run
14209 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14210 /// let x = RawDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14211 /// ```
14212 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14213 self.ciphertext = v.into();
14214 self
14215 }
14216
14217 /// Sets the value of [additional_authenticated_data][crate::model::RawDecryptRequest::additional_authenticated_data].
14218 ///
14219 /// # Example
14220 /// ```ignore,no_run
14221 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14222 /// let x = RawDecryptRequest::new().set_additional_authenticated_data(bytes::Bytes::from_static(b"example"));
14223 /// ```
14224 pub fn set_additional_authenticated_data<T: std::convert::Into<::bytes::Bytes>>(
14225 mut self,
14226 v: T,
14227 ) -> Self {
14228 self.additional_authenticated_data = v.into();
14229 self
14230 }
14231
14232 /// Sets the value of [initialization_vector][crate::model::RawDecryptRequest::initialization_vector].
14233 ///
14234 /// # Example
14235 /// ```ignore,no_run
14236 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14237 /// let x = RawDecryptRequest::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
14238 /// ```
14239 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
14240 mut self,
14241 v: T,
14242 ) -> Self {
14243 self.initialization_vector = v.into();
14244 self
14245 }
14246
14247 /// Sets the value of [tag_length][crate::model::RawDecryptRequest::tag_length].
14248 ///
14249 /// # Example
14250 /// ```ignore,no_run
14251 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14252 /// let x = RawDecryptRequest::new().set_tag_length(42);
14253 /// ```
14254 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14255 self.tag_length = v.into();
14256 self
14257 }
14258
14259 /// Sets the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14260 ///
14261 /// # Example
14262 /// ```ignore,no_run
14263 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14264 /// use wkt::Int64Value;
14265 /// let x = RawDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14266 /// ```
14267 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14268 where
14269 T: std::convert::Into<wkt::Int64Value>,
14270 {
14271 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14272 self
14273 }
14274
14275 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawDecryptRequest::ciphertext_crc32c].
14276 ///
14277 /// # Example
14278 /// ```ignore,no_run
14279 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14280 /// use wkt::Int64Value;
14281 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14282 /// let x = RawDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14283 /// ```
14284 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14285 where
14286 T: std::convert::Into<wkt::Int64Value>,
14287 {
14288 self.ciphertext_crc32c = v.map(|x| x.into());
14289 self
14290 }
14291
14292 /// Sets the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14293 ///
14294 /// # Example
14295 /// ```ignore,no_run
14296 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14297 /// use wkt::Int64Value;
14298 /// let x = RawDecryptRequest::new().set_additional_authenticated_data_crc32c(Int64Value::default()/* use setters */);
14299 /// ```
14300 pub fn set_additional_authenticated_data_crc32c<T>(mut self, v: T) -> Self
14301 where
14302 T: std::convert::Into<wkt::Int64Value>,
14303 {
14304 self.additional_authenticated_data_crc32c = std::option::Option::Some(v.into());
14305 self
14306 }
14307
14308 /// Sets or clears the value of [additional_authenticated_data_crc32c][crate::model::RawDecryptRequest::additional_authenticated_data_crc32c].
14309 ///
14310 /// # Example
14311 /// ```ignore,no_run
14312 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14313 /// use wkt::Int64Value;
14314 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(Some(Int64Value::default()/* use setters */));
14315 /// let x = RawDecryptRequest::new().set_or_clear_additional_authenticated_data_crc32c(None::<Int64Value>);
14316 /// ```
14317 pub fn set_or_clear_additional_authenticated_data_crc32c<T>(
14318 mut self,
14319 v: std::option::Option<T>,
14320 ) -> Self
14321 where
14322 T: std::convert::Into<wkt::Int64Value>,
14323 {
14324 self.additional_authenticated_data_crc32c = v.map(|x| x.into());
14325 self
14326 }
14327
14328 /// Sets the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14329 ///
14330 /// # Example
14331 /// ```ignore,no_run
14332 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14333 /// use wkt::Int64Value;
14334 /// let x = RawDecryptRequest::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
14335 /// ```
14336 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
14337 where
14338 T: std::convert::Into<wkt::Int64Value>,
14339 {
14340 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
14341 self
14342 }
14343
14344 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawDecryptRequest::initialization_vector_crc32c].
14345 ///
14346 /// # Example
14347 /// ```ignore,no_run
14348 /// # use google_cloud_kms_v1::model::RawDecryptRequest;
14349 /// use wkt::Int64Value;
14350 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
14351 /// let x = RawDecryptRequest::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
14352 /// ```
14353 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14354 where
14355 T: std::convert::Into<wkt::Int64Value>,
14356 {
14357 self.initialization_vector_crc32c = v.map(|x| x.into());
14358 self
14359 }
14360}
14361
14362impl wkt::message::Message for RawDecryptRequest {
14363 fn typename() -> &'static str {
14364 "type.googleapis.com/google.cloud.kms.v1.RawDecryptRequest"
14365 }
14366}
14367
14368/// Request message for
14369/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
14370///
14371/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
14372#[derive(Clone, Default, PartialEq)]
14373#[non_exhaustive]
14374pub struct AsymmetricSignRequest {
14375 /// Required. The resource name of the
14376 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14377 /// signing.
14378 ///
14379 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14380 pub name: std::string::String,
14381
14382 /// Optional. The digest of the data to sign. The digest must be produced with
14383 /// the same digest algorithm as specified by the key version's
14384 /// [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm].
14385 ///
14386 /// This field may not be supplied if
14387 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14388 /// is supplied.
14389 ///
14390 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14391 /// [google.cloud.kms.v1.CryptoKeyVersion.algorithm]: crate::model::CryptoKeyVersion::algorithm
14392 pub digest: std::option::Option<crate::model::Digest>,
14393
14394 /// Optional. An optional CRC32C checksum of the
14395 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest].
14396 /// If specified,
14397 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14398 /// verify the integrity of the received
14399 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14400 /// using this checksum.
14401 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14402 /// report an error if the checksum verification fails. If you receive a
14403 /// checksum error, your client should verify that
14404 /// CRC32C([AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest])
14405 /// is equal to
14406 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c],
14407 /// and if so, perform a limited number of retries. A persistent mismatch may
14408 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14409 /// field is defined as int64 for reasons of compatibility across different
14410 /// languages. However, it is a non-negative integer, which will never exceed
14411 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14412 /// this type.
14413 ///
14414 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14415 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
14416 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14417 pub digest_crc32c: std::option::Option<wkt::Int64Value>,
14418
14419 /// Optional. The data to sign.
14420 /// It can't be supplied if
14421 /// [AsymmetricSignRequest.digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]
14422 /// is supplied.
14423 ///
14424 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
14425 pub data: ::bytes::Bytes,
14426
14427 /// Optional. An optional CRC32C checksum of the
14428 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data].
14429 /// If specified,
14430 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14431 /// verify the integrity of the received
14432 /// [AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data]
14433 /// using this checksum.
14434 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14435 /// report an error if the checksum verification fails. If you receive a
14436 /// checksum error, your client should verify that
14437 /// CRC32C([AsymmetricSignRequest.data][google.cloud.kms.v1.AsymmetricSignRequest.data])
14438 /// is equal to
14439 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c],
14440 /// and if so, perform a limited number of retries. A persistent mismatch may
14441 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14442 /// field is defined as int64 for reasons of compatibility across different
14443 /// languages. However, it is a non-negative integer, which will never exceed
14444 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14445 /// this type.
14446 ///
14447 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
14448 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
14449 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14450 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14451
14452 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14453}
14454
14455impl AsymmetricSignRequest {
14456 /// Creates a new default instance.
14457 pub fn new() -> Self {
14458 std::default::Default::default()
14459 }
14460
14461 /// Sets the value of [name][crate::model::AsymmetricSignRequest::name].
14462 ///
14463 /// # Example
14464 /// ```ignore,no_run
14465 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14466 /// # let project_id = "project_id";
14467 /// # let location_id = "location_id";
14468 /// # let key_ring_id = "key_ring_id";
14469 /// # let crypto_key_id = "crypto_key_id";
14470 /// # let crypto_key_version_id = "crypto_key_version_id";
14471 /// let x = AsymmetricSignRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14472 /// ```
14473 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14474 self.name = v.into();
14475 self
14476 }
14477
14478 /// Sets the value of [digest][crate::model::AsymmetricSignRequest::digest].
14479 ///
14480 /// # Example
14481 /// ```ignore,no_run
14482 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14483 /// use google_cloud_kms_v1::model::Digest;
14484 /// let x = AsymmetricSignRequest::new().set_digest(Digest::default()/* use setters */);
14485 /// ```
14486 pub fn set_digest<T>(mut self, v: T) -> Self
14487 where
14488 T: std::convert::Into<crate::model::Digest>,
14489 {
14490 self.digest = std::option::Option::Some(v.into());
14491 self
14492 }
14493
14494 /// Sets or clears the value of [digest][crate::model::AsymmetricSignRequest::digest].
14495 ///
14496 /// # Example
14497 /// ```ignore,no_run
14498 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14499 /// use google_cloud_kms_v1::model::Digest;
14500 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(Some(Digest::default()/* use setters */));
14501 /// let x = AsymmetricSignRequest::new().set_or_clear_digest(None::<Digest>);
14502 /// ```
14503 pub fn set_or_clear_digest<T>(mut self, v: std::option::Option<T>) -> Self
14504 where
14505 T: std::convert::Into<crate::model::Digest>,
14506 {
14507 self.digest = v.map(|x| x.into());
14508 self
14509 }
14510
14511 /// Sets the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14512 ///
14513 /// # Example
14514 /// ```ignore,no_run
14515 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14516 /// use wkt::Int64Value;
14517 /// let x = AsymmetricSignRequest::new().set_digest_crc32c(Int64Value::default()/* use setters */);
14518 /// ```
14519 pub fn set_digest_crc32c<T>(mut self, v: T) -> Self
14520 where
14521 T: std::convert::Into<wkt::Int64Value>,
14522 {
14523 self.digest_crc32c = std::option::Option::Some(v.into());
14524 self
14525 }
14526
14527 /// Sets or clears the value of [digest_crc32c][crate::model::AsymmetricSignRequest::digest_crc32c].
14528 ///
14529 /// # Example
14530 /// ```ignore,no_run
14531 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14532 /// use wkt::Int64Value;
14533 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(Some(Int64Value::default()/* use setters */));
14534 /// let x = AsymmetricSignRequest::new().set_or_clear_digest_crc32c(None::<Int64Value>);
14535 /// ```
14536 pub fn set_or_clear_digest_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14537 where
14538 T: std::convert::Into<wkt::Int64Value>,
14539 {
14540 self.digest_crc32c = v.map(|x| x.into());
14541 self
14542 }
14543
14544 /// Sets the value of [data][crate::model::AsymmetricSignRequest::data].
14545 ///
14546 /// # Example
14547 /// ```ignore,no_run
14548 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14549 /// let x = AsymmetricSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14550 /// ```
14551 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14552 self.data = v.into();
14553 self
14554 }
14555
14556 /// Sets the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14557 ///
14558 /// # Example
14559 /// ```ignore,no_run
14560 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14561 /// use wkt::Int64Value;
14562 /// let x = AsymmetricSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14563 /// ```
14564 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14565 where
14566 T: std::convert::Into<wkt::Int64Value>,
14567 {
14568 self.data_crc32c = std::option::Option::Some(v.into());
14569 self
14570 }
14571
14572 /// Sets or clears the value of [data_crc32c][crate::model::AsymmetricSignRequest::data_crc32c].
14573 ///
14574 /// # Example
14575 /// ```ignore,no_run
14576 /// # use google_cloud_kms_v1::model::AsymmetricSignRequest;
14577 /// use wkt::Int64Value;
14578 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14579 /// let x = AsymmetricSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14580 /// ```
14581 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14582 where
14583 T: std::convert::Into<wkt::Int64Value>,
14584 {
14585 self.data_crc32c = v.map(|x| x.into());
14586 self
14587 }
14588}
14589
14590impl wkt::message::Message for AsymmetricSignRequest {
14591 fn typename() -> &'static str {
14592 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignRequest"
14593 }
14594}
14595
14596/// Request message for
14597/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
14598///
14599/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
14600#[derive(Clone, Default, PartialEq)]
14601#[non_exhaustive]
14602pub struct AsymmetricDecryptRequest {
14603 /// Required. The resource name of the
14604 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14605 /// decryption.
14606 ///
14607 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14608 pub name: std::string::String,
14609
14610 /// Required. The data encrypted with the named
14611 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using
14612 /// OAEP.
14613 ///
14614 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14615 pub ciphertext: ::bytes::Bytes,
14616
14617 /// Optional. An optional CRC32C checksum of the
14618 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext].
14619 /// If specified,
14620 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14621 /// verify the integrity of the received
14622 /// [AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]
14623 /// using this checksum.
14624 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14625 /// report an error if the checksum verification fails. If you receive a
14626 /// checksum error, your client should verify that
14627 /// CRC32C([AsymmetricDecryptRequest.ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext])
14628 /// is equal to
14629 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c],
14630 /// and if so, perform a limited number of retries. A persistent mismatch may
14631 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14632 /// field is defined as int64 for reasons of compatibility across different
14633 /// languages. However, it is a non-negative integer, which will never exceed
14634 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14635 /// this type.
14636 ///
14637 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
14638 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
14639 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14640 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
14641
14642 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14643}
14644
14645impl AsymmetricDecryptRequest {
14646 /// Creates a new default instance.
14647 pub fn new() -> Self {
14648 std::default::Default::default()
14649 }
14650
14651 /// Sets the value of [name][crate::model::AsymmetricDecryptRequest::name].
14652 ///
14653 /// # Example
14654 /// ```ignore,no_run
14655 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14656 /// # let project_id = "project_id";
14657 /// # let location_id = "location_id";
14658 /// # let key_ring_id = "key_ring_id";
14659 /// # let crypto_key_id = "crypto_key_id";
14660 /// # let crypto_key_version_id = "crypto_key_version_id";
14661 /// let x = AsymmetricDecryptRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14662 /// ```
14663 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14664 self.name = v.into();
14665 self
14666 }
14667
14668 /// Sets the value of [ciphertext][crate::model::AsymmetricDecryptRequest::ciphertext].
14669 ///
14670 /// # Example
14671 /// ```ignore,no_run
14672 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14673 /// let x = AsymmetricDecryptRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
14674 /// ```
14675 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14676 self.ciphertext = v.into();
14677 self
14678 }
14679
14680 /// Sets the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14681 ///
14682 /// # Example
14683 /// ```ignore,no_run
14684 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14685 /// use wkt::Int64Value;
14686 /// let x = AsymmetricDecryptRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
14687 /// ```
14688 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
14689 where
14690 T: std::convert::Into<wkt::Int64Value>,
14691 {
14692 self.ciphertext_crc32c = std::option::Option::Some(v.into());
14693 self
14694 }
14695
14696 /// Sets or clears the value of [ciphertext_crc32c][crate::model::AsymmetricDecryptRequest::ciphertext_crc32c].
14697 ///
14698 /// # Example
14699 /// ```ignore,no_run
14700 /// # use google_cloud_kms_v1::model::AsymmetricDecryptRequest;
14701 /// use wkt::Int64Value;
14702 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
14703 /// let x = AsymmetricDecryptRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
14704 /// ```
14705 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14706 where
14707 T: std::convert::Into<wkt::Int64Value>,
14708 {
14709 self.ciphertext_crc32c = v.map(|x| x.into());
14710 self
14711 }
14712}
14713
14714impl wkt::message::Message for AsymmetricDecryptRequest {
14715 fn typename() -> &'static str {
14716 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptRequest"
14717 }
14718}
14719
14720/// Request message for
14721/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
14722///
14723/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
14724#[derive(Clone, Default, PartialEq)]
14725#[non_exhaustive]
14726pub struct MacSignRequest {
14727 /// Required. The resource name of the
14728 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14729 /// signing.
14730 ///
14731 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14732 pub name: std::string::String,
14733
14734 /// Required. The data to sign. The MAC tag is computed over this data field
14735 /// based on the specific algorithm.
14736 pub data: ::bytes::Bytes,
14737
14738 /// Optional. An optional CRC32C checksum of the
14739 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]. If
14740 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14741 /// will verify the integrity of the received
14742 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] using this
14743 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14744 /// will report an error if the checksum verification fails. If you receive a
14745 /// checksum error, your client should verify that
14746 /// CRC32C([MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data]) is
14747 /// equal to
14748 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c],
14749 /// and if so, perform a limited number of retries. A persistent mismatch may
14750 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14751 /// field is defined as int64 for reasons of compatibility across different
14752 /// languages. However, it is a non-negative integer, which will never exceed
14753 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14754 /// this type.
14755 ///
14756 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14757 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14758 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
14759 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14760
14761 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14762}
14763
14764impl MacSignRequest {
14765 /// Creates a new default instance.
14766 pub fn new() -> Self {
14767 std::default::Default::default()
14768 }
14769
14770 /// Sets the value of [name][crate::model::MacSignRequest::name].
14771 ///
14772 /// # Example
14773 /// ```ignore,no_run
14774 /// # use google_cloud_kms_v1::model::MacSignRequest;
14775 /// # let project_id = "project_id";
14776 /// # let location_id = "location_id";
14777 /// # let key_ring_id = "key_ring_id";
14778 /// # let crypto_key_id = "crypto_key_id";
14779 /// # let crypto_key_version_id = "crypto_key_version_id";
14780 /// let x = MacSignRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14781 /// ```
14782 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14783 self.name = v.into();
14784 self
14785 }
14786
14787 /// Sets the value of [data][crate::model::MacSignRequest::data].
14788 ///
14789 /// # Example
14790 /// ```ignore,no_run
14791 /// # use google_cloud_kms_v1::model::MacSignRequest;
14792 /// let x = MacSignRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14793 /// ```
14794 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14795 self.data = v.into();
14796 self
14797 }
14798
14799 /// Sets the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14800 ///
14801 /// # Example
14802 /// ```ignore,no_run
14803 /// # use google_cloud_kms_v1::model::MacSignRequest;
14804 /// use wkt::Int64Value;
14805 /// let x = MacSignRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14806 /// ```
14807 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14808 where
14809 T: std::convert::Into<wkt::Int64Value>,
14810 {
14811 self.data_crc32c = std::option::Option::Some(v.into());
14812 self
14813 }
14814
14815 /// Sets or clears the value of [data_crc32c][crate::model::MacSignRequest::data_crc32c].
14816 ///
14817 /// # Example
14818 /// ```ignore,no_run
14819 /// # use google_cloud_kms_v1::model::MacSignRequest;
14820 /// use wkt::Int64Value;
14821 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14822 /// let x = MacSignRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14823 /// ```
14824 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14825 where
14826 T: std::convert::Into<wkt::Int64Value>,
14827 {
14828 self.data_crc32c = v.map(|x| x.into());
14829 self
14830 }
14831}
14832
14833impl wkt::message::Message for MacSignRequest {
14834 fn typename() -> &'static str {
14835 "type.googleapis.com/google.cloud.kms.v1.MacSignRequest"
14836 }
14837}
14838
14839/// Request message for
14840/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
14841///
14842/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
14843#[derive(Clone, Default, PartialEq)]
14844#[non_exhaustive]
14845pub struct MacVerifyRequest {
14846 /// Required. The resource name of the
14847 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
14848 /// verification.
14849 ///
14850 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
14851 pub name: std::string::String,
14852
14853 /// Required. The data used previously as a
14854 /// [MacSignRequest.data][google.cloud.kms.v1.MacSignRequest.data] to generate
14855 /// the MAC tag.
14856 ///
14857 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
14858 pub data: ::bytes::Bytes,
14859
14860 /// Optional. An optional CRC32C checksum of the
14861 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data]. If
14862 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14863 /// will verify the integrity of the received
14864 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] using
14865 /// this checksum.
14866 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
14867 /// report an error if the checksum verification fails. If you receive a
14868 /// checksum error, your client should verify that
14869 /// CRC32C([MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data])
14870 /// is equal to
14871 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c],
14872 /// and if so, perform a limited number of retries. A persistent mismatch may
14873 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14874 /// field is defined as int64 for reasons of compatibility across different
14875 /// languages. However, it is a non-negative integer, which will never exceed
14876 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14877 /// this type.
14878 ///
14879 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14880 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
14881 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
14882 pub data_crc32c: std::option::Option<wkt::Int64Value>,
14883
14884 /// Required. The signature to verify.
14885 pub mac: ::bytes::Bytes,
14886
14887 /// Optional. An optional CRC32C checksum of the
14888 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]. If
14889 /// specified, [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14890 /// will verify the integrity of the received
14891 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] using this
14892 /// checksum. [KeyManagementService][google.cloud.kms.v1.KeyManagementService]
14893 /// will report an error if the checksum verification fails. If you receive a
14894 /// checksum error, your client should verify that
14895 /// CRC32C([MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac]) is
14896 /// equal to
14897 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c],
14898 /// and if so, perform a limited number of retries. A persistent mismatch may
14899 /// indicate an issue in your computation of the CRC32C checksum. Note: This
14900 /// field is defined as int64 for reasons of compatibility across different
14901 /// languages. However, it is a non-negative integer, which will never exceed
14902 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
14903 /// this type.
14904 ///
14905 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
14906 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
14907 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
14908 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
14909
14910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14911}
14912
14913impl MacVerifyRequest {
14914 /// Creates a new default instance.
14915 pub fn new() -> Self {
14916 std::default::Default::default()
14917 }
14918
14919 /// Sets the value of [name][crate::model::MacVerifyRequest::name].
14920 ///
14921 /// # Example
14922 /// ```ignore,no_run
14923 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14924 /// # let project_id = "project_id";
14925 /// # let location_id = "location_id";
14926 /// # let key_ring_id = "key_ring_id";
14927 /// # let crypto_key_id = "crypto_key_id";
14928 /// # let crypto_key_version_id = "crypto_key_version_id";
14929 /// let x = MacVerifyRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
14930 /// ```
14931 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14932 self.name = v.into();
14933 self
14934 }
14935
14936 /// Sets the value of [data][crate::model::MacVerifyRequest::data].
14937 ///
14938 /// # Example
14939 /// ```ignore,no_run
14940 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14941 /// let x = MacVerifyRequest::new().set_data(bytes::Bytes::from_static(b"example"));
14942 /// ```
14943 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14944 self.data = v.into();
14945 self
14946 }
14947
14948 /// Sets the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14949 ///
14950 /// # Example
14951 /// ```ignore,no_run
14952 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14953 /// use wkt::Int64Value;
14954 /// let x = MacVerifyRequest::new().set_data_crc32c(Int64Value::default()/* use setters */);
14955 /// ```
14956 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
14957 where
14958 T: std::convert::Into<wkt::Int64Value>,
14959 {
14960 self.data_crc32c = std::option::Option::Some(v.into());
14961 self
14962 }
14963
14964 /// Sets or clears the value of [data_crc32c][crate::model::MacVerifyRequest::data_crc32c].
14965 ///
14966 /// # Example
14967 /// ```ignore,no_run
14968 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14969 /// use wkt::Int64Value;
14970 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
14971 /// let x = MacVerifyRequest::new().set_or_clear_data_crc32c(None::<Int64Value>);
14972 /// ```
14973 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
14974 where
14975 T: std::convert::Into<wkt::Int64Value>,
14976 {
14977 self.data_crc32c = v.map(|x| x.into());
14978 self
14979 }
14980
14981 /// Sets the value of [mac][crate::model::MacVerifyRequest::mac].
14982 ///
14983 /// # Example
14984 /// ```ignore,no_run
14985 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14986 /// let x = MacVerifyRequest::new().set_mac(bytes::Bytes::from_static(b"example"));
14987 /// ```
14988 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
14989 self.mac = v.into();
14990 self
14991 }
14992
14993 /// Sets the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
14994 ///
14995 /// # Example
14996 /// ```ignore,no_run
14997 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
14998 /// use wkt::Int64Value;
14999 /// let x = MacVerifyRequest::new().set_mac_crc32c(Int64Value::default()/* use setters */);
15000 /// ```
15001 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
15002 where
15003 T: std::convert::Into<wkt::Int64Value>,
15004 {
15005 self.mac_crc32c = std::option::Option::Some(v.into());
15006 self
15007 }
15008
15009 /// Sets or clears the value of [mac_crc32c][crate::model::MacVerifyRequest::mac_crc32c].
15010 ///
15011 /// # Example
15012 /// ```ignore,no_run
15013 /// # use google_cloud_kms_v1::model::MacVerifyRequest;
15014 /// use wkt::Int64Value;
15015 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
15016 /// let x = MacVerifyRequest::new().set_or_clear_mac_crc32c(None::<Int64Value>);
15017 /// ```
15018 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15019 where
15020 T: std::convert::Into<wkt::Int64Value>,
15021 {
15022 self.mac_crc32c = v.map(|x| x.into());
15023 self
15024 }
15025}
15026
15027impl wkt::message::Message for MacVerifyRequest {
15028 fn typename() -> &'static str {
15029 "type.googleapis.com/google.cloud.kms.v1.MacVerifyRequest"
15030 }
15031}
15032
15033/// Request message for
15034/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
15035///
15036/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
15037#[derive(Clone, Default, PartialEq)]
15038#[non_exhaustive]
15039pub struct DecapsulateRequest {
15040 /// Required. The resource name of the
15041 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for
15042 /// decapsulation.
15043 ///
15044 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15045 pub name: std::string::String,
15046
15047 /// Required. The ciphertext produced from encapsulation with the
15048 /// named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public
15049 /// key(s).
15050 ///
15051 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15052 pub ciphertext: ::bytes::Bytes,
15053
15054 /// Optional. A CRC32C checksum of the
15055 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext].
15056 /// If specified,
15057 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15058 /// verify the integrity of the received
15059 /// [DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]
15060 /// using this checksum.
15061 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] will
15062 /// report an error if the checksum verification fails. If you receive a
15063 /// checksum error, your client should verify that
15064 /// CRC32C([DecapsulateRequest.ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext])
15065 /// is equal to
15066 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c],
15067 /// and if so, perform a limited number of retries. A persistent mismatch may
15068 /// indicate an issue in your computation of the CRC32C checksum. Note: This
15069 /// field is defined as int64 for reasons of compatibility across different
15070 /// languages. However, it is a non-negative integer, which will never exceed
15071 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15072 /// this type.
15073 ///
15074 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
15075 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
15076 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15077 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15078
15079 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15080}
15081
15082impl DecapsulateRequest {
15083 /// Creates a new default instance.
15084 pub fn new() -> Self {
15085 std::default::Default::default()
15086 }
15087
15088 /// Sets the value of [name][crate::model::DecapsulateRequest::name].
15089 ///
15090 /// # Example
15091 /// ```ignore,no_run
15092 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15093 /// # let project_id = "project_id";
15094 /// # let location_id = "location_id";
15095 /// # let key_ring_id = "key_ring_id";
15096 /// # let crypto_key_id = "crypto_key_id";
15097 /// # let crypto_key_version_id = "crypto_key_version_id";
15098 /// let x = DecapsulateRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/keyRings/{key_ring_id}/cryptoKeys/{crypto_key_id}/cryptoKeyVersions/{crypto_key_version_id}"));
15099 /// ```
15100 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15101 self.name = v.into();
15102 self
15103 }
15104
15105 /// Sets the value of [ciphertext][crate::model::DecapsulateRequest::ciphertext].
15106 ///
15107 /// # Example
15108 /// ```ignore,no_run
15109 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15110 /// let x = DecapsulateRequest::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15111 /// ```
15112 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15113 self.ciphertext = v.into();
15114 self
15115 }
15116
15117 /// Sets the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
15118 ///
15119 /// # Example
15120 /// ```ignore,no_run
15121 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15122 /// use wkt::Int64Value;
15123 /// let x = DecapsulateRequest::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15124 /// ```
15125 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15126 where
15127 T: std::convert::Into<wkt::Int64Value>,
15128 {
15129 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15130 self
15131 }
15132
15133 /// Sets or clears the value of [ciphertext_crc32c][crate::model::DecapsulateRequest::ciphertext_crc32c].
15134 ///
15135 /// # Example
15136 /// ```ignore,no_run
15137 /// # use google_cloud_kms_v1::model::DecapsulateRequest;
15138 /// use wkt::Int64Value;
15139 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15140 /// let x = DecapsulateRequest::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15141 /// ```
15142 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15143 where
15144 T: std::convert::Into<wkt::Int64Value>,
15145 {
15146 self.ciphertext_crc32c = v.map(|x| x.into());
15147 self
15148 }
15149}
15150
15151impl wkt::message::Message for DecapsulateRequest {
15152 fn typename() -> &'static str {
15153 "type.googleapis.com/google.cloud.kms.v1.DecapsulateRequest"
15154 }
15155}
15156
15157/// Request message for
15158/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
15159///
15160/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
15161#[derive(Clone, Default, PartialEq)]
15162#[non_exhaustive]
15163pub struct GenerateRandomBytesRequest {
15164 /// The project-specific location in which to generate random bytes.
15165 /// For example, "projects/my-project/locations/us-central1".
15166 pub location: std::string::String,
15167
15168 /// The length in bytes of the amount of randomness to retrieve. Minimum 8
15169 /// bytes, maximum 1024 bytes.
15170 pub length_bytes: i32,
15171
15172 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when
15173 /// generating the random data. Currently, only
15174 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] protection level is
15175 /// supported.
15176 ///
15177 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15178 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
15179 pub protection_level: crate::model::ProtectionLevel,
15180
15181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15182}
15183
15184impl GenerateRandomBytesRequest {
15185 /// Creates a new default instance.
15186 pub fn new() -> Self {
15187 std::default::Default::default()
15188 }
15189
15190 /// Sets the value of [location][crate::model::GenerateRandomBytesRequest::location].
15191 ///
15192 /// # Example
15193 /// ```ignore,no_run
15194 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15195 /// let x = GenerateRandomBytesRequest::new().set_location("example");
15196 /// ```
15197 pub fn set_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15198 self.location = v.into();
15199 self
15200 }
15201
15202 /// Sets the value of [length_bytes][crate::model::GenerateRandomBytesRequest::length_bytes].
15203 ///
15204 /// # Example
15205 /// ```ignore,no_run
15206 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15207 /// let x = GenerateRandomBytesRequest::new().set_length_bytes(42);
15208 /// ```
15209 pub fn set_length_bytes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15210 self.length_bytes = v.into();
15211 self
15212 }
15213
15214 /// Sets the value of [protection_level][crate::model::GenerateRandomBytesRequest::protection_level].
15215 ///
15216 /// # Example
15217 /// ```ignore,no_run
15218 /// # use google_cloud_kms_v1::model::GenerateRandomBytesRequest;
15219 /// use google_cloud_kms_v1::model::ProtectionLevel;
15220 /// let x0 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Software);
15221 /// let x1 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::Hsm);
15222 /// let x2 = GenerateRandomBytesRequest::new().set_protection_level(ProtectionLevel::External);
15223 /// ```
15224 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15225 mut self,
15226 v: T,
15227 ) -> Self {
15228 self.protection_level = v.into();
15229 self
15230 }
15231}
15232
15233impl wkt::message::Message for GenerateRandomBytesRequest {
15234 fn typename() -> &'static str {
15235 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesRequest"
15236 }
15237}
15238
15239/// Response message for
15240/// [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].
15241///
15242/// [google.cloud.kms.v1.KeyManagementService.Encrypt]: crate::client::KeyManagementService::encrypt
15243#[derive(Clone, Default, PartialEq)]
15244#[non_exhaustive]
15245pub struct EncryptResponse {
15246 /// The resource name of the
15247 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15248 /// encryption. Check this field to verify that the intended resource was used
15249 /// for encryption.
15250 ///
15251 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15252 pub name: std::string::String,
15253
15254 /// The encrypted data.
15255 pub ciphertext: ::bytes::Bytes,
15256
15257 /// Integrity verification field. A CRC32C checksum of the returned
15258 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].
15259 /// An integrity check of
15260 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15261 /// can be performed by computing the CRC32C checksum of
15262 /// [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]
15263 /// and comparing your results to this field. Discard the response in case of
15264 /// non-matching checksum values, and perform a limited number of retries. A
15265 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15266 /// checksum. Note: This field is defined as int64 for reasons of compatibility
15267 /// across different languages. However, it is a non-negative integer, which
15268 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
15269 /// languages that support this type.
15270 ///
15271 /// [google.cloud.kms.v1.EncryptResponse.ciphertext]: crate::model::EncryptResponse::ciphertext
15272 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15273
15274 /// Integrity verification field. A flag indicating whether
15275 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15276 /// was received by
15277 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15278 /// for the integrity verification of the
15279 /// [plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. A false value of
15280 /// this field indicates either that
15281 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15282 /// was left unset or that it was not delivered to
15283 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15284 /// set
15285 /// [EncryptRequest.plaintext_crc32c][google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]
15286 /// but this field is still false, discard the response and perform a limited
15287 /// number of retries.
15288 ///
15289 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15290 /// [google.cloud.kms.v1.EncryptRequest.plaintext_crc32c]: crate::model::EncryptRequest::plaintext_crc32c
15291 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15292 pub verified_plaintext_crc32c: bool,
15293
15294 /// Integrity verification field. A flag indicating whether
15295 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15296 /// was received by
15297 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15298 /// for the integrity verification of the
15299 /// [AAD][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. A
15300 /// false value of this field indicates either that
15301 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15302 /// was left unset or that it was not delivered to
15303 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15304 /// set
15305 /// [EncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]
15306 /// but this field is still false, discard the response and perform a limited
15307 /// number of retries.
15308 ///
15309 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]: crate::model::EncryptRequest::additional_authenticated_data
15310 /// [google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c]: crate::model::EncryptRequest::additional_authenticated_data_crc32c
15311 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15312 pub verified_additional_authenticated_data_crc32c: bool,
15313
15314 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15315 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15316 /// encryption.
15317 ///
15318 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15319 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15320 pub protection_level: crate::model::ProtectionLevel,
15321
15322 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15323}
15324
15325impl EncryptResponse {
15326 /// Creates a new default instance.
15327 pub fn new() -> Self {
15328 std::default::Default::default()
15329 }
15330
15331 /// Sets the value of [name][crate::model::EncryptResponse::name].
15332 ///
15333 /// # Example
15334 /// ```ignore,no_run
15335 /// # use google_cloud_kms_v1::model::EncryptResponse;
15336 /// let x = EncryptResponse::new().set_name("example");
15337 /// ```
15338 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15339 self.name = v.into();
15340 self
15341 }
15342
15343 /// Sets the value of [ciphertext][crate::model::EncryptResponse::ciphertext].
15344 ///
15345 /// # Example
15346 /// ```ignore,no_run
15347 /// # use google_cloud_kms_v1::model::EncryptResponse;
15348 /// let x = EncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15349 /// ```
15350 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15351 self.ciphertext = v.into();
15352 self
15353 }
15354
15355 /// Sets the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15356 ///
15357 /// # Example
15358 /// ```ignore,no_run
15359 /// # use google_cloud_kms_v1::model::EncryptResponse;
15360 /// use wkt::Int64Value;
15361 /// let x = EncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15362 /// ```
15363 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15364 where
15365 T: std::convert::Into<wkt::Int64Value>,
15366 {
15367 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15368 self
15369 }
15370
15371 /// Sets or clears the value of [ciphertext_crc32c][crate::model::EncryptResponse::ciphertext_crc32c].
15372 ///
15373 /// # Example
15374 /// ```ignore,no_run
15375 /// # use google_cloud_kms_v1::model::EncryptResponse;
15376 /// use wkt::Int64Value;
15377 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15378 /// let x = EncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15379 /// ```
15380 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15381 where
15382 T: std::convert::Into<wkt::Int64Value>,
15383 {
15384 self.ciphertext_crc32c = v.map(|x| x.into());
15385 self
15386 }
15387
15388 /// Sets the value of [verified_plaintext_crc32c][crate::model::EncryptResponse::verified_plaintext_crc32c].
15389 ///
15390 /// # Example
15391 /// ```ignore,no_run
15392 /// # use google_cloud_kms_v1::model::EncryptResponse;
15393 /// let x = EncryptResponse::new().set_verified_plaintext_crc32c(true);
15394 /// ```
15395 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15396 self.verified_plaintext_crc32c = v.into();
15397 self
15398 }
15399
15400 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::EncryptResponse::verified_additional_authenticated_data_crc32c].
15401 ///
15402 /// # Example
15403 /// ```ignore,no_run
15404 /// # use google_cloud_kms_v1::model::EncryptResponse;
15405 /// let x = EncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15406 /// ```
15407 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15408 mut self,
15409 v: T,
15410 ) -> Self {
15411 self.verified_additional_authenticated_data_crc32c = v.into();
15412 self
15413 }
15414
15415 /// Sets the value of [protection_level][crate::model::EncryptResponse::protection_level].
15416 ///
15417 /// # Example
15418 /// ```ignore,no_run
15419 /// # use google_cloud_kms_v1::model::EncryptResponse;
15420 /// use google_cloud_kms_v1::model::ProtectionLevel;
15421 /// let x0 = EncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15422 /// let x1 = EncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15423 /// let x2 = EncryptResponse::new().set_protection_level(ProtectionLevel::External);
15424 /// ```
15425 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15426 mut self,
15427 v: T,
15428 ) -> Self {
15429 self.protection_level = v.into();
15430 self
15431 }
15432}
15433
15434impl wkt::message::Message for EncryptResponse {
15435 fn typename() -> &'static str {
15436 "type.googleapis.com/google.cloud.kms.v1.EncryptResponse"
15437 }
15438}
15439
15440/// Response message for
15441/// [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt].
15442///
15443/// [google.cloud.kms.v1.KeyManagementService.Decrypt]: crate::client::KeyManagementService::decrypt
15444#[derive(Clone, Default, PartialEq)]
15445#[non_exhaustive]
15446pub struct DecryptResponse {
15447 /// The decrypted data originally supplied in
15448 /// [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext].
15449 ///
15450 /// [google.cloud.kms.v1.EncryptRequest.plaintext]: crate::model::EncryptRequest::plaintext
15451 pub plaintext: ::bytes::Bytes,
15452
15453 /// Integrity verification field. A CRC32C checksum of the returned
15454 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext].
15455 /// An integrity check of
15456 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15457 /// can be performed by computing the CRC32C checksum of
15458 /// [DecryptResponse.plaintext][google.cloud.kms.v1.DecryptResponse.plaintext]
15459 /// and comparing your results to this field. Discard the response in case of
15460 /// non-matching checksum values, and perform a limited number of retries. A
15461 /// persistent mismatch may indicate an issue in your computation of the CRC32C
15462 /// checksum. Note: receiving this response message indicates that
15463 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15464 /// successfully decrypt the
15465 /// [ciphertext][google.cloud.kms.v1.DecryptRequest.ciphertext]. Note: This
15466 /// field is defined as int64 for reasons of compatibility across different
15467 /// languages. However, it is a non-negative integer, which will never exceed
15468 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
15469 /// this type.
15470 ///
15471 /// [google.cloud.kms.v1.DecryptRequest.ciphertext]: crate::model::DecryptRequest::ciphertext
15472 /// [google.cloud.kms.v1.DecryptResponse.plaintext]: crate::model::DecryptResponse::plaintext
15473 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15474 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15475
15476 /// Whether the Decryption was performed using the primary key version.
15477 pub used_primary: bool,
15478
15479 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15480 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15481 /// decryption.
15482 ///
15483 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15484 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15485 pub protection_level: crate::model::ProtectionLevel,
15486
15487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15488}
15489
15490impl DecryptResponse {
15491 /// Creates a new default instance.
15492 pub fn new() -> Self {
15493 std::default::Default::default()
15494 }
15495
15496 /// Sets the value of [plaintext][crate::model::DecryptResponse::plaintext].
15497 ///
15498 /// # Example
15499 /// ```ignore,no_run
15500 /// # use google_cloud_kms_v1::model::DecryptResponse;
15501 /// let x = DecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
15502 /// ```
15503 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15504 self.plaintext = v.into();
15505 self
15506 }
15507
15508 /// Sets the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15509 ///
15510 /// # Example
15511 /// ```ignore,no_run
15512 /// # use google_cloud_kms_v1::model::DecryptResponse;
15513 /// use wkt::Int64Value;
15514 /// let x = DecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
15515 /// ```
15516 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
15517 where
15518 T: std::convert::Into<wkt::Int64Value>,
15519 {
15520 self.plaintext_crc32c = std::option::Option::Some(v.into());
15521 self
15522 }
15523
15524 /// Sets or clears the value of [plaintext_crc32c][crate::model::DecryptResponse::plaintext_crc32c].
15525 ///
15526 /// # Example
15527 /// ```ignore,no_run
15528 /// # use google_cloud_kms_v1::model::DecryptResponse;
15529 /// use wkt::Int64Value;
15530 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
15531 /// let x = DecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
15532 /// ```
15533 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15534 where
15535 T: std::convert::Into<wkt::Int64Value>,
15536 {
15537 self.plaintext_crc32c = v.map(|x| x.into());
15538 self
15539 }
15540
15541 /// Sets the value of [used_primary][crate::model::DecryptResponse::used_primary].
15542 ///
15543 /// # Example
15544 /// ```ignore,no_run
15545 /// # use google_cloud_kms_v1::model::DecryptResponse;
15546 /// let x = DecryptResponse::new().set_used_primary(true);
15547 /// ```
15548 pub fn set_used_primary<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15549 self.used_primary = v.into();
15550 self
15551 }
15552
15553 /// Sets the value of [protection_level][crate::model::DecryptResponse::protection_level].
15554 ///
15555 /// # Example
15556 /// ```ignore,no_run
15557 /// # use google_cloud_kms_v1::model::DecryptResponse;
15558 /// use google_cloud_kms_v1::model::ProtectionLevel;
15559 /// let x0 = DecryptResponse::new().set_protection_level(ProtectionLevel::Software);
15560 /// let x1 = DecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15561 /// let x2 = DecryptResponse::new().set_protection_level(ProtectionLevel::External);
15562 /// ```
15563 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15564 mut self,
15565 v: T,
15566 ) -> Self {
15567 self.protection_level = v.into();
15568 self
15569 }
15570}
15571
15572impl wkt::message::Message for DecryptResponse {
15573 fn typename() -> &'static str {
15574 "type.googleapis.com/google.cloud.kms.v1.DecryptResponse"
15575 }
15576}
15577
15578/// Response message for
15579/// [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
15580///
15581/// [google.cloud.kms.v1.KeyManagementService.RawEncrypt]: crate::client::KeyManagementService::raw_encrypt
15582#[derive(Clone, Default, PartialEq)]
15583#[non_exhaustive]
15584pub struct RawEncryptResponse {
15585 /// The encrypted data. In the case of AES-GCM, the authentication tag
15586 /// is the [tag_length][google.cloud.kms.v1.RawEncryptResponse.tag_length]
15587 /// bytes at the end of this field.
15588 ///
15589 /// [google.cloud.kms.v1.RawEncryptResponse.tag_length]: crate::model::RawEncryptResponse::tag_length
15590 pub ciphertext: ::bytes::Bytes,
15591
15592 /// The initialization vector (IV) generated by the service during
15593 /// encryption. This value must be stored and provided in
15594 /// [RawDecryptRequest.initialization_vector][google.cloud.kms.v1.RawDecryptRequest.initialization_vector]
15595 /// at decryption time.
15596 ///
15597 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector]: crate::model::RawDecryptRequest::initialization_vector
15598 pub initialization_vector: ::bytes::Bytes,
15599
15600 /// The length of the authentication tag that is appended to
15601 /// the end of the ciphertext.
15602 pub tag_length: i32,
15603
15604 /// Integrity verification field. A CRC32C checksum of the returned
15605 /// [RawEncryptResponse.ciphertext][google.cloud.kms.v1.RawEncryptResponse.ciphertext].
15606 /// An integrity check of ciphertext can be performed by computing the CRC32C
15607 /// checksum of ciphertext and comparing your results to this field. Discard
15608 /// the response in case of non-matching checksum values, and perform a limited
15609 /// number of retries. A persistent mismatch may indicate an issue in your
15610 /// computation of the CRC32C checksum. Note: This field is defined as int64
15611 /// for reasons of compatibility across different languages. However, it is a
15612 /// non-negative integer, which will never exceed 2^32-1, and can be safely
15613 /// downconverted to uint32 in languages that support this type.
15614 ///
15615 /// [google.cloud.kms.v1.RawEncryptResponse.ciphertext]: crate::model::RawEncryptResponse::ciphertext
15616 pub ciphertext_crc32c: std::option::Option<wkt::Int64Value>,
15617
15618 /// Integrity verification field. A CRC32C checksum of the returned
15619 /// [RawEncryptResponse.initialization_vector][google.cloud.kms.v1.RawEncryptResponse.initialization_vector].
15620 /// An integrity check of initialization_vector can be performed by computing
15621 /// the CRC32C checksum of initialization_vector and comparing your results to
15622 /// this field. Discard the response in case of non-matching checksum values,
15623 /// and perform a limited number of retries. A persistent mismatch may indicate
15624 /// an issue in your computation of the CRC32C checksum. Note: This field is
15625 /// defined as int64 for reasons of compatibility across different languages.
15626 /// However, it is a non-negative integer, which will never exceed 2^32-1, and
15627 /// can be safely downconverted to uint32 in languages that support this type.
15628 ///
15629 /// [google.cloud.kms.v1.RawEncryptResponse.initialization_vector]: crate::model::RawEncryptResponse::initialization_vector
15630 pub initialization_vector_crc32c: std::option::Option<wkt::Int64Value>,
15631
15632 /// Integrity verification field. A flag indicating whether
15633 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15634 /// was received by
15635 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15636 /// for the integrity verification of the plaintext. A false value of this
15637 /// field indicates either that
15638 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15639 /// was left unset or that it was not delivered to
15640 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15641 /// set
15642 /// [RawEncryptRequest.plaintext_crc32c][google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]
15643 /// but this field is still false, discard the response and perform a limited
15644 /// number of retries.
15645 ///
15646 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15647 /// [google.cloud.kms.v1.RawEncryptRequest.plaintext_crc32c]: crate::model::RawEncryptRequest::plaintext_crc32c
15648 pub verified_plaintext_crc32c: bool,
15649
15650 /// Integrity verification field. A flag indicating whether
15651 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15652 /// was received by
15653 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15654 /// for the integrity verification of additional_authenticated_data. A false
15655 /// value of this field indicates either that //
15656 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15657 /// was left unset or that it was not delivered to
15658 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15659 /// set
15660 /// [RawEncryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]
15661 /// but this field is still false, discard the response and perform a limited
15662 /// number of retries.
15663 ///
15664 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15665 /// [google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data_crc32c]: crate::model::RawEncryptRequest::additional_authenticated_data_crc32c
15666 pub verified_additional_authenticated_data_crc32c: bool,
15667
15668 /// Integrity verification field. A flag indicating whether
15669 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15670 /// was received by
15671 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15672 /// for the integrity verification of initialization_vector. A false value of
15673 /// this field indicates either that
15674 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15675 /// was left unset or that it was not delivered to
15676 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15677 /// set
15678 /// [RawEncryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]
15679 /// but this field is still false, discard the response and perform a limited
15680 /// number of retries.
15681 ///
15682 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15683 /// [google.cloud.kms.v1.RawEncryptRequest.initialization_vector_crc32c]: crate::model::RawEncryptRequest::initialization_vector_crc32c
15684 pub verified_initialization_vector_crc32c: bool,
15685
15686 /// The resource name of the
15687 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15688 /// encryption. Check this field to verify that the intended resource was used
15689 /// for encryption.
15690 ///
15691 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15692 pub name: std::string::String,
15693
15694 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15695 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15696 /// encryption.
15697 ///
15698 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15699 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15700 pub protection_level: crate::model::ProtectionLevel,
15701
15702 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15703}
15704
15705impl RawEncryptResponse {
15706 /// Creates a new default instance.
15707 pub fn new() -> Self {
15708 std::default::Default::default()
15709 }
15710
15711 /// Sets the value of [ciphertext][crate::model::RawEncryptResponse::ciphertext].
15712 ///
15713 /// # Example
15714 /// ```ignore,no_run
15715 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15716 /// let x = RawEncryptResponse::new().set_ciphertext(bytes::Bytes::from_static(b"example"));
15717 /// ```
15718 pub fn set_ciphertext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
15719 self.ciphertext = v.into();
15720 self
15721 }
15722
15723 /// Sets the value of [initialization_vector][crate::model::RawEncryptResponse::initialization_vector].
15724 ///
15725 /// # Example
15726 /// ```ignore,no_run
15727 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15728 /// let x = RawEncryptResponse::new().set_initialization_vector(bytes::Bytes::from_static(b"example"));
15729 /// ```
15730 pub fn set_initialization_vector<T: std::convert::Into<::bytes::Bytes>>(
15731 mut self,
15732 v: T,
15733 ) -> Self {
15734 self.initialization_vector = v.into();
15735 self
15736 }
15737
15738 /// Sets the value of [tag_length][crate::model::RawEncryptResponse::tag_length].
15739 ///
15740 /// # Example
15741 /// ```ignore,no_run
15742 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15743 /// let x = RawEncryptResponse::new().set_tag_length(42);
15744 /// ```
15745 pub fn set_tag_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15746 self.tag_length = v.into();
15747 self
15748 }
15749
15750 /// Sets the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15751 ///
15752 /// # Example
15753 /// ```ignore,no_run
15754 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15755 /// use wkt::Int64Value;
15756 /// let x = RawEncryptResponse::new().set_ciphertext_crc32c(Int64Value::default()/* use setters */);
15757 /// ```
15758 pub fn set_ciphertext_crc32c<T>(mut self, v: T) -> Self
15759 where
15760 T: std::convert::Into<wkt::Int64Value>,
15761 {
15762 self.ciphertext_crc32c = std::option::Option::Some(v.into());
15763 self
15764 }
15765
15766 /// Sets or clears the value of [ciphertext_crc32c][crate::model::RawEncryptResponse::ciphertext_crc32c].
15767 ///
15768 /// # Example
15769 /// ```ignore,no_run
15770 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15771 /// use wkt::Int64Value;
15772 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(Some(Int64Value::default()/* use setters */));
15773 /// let x = RawEncryptResponse::new().set_or_clear_ciphertext_crc32c(None::<Int64Value>);
15774 /// ```
15775 pub fn set_or_clear_ciphertext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15776 where
15777 T: std::convert::Into<wkt::Int64Value>,
15778 {
15779 self.ciphertext_crc32c = v.map(|x| x.into());
15780 self
15781 }
15782
15783 /// Sets the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15784 ///
15785 /// # Example
15786 /// ```ignore,no_run
15787 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15788 /// use wkt::Int64Value;
15789 /// let x = RawEncryptResponse::new().set_initialization_vector_crc32c(Int64Value::default()/* use setters */);
15790 /// ```
15791 pub fn set_initialization_vector_crc32c<T>(mut self, v: T) -> Self
15792 where
15793 T: std::convert::Into<wkt::Int64Value>,
15794 {
15795 self.initialization_vector_crc32c = std::option::Option::Some(v.into());
15796 self
15797 }
15798
15799 /// Sets or clears the value of [initialization_vector_crc32c][crate::model::RawEncryptResponse::initialization_vector_crc32c].
15800 ///
15801 /// # Example
15802 /// ```ignore,no_run
15803 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15804 /// use wkt::Int64Value;
15805 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(Some(Int64Value::default()/* use setters */));
15806 /// let x = RawEncryptResponse::new().set_or_clear_initialization_vector_crc32c(None::<Int64Value>);
15807 /// ```
15808 pub fn set_or_clear_initialization_vector_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
15809 where
15810 T: std::convert::Into<wkt::Int64Value>,
15811 {
15812 self.initialization_vector_crc32c = v.map(|x| x.into());
15813 self
15814 }
15815
15816 /// Sets the value of [verified_plaintext_crc32c][crate::model::RawEncryptResponse::verified_plaintext_crc32c].
15817 ///
15818 /// # Example
15819 /// ```ignore,no_run
15820 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15821 /// let x = RawEncryptResponse::new().set_verified_plaintext_crc32c(true);
15822 /// ```
15823 pub fn set_verified_plaintext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15824 self.verified_plaintext_crc32c = v.into();
15825 self
15826 }
15827
15828 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawEncryptResponse::verified_additional_authenticated_data_crc32c].
15829 ///
15830 /// # Example
15831 /// ```ignore,no_run
15832 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15833 /// let x = RawEncryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
15834 /// ```
15835 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
15836 mut self,
15837 v: T,
15838 ) -> Self {
15839 self.verified_additional_authenticated_data_crc32c = v.into();
15840 self
15841 }
15842
15843 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawEncryptResponse::verified_initialization_vector_crc32c].
15844 ///
15845 /// # Example
15846 /// ```ignore,no_run
15847 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15848 /// let x = RawEncryptResponse::new().set_verified_initialization_vector_crc32c(true);
15849 /// ```
15850 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
15851 mut self,
15852 v: T,
15853 ) -> Self {
15854 self.verified_initialization_vector_crc32c = v.into();
15855 self
15856 }
15857
15858 /// Sets the value of [name][crate::model::RawEncryptResponse::name].
15859 ///
15860 /// # Example
15861 /// ```ignore,no_run
15862 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15863 /// let x = RawEncryptResponse::new().set_name("example");
15864 /// ```
15865 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15866 self.name = v.into();
15867 self
15868 }
15869
15870 /// Sets the value of [protection_level][crate::model::RawEncryptResponse::protection_level].
15871 ///
15872 /// # Example
15873 /// ```ignore,no_run
15874 /// # use google_cloud_kms_v1::model::RawEncryptResponse;
15875 /// use google_cloud_kms_v1::model::ProtectionLevel;
15876 /// let x0 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Software);
15877 /// let x1 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
15878 /// let x2 = RawEncryptResponse::new().set_protection_level(ProtectionLevel::External);
15879 /// ```
15880 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
15881 mut self,
15882 v: T,
15883 ) -> Self {
15884 self.protection_level = v.into();
15885 self
15886 }
15887}
15888
15889impl wkt::message::Message for RawEncryptResponse {
15890 fn typename() -> &'static str {
15891 "type.googleapis.com/google.cloud.kms.v1.RawEncryptResponse"
15892 }
15893}
15894
15895/// Response message for
15896/// [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
15897///
15898/// [google.cloud.kms.v1.KeyManagementService.RawDecrypt]: crate::client::KeyManagementService::raw_decrypt
15899#[derive(Clone, Default, PartialEq)]
15900#[non_exhaustive]
15901pub struct RawDecryptResponse {
15902 /// The decrypted data.
15903 pub plaintext: ::bytes::Bytes,
15904
15905 /// Integrity verification field. A CRC32C checksum of the returned
15906 /// [RawDecryptResponse.plaintext][google.cloud.kms.v1.RawDecryptResponse.plaintext].
15907 /// An integrity check of plaintext can be performed by computing the CRC32C
15908 /// checksum of plaintext and comparing your results to this field. Discard the
15909 /// response in case of non-matching checksum values, and perform a limited
15910 /// number of retries. A persistent mismatch may indicate an issue in your
15911 /// computation of the CRC32C checksum. Note: receiving this response message
15912 /// indicates that
15913 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
15914 /// successfully decrypt the
15915 /// [ciphertext][google.cloud.kms.v1.RawDecryptRequest.ciphertext].
15916 /// Note: This field is defined as int64 for reasons of compatibility across
15917 /// different languages. However, it is a non-negative integer, which will
15918 /// never exceed 2^32-1, and can be safely downconverted to uint32 in languages
15919 /// that support this type.
15920 ///
15921 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15922 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext]: crate::model::RawDecryptRequest::ciphertext
15923 /// [google.cloud.kms.v1.RawDecryptResponse.plaintext]: crate::model::RawDecryptResponse::plaintext
15924 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
15925
15926 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
15927 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
15928 /// decryption.
15929 ///
15930 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
15931 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
15932 pub protection_level: crate::model::ProtectionLevel,
15933
15934 /// Integrity verification field. A flag indicating whether
15935 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15936 /// was received by
15937 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15938 /// for the integrity verification of the ciphertext. A false value of this
15939 /// field indicates either that
15940 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15941 /// was left unset or that it was not delivered to
15942 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15943 /// set
15944 /// [RawDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]
15945 /// but this field is still false, discard the response and perform a limited
15946 /// number of retries.
15947 ///
15948 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15949 /// [google.cloud.kms.v1.RawDecryptRequest.ciphertext_crc32c]: crate::model::RawDecryptRequest::ciphertext_crc32c
15950 pub verified_ciphertext_crc32c: bool,
15951
15952 /// Integrity verification field. A flag indicating whether
15953 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15954 /// was received by
15955 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15956 /// for the integrity verification of additional_authenticated_data. A false
15957 /// value of this field indicates either that //
15958 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15959 /// was left unset or that it was not delivered to
15960 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15961 /// set
15962 /// [RawDecryptRequest.additional_authenticated_data_crc32c][google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]
15963 /// but this field is still false, discard the response and perform a limited
15964 /// number of retries.
15965 ///
15966 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15967 /// [google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data_crc32c]: crate::model::RawDecryptRequest::additional_authenticated_data_crc32c
15968 pub verified_additional_authenticated_data_crc32c: bool,
15969
15970 /// Integrity verification field. A flag indicating whether
15971 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15972 /// was received by
15973 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
15974 /// for the integrity verification of initialization_vector. A false value of
15975 /// this field indicates either that
15976 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15977 /// was left unset or that it was not delivered to
15978 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
15979 /// set
15980 /// [RawDecryptRequest.initialization_vector_crc32c][google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]
15981 /// but this field is still false, discard the response and perform a limited
15982 /// number of retries.
15983 ///
15984 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
15985 /// [google.cloud.kms.v1.RawDecryptRequest.initialization_vector_crc32c]: crate::model::RawDecryptRequest::initialization_vector_crc32c
15986 pub verified_initialization_vector_crc32c: bool,
15987
15988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15989}
15990
15991impl RawDecryptResponse {
15992 /// Creates a new default instance.
15993 pub fn new() -> Self {
15994 std::default::Default::default()
15995 }
15996
15997 /// Sets the value of [plaintext][crate::model::RawDecryptResponse::plaintext].
15998 ///
15999 /// # Example
16000 /// ```ignore,no_run
16001 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16002 /// let x = RawDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16003 /// ```
16004 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16005 self.plaintext = v.into();
16006 self
16007 }
16008
16009 /// Sets the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
16010 ///
16011 /// # Example
16012 /// ```ignore,no_run
16013 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16014 /// use wkt::Int64Value;
16015 /// let x = RawDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16016 /// ```
16017 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16018 where
16019 T: std::convert::Into<wkt::Int64Value>,
16020 {
16021 self.plaintext_crc32c = std::option::Option::Some(v.into());
16022 self
16023 }
16024
16025 /// Sets or clears the value of [plaintext_crc32c][crate::model::RawDecryptResponse::plaintext_crc32c].
16026 ///
16027 /// # Example
16028 /// ```ignore,no_run
16029 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16030 /// use wkt::Int64Value;
16031 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16032 /// let x = RawDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16033 /// ```
16034 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16035 where
16036 T: std::convert::Into<wkt::Int64Value>,
16037 {
16038 self.plaintext_crc32c = v.map(|x| x.into());
16039 self
16040 }
16041
16042 /// Sets the value of [protection_level][crate::model::RawDecryptResponse::protection_level].
16043 ///
16044 /// # Example
16045 /// ```ignore,no_run
16046 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16047 /// use google_cloud_kms_v1::model::ProtectionLevel;
16048 /// let x0 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16049 /// let x1 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16050 /// let x2 = RawDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16051 /// ```
16052 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16053 mut self,
16054 v: T,
16055 ) -> Self {
16056 self.protection_level = v.into();
16057 self
16058 }
16059
16060 /// Sets the value of [verified_ciphertext_crc32c][crate::model::RawDecryptResponse::verified_ciphertext_crc32c].
16061 ///
16062 /// # Example
16063 /// ```ignore,no_run
16064 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16065 /// let x = RawDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16066 /// ```
16067 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16068 self.verified_ciphertext_crc32c = v.into();
16069 self
16070 }
16071
16072 /// Sets the value of [verified_additional_authenticated_data_crc32c][crate::model::RawDecryptResponse::verified_additional_authenticated_data_crc32c].
16073 ///
16074 /// # Example
16075 /// ```ignore,no_run
16076 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16077 /// let x = RawDecryptResponse::new().set_verified_additional_authenticated_data_crc32c(true);
16078 /// ```
16079 pub fn set_verified_additional_authenticated_data_crc32c<T: std::convert::Into<bool>>(
16080 mut self,
16081 v: T,
16082 ) -> Self {
16083 self.verified_additional_authenticated_data_crc32c = v.into();
16084 self
16085 }
16086
16087 /// Sets the value of [verified_initialization_vector_crc32c][crate::model::RawDecryptResponse::verified_initialization_vector_crc32c].
16088 ///
16089 /// # Example
16090 /// ```ignore,no_run
16091 /// # use google_cloud_kms_v1::model::RawDecryptResponse;
16092 /// let x = RawDecryptResponse::new().set_verified_initialization_vector_crc32c(true);
16093 /// ```
16094 pub fn set_verified_initialization_vector_crc32c<T: std::convert::Into<bool>>(
16095 mut self,
16096 v: T,
16097 ) -> Self {
16098 self.verified_initialization_vector_crc32c = v.into();
16099 self
16100 }
16101}
16102
16103impl wkt::message::Message for RawDecryptResponse {
16104 fn typename() -> &'static str {
16105 "type.googleapis.com/google.cloud.kms.v1.RawDecryptResponse"
16106 }
16107}
16108
16109/// Response message for
16110/// [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign].
16111///
16112/// [google.cloud.kms.v1.KeyManagementService.AsymmetricSign]: crate::client::KeyManagementService::asymmetric_sign
16113#[derive(Clone, Default, PartialEq)]
16114#[non_exhaustive]
16115pub struct AsymmetricSignResponse {
16116 /// The created signature.
16117 pub signature: ::bytes::Bytes,
16118
16119 /// Integrity verification field. A CRC32C checksum of the returned
16120 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature].
16121 /// An integrity check of
16122 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
16123 /// can be performed by computing the CRC32C checksum of
16124 /// [AsymmetricSignResponse.signature][google.cloud.kms.v1.AsymmetricSignResponse.signature]
16125 /// and comparing your results to this field. Discard the response in case of
16126 /// non-matching checksum values, and perform a limited number of retries. A
16127 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16128 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16129 /// across different languages. However, it is a non-negative integer, which
16130 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16131 /// languages that support this type.
16132 ///
16133 /// [google.cloud.kms.v1.AsymmetricSignResponse.signature]: crate::model::AsymmetricSignResponse::signature
16134 pub signature_crc32c: std::option::Option<wkt::Int64Value>,
16135
16136 /// Integrity verification field. A flag indicating whether
16137 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16138 /// was received by
16139 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16140 /// for the integrity verification of the
16141 /// [digest][google.cloud.kms.v1.AsymmetricSignRequest.digest]. A false value
16142 /// of this field indicates either that
16143 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16144 /// was left unset or that it was not delivered to
16145 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16146 /// set
16147 /// [AsymmetricSignRequest.digest_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]
16148 /// but this field is still false, discard the response and perform a limited
16149 /// number of retries.
16150 ///
16151 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest]: crate::model::AsymmetricSignRequest::digest
16152 /// [google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c]: crate::model::AsymmetricSignRequest::digest_crc32c
16153 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16154 pub verified_digest_crc32c: bool,
16155
16156 /// The resource name of the
16157 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16158 /// Check this field to verify that the intended resource was used for signing.
16159 ///
16160 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16161 pub name: std::string::String,
16162
16163 /// Integrity verification field. A flag indicating whether
16164 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
16165 /// was received by
16166 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16167 /// for the integrity verification of the
16168 /// [data][google.cloud.kms.v1.AsymmetricSignRequest.data]. A false value of
16169 /// this field indicates either that
16170 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
16171 /// was left unset or that it was not delivered to
16172 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16173 /// set
16174 /// [AsymmetricSignRequest.data_crc32c][google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]
16175 /// but this field is still false, discard the response and perform a limited
16176 /// number of retries.
16177 ///
16178 /// [google.cloud.kms.v1.AsymmetricSignRequest.data]: crate::model::AsymmetricSignRequest::data
16179 /// [google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c]: crate::model::AsymmetricSignRequest::data_crc32c
16180 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16181 pub verified_data_crc32c: bool,
16182
16183 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16184 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16185 ///
16186 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16187 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16188 pub protection_level: crate::model::ProtectionLevel,
16189
16190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16191}
16192
16193impl AsymmetricSignResponse {
16194 /// Creates a new default instance.
16195 pub fn new() -> Self {
16196 std::default::Default::default()
16197 }
16198
16199 /// Sets the value of [signature][crate::model::AsymmetricSignResponse::signature].
16200 ///
16201 /// # Example
16202 /// ```ignore,no_run
16203 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16204 /// let x = AsymmetricSignResponse::new().set_signature(bytes::Bytes::from_static(b"example"));
16205 /// ```
16206 pub fn set_signature<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16207 self.signature = v.into();
16208 self
16209 }
16210
16211 /// Sets the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16212 ///
16213 /// # Example
16214 /// ```ignore,no_run
16215 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16216 /// use wkt::Int64Value;
16217 /// let x = AsymmetricSignResponse::new().set_signature_crc32c(Int64Value::default()/* use setters */);
16218 /// ```
16219 pub fn set_signature_crc32c<T>(mut self, v: T) -> Self
16220 where
16221 T: std::convert::Into<wkt::Int64Value>,
16222 {
16223 self.signature_crc32c = std::option::Option::Some(v.into());
16224 self
16225 }
16226
16227 /// Sets or clears the value of [signature_crc32c][crate::model::AsymmetricSignResponse::signature_crc32c].
16228 ///
16229 /// # Example
16230 /// ```ignore,no_run
16231 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16232 /// use wkt::Int64Value;
16233 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(Some(Int64Value::default()/* use setters */));
16234 /// let x = AsymmetricSignResponse::new().set_or_clear_signature_crc32c(None::<Int64Value>);
16235 /// ```
16236 pub fn set_or_clear_signature_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16237 where
16238 T: std::convert::Into<wkt::Int64Value>,
16239 {
16240 self.signature_crc32c = v.map(|x| x.into());
16241 self
16242 }
16243
16244 /// Sets the value of [verified_digest_crc32c][crate::model::AsymmetricSignResponse::verified_digest_crc32c].
16245 ///
16246 /// # Example
16247 /// ```ignore,no_run
16248 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16249 /// let x = AsymmetricSignResponse::new().set_verified_digest_crc32c(true);
16250 /// ```
16251 pub fn set_verified_digest_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16252 self.verified_digest_crc32c = v.into();
16253 self
16254 }
16255
16256 /// Sets the value of [name][crate::model::AsymmetricSignResponse::name].
16257 ///
16258 /// # Example
16259 /// ```ignore,no_run
16260 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16261 /// let x = AsymmetricSignResponse::new().set_name("example");
16262 /// ```
16263 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16264 self.name = v.into();
16265 self
16266 }
16267
16268 /// Sets the value of [verified_data_crc32c][crate::model::AsymmetricSignResponse::verified_data_crc32c].
16269 ///
16270 /// # Example
16271 /// ```ignore,no_run
16272 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16273 /// let x = AsymmetricSignResponse::new().set_verified_data_crc32c(true);
16274 /// ```
16275 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16276 self.verified_data_crc32c = v.into();
16277 self
16278 }
16279
16280 /// Sets the value of [protection_level][crate::model::AsymmetricSignResponse::protection_level].
16281 ///
16282 /// # Example
16283 /// ```ignore,no_run
16284 /// # use google_cloud_kms_v1::model::AsymmetricSignResponse;
16285 /// use google_cloud_kms_v1::model::ProtectionLevel;
16286 /// let x0 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Software);
16287 /// let x1 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16288 /// let x2 = AsymmetricSignResponse::new().set_protection_level(ProtectionLevel::External);
16289 /// ```
16290 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16291 mut self,
16292 v: T,
16293 ) -> Self {
16294 self.protection_level = v.into();
16295 self
16296 }
16297}
16298
16299impl wkt::message::Message for AsymmetricSignResponse {
16300 fn typename() -> &'static str {
16301 "type.googleapis.com/google.cloud.kms.v1.AsymmetricSignResponse"
16302 }
16303}
16304
16305/// Response message for
16306/// [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt].
16307///
16308/// [google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]: crate::client::KeyManagementService::asymmetric_decrypt
16309#[derive(Clone, Default, PartialEq)]
16310#[non_exhaustive]
16311pub struct AsymmetricDecryptResponse {
16312 /// The decrypted data originally encrypted with the matching public key.
16313 pub plaintext: ::bytes::Bytes,
16314
16315 /// Integrity verification field. A CRC32C checksum of the returned
16316 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext].
16317 /// An integrity check of
16318 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
16319 /// can be performed by computing the CRC32C checksum of
16320 /// [AsymmetricDecryptResponse.plaintext][google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]
16321 /// and comparing your results to this field. Discard the response in case of
16322 /// non-matching checksum values, and perform a limited number of retries. A
16323 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16324 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16325 /// across different languages. However, it is a non-negative integer, which
16326 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16327 /// languages that support this type.
16328 ///
16329 /// [google.cloud.kms.v1.AsymmetricDecryptResponse.plaintext]: crate::model::AsymmetricDecryptResponse::plaintext
16330 pub plaintext_crc32c: std::option::Option<wkt::Int64Value>,
16331
16332 /// Integrity verification field. A flag indicating whether
16333 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16334 /// was received by
16335 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16336 /// for the integrity verification of the
16337 /// [ciphertext][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]. A
16338 /// false value of this field indicates either that
16339 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16340 /// was left unset or that it was not delivered to
16341 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16342 /// set
16343 /// [AsymmetricDecryptRequest.ciphertext_crc32c][google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]
16344 /// but this field is still false, discard the response and perform a limited
16345 /// number of retries.
16346 ///
16347 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext]: crate::model::AsymmetricDecryptRequest::ciphertext
16348 /// [google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c]: crate::model::AsymmetricDecryptRequest::ciphertext_crc32c
16349 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16350 pub verified_ciphertext_crc32c: bool,
16351
16352 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16353 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16354 /// decryption.
16355 ///
16356 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16357 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16358 pub protection_level: crate::model::ProtectionLevel,
16359
16360 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16361}
16362
16363impl AsymmetricDecryptResponse {
16364 /// Creates a new default instance.
16365 pub fn new() -> Self {
16366 std::default::Default::default()
16367 }
16368
16369 /// Sets the value of [plaintext][crate::model::AsymmetricDecryptResponse::plaintext].
16370 ///
16371 /// # Example
16372 /// ```ignore,no_run
16373 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16374 /// let x = AsymmetricDecryptResponse::new().set_plaintext(bytes::Bytes::from_static(b"example"));
16375 /// ```
16376 pub fn set_plaintext<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16377 self.plaintext = v.into();
16378 self
16379 }
16380
16381 /// Sets the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16382 ///
16383 /// # Example
16384 /// ```ignore,no_run
16385 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16386 /// use wkt::Int64Value;
16387 /// let x = AsymmetricDecryptResponse::new().set_plaintext_crc32c(Int64Value::default()/* use setters */);
16388 /// ```
16389 pub fn set_plaintext_crc32c<T>(mut self, v: T) -> Self
16390 where
16391 T: std::convert::Into<wkt::Int64Value>,
16392 {
16393 self.plaintext_crc32c = std::option::Option::Some(v.into());
16394 self
16395 }
16396
16397 /// Sets or clears the value of [plaintext_crc32c][crate::model::AsymmetricDecryptResponse::plaintext_crc32c].
16398 ///
16399 /// # Example
16400 /// ```ignore,no_run
16401 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16402 /// use wkt::Int64Value;
16403 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(Some(Int64Value::default()/* use setters */));
16404 /// let x = AsymmetricDecryptResponse::new().set_or_clear_plaintext_crc32c(None::<Int64Value>);
16405 /// ```
16406 pub fn set_or_clear_plaintext_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16407 where
16408 T: std::convert::Into<wkt::Int64Value>,
16409 {
16410 self.plaintext_crc32c = v.map(|x| x.into());
16411 self
16412 }
16413
16414 /// Sets the value of [verified_ciphertext_crc32c][crate::model::AsymmetricDecryptResponse::verified_ciphertext_crc32c].
16415 ///
16416 /// # Example
16417 /// ```ignore,no_run
16418 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16419 /// let x = AsymmetricDecryptResponse::new().set_verified_ciphertext_crc32c(true);
16420 /// ```
16421 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16422 self.verified_ciphertext_crc32c = v.into();
16423 self
16424 }
16425
16426 /// Sets the value of [protection_level][crate::model::AsymmetricDecryptResponse::protection_level].
16427 ///
16428 /// # Example
16429 /// ```ignore,no_run
16430 /// # use google_cloud_kms_v1::model::AsymmetricDecryptResponse;
16431 /// use google_cloud_kms_v1::model::ProtectionLevel;
16432 /// let x0 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Software);
16433 /// let x1 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::Hsm);
16434 /// let x2 = AsymmetricDecryptResponse::new().set_protection_level(ProtectionLevel::External);
16435 /// ```
16436 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16437 mut self,
16438 v: T,
16439 ) -> Self {
16440 self.protection_level = v.into();
16441 self
16442 }
16443}
16444
16445impl wkt::message::Message for AsymmetricDecryptResponse {
16446 fn typename() -> &'static str {
16447 "type.googleapis.com/google.cloud.kms.v1.AsymmetricDecryptResponse"
16448 }
16449}
16450
16451/// Response message for
16452/// [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign].
16453///
16454/// [google.cloud.kms.v1.KeyManagementService.MacSign]: crate::client::KeyManagementService::mac_sign
16455#[derive(Clone, Default, PartialEq)]
16456#[non_exhaustive]
16457pub struct MacSignResponse {
16458 /// The resource name of the
16459 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16460 /// Check this field to verify that the intended resource was used for signing.
16461 ///
16462 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16463 pub name: std::string::String,
16464
16465 /// The created signature.
16466 pub mac: ::bytes::Bytes,
16467
16468 /// Integrity verification field. A CRC32C checksum of the returned
16469 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac]. An
16470 /// integrity check of
16471 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] can be
16472 /// performed by computing the CRC32C checksum of
16473 /// [MacSignResponse.mac][google.cloud.kms.v1.MacSignResponse.mac] and
16474 /// comparing your results to this field. Discard the response in case of
16475 /// non-matching checksum values, and perform a limited number of retries. A
16476 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16477 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16478 /// across different languages. However, it is a non-negative integer, which
16479 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16480 /// languages that support this type.
16481 ///
16482 /// [google.cloud.kms.v1.MacSignResponse.mac]: crate::model::MacSignResponse::mac
16483 pub mac_crc32c: std::option::Option<wkt::Int64Value>,
16484
16485 /// Integrity verification field. A flag indicating whether
16486 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16487 /// was received by
16488 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16489 /// for the integrity verification of the
16490 /// [data][google.cloud.kms.v1.MacSignRequest.data]. A false value of this
16491 /// field indicates either that
16492 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16493 /// was left unset or that it was not delivered to
16494 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16495 /// set
16496 /// [MacSignRequest.data_crc32c][google.cloud.kms.v1.MacSignRequest.data_crc32c]
16497 /// but this field is still false, discard the response and perform a limited
16498 /// number of retries.
16499 ///
16500 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16501 /// [google.cloud.kms.v1.MacSignRequest.data]: crate::model::MacSignRequest::data
16502 /// [google.cloud.kms.v1.MacSignRequest.data_crc32c]: crate::model::MacSignRequest::data_crc32c
16503 pub verified_data_crc32c: bool,
16504
16505 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16506 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for signing.
16507 ///
16508 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16509 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16510 pub protection_level: crate::model::ProtectionLevel,
16511
16512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16513}
16514
16515impl MacSignResponse {
16516 /// Creates a new default instance.
16517 pub fn new() -> Self {
16518 std::default::Default::default()
16519 }
16520
16521 /// Sets the value of [name][crate::model::MacSignResponse::name].
16522 ///
16523 /// # Example
16524 /// ```ignore,no_run
16525 /// # use google_cloud_kms_v1::model::MacSignResponse;
16526 /// let x = MacSignResponse::new().set_name("example");
16527 /// ```
16528 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16529 self.name = v.into();
16530 self
16531 }
16532
16533 /// Sets the value of [mac][crate::model::MacSignResponse::mac].
16534 ///
16535 /// # Example
16536 /// ```ignore,no_run
16537 /// # use google_cloud_kms_v1::model::MacSignResponse;
16538 /// let x = MacSignResponse::new().set_mac(bytes::Bytes::from_static(b"example"));
16539 /// ```
16540 pub fn set_mac<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16541 self.mac = v.into();
16542 self
16543 }
16544
16545 /// Sets the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16546 ///
16547 /// # Example
16548 /// ```ignore,no_run
16549 /// # use google_cloud_kms_v1::model::MacSignResponse;
16550 /// use wkt::Int64Value;
16551 /// let x = MacSignResponse::new().set_mac_crc32c(Int64Value::default()/* use setters */);
16552 /// ```
16553 pub fn set_mac_crc32c<T>(mut self, v: T) -> Self
16554 where
16555 T: std::convert::Into<wkt::Int64Value>,
16556 {
16557 self.mac_crc32c = std::option::Option::Some(v.into());
16558 self
16559 }
16560
16561 /// Sets or clears the value of [mac_crc32c][crate::model::MacSignResponse::mac_crc32c].
16562 ///
16563 /// # Example
16564 /// ```ignore,no_run
16565 /// # use google_cloud_kms_v1::model::MacSignResponse;
16566 /// use wkt::Int64Value;
16567 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(Some(Int64Value::default()/* use setters */));
16568 /// let x = MacSignResponse::new().set_or_clear_mac_crc32c(None::<Int64Value>);
16569 /// ```
16570 pub fn set_or_clear_mac_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16571 where
16572 T: std::convert::Into<wkt::Int64Value>,
16573 {
16574 self.mac_crc32c = v.map(|x| x.into());
16575 self
16576 }
16577
16578 /// Sets the value of [verified_data_crc32c][crate::model::MacSignResponse::verified_data_crc32c].
16579 ///
16580 /// # Example
16581 /// ```ignore,no_run
16582 /// # use google_cloud_kms_v1::model::MacSignResponse;
16583 /// let x = MacSignResponse::new().set_verified_data_crc32c(true);
16584 /// ```
16585 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16586 self.verified_data_crc32c = v.into();
16587 self
16588 }
16589
16590 /// Sets the value of [protection_level][crate::model::MacSignResponse::protection_level].
16591 ///
16592 /// # Example
16593 /// ```ignore,no_run
16594 /// # use google_cloud_kms_v1::model::MacSignResponse;
16595 /// use google_cloud_kms_v1::model::ProtectionLevel;
16596 /// let x0 = MacSignResponse::new().set_protection_level(ProtectionLevel::Software);
16597 /// let x1 = MacSignResponse::new().set_protection_level(ProtectionLevel::Hsm);
16598 /// let x2 = MacSignResponse::new().set_protection_level(ProtectionLevel::External);
16599 /// ```
16600 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16601 mut self,
16602 v: T,
16603 ) -> Self {
16604 self.protection_level = v.into();
16605 self
16606 }
16607}
16608
16609impl wkt::message::Message for MacSignResponse {
16610 fn typename() -> &'static str {
16611 "type.googleapis.com/google.cloud.kms.v1.MacSignResponse"
16612 }
16613}
16614
16615/// Response message for
16616/// [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify].
16617///
16618/// [google.cloud.kms.v1.KeyManagementService.MacVerify]: crate::client::KeyManagementService::mac_verify
16619#[derive(Clone, Default, PartialEq)]
16620#[non_exhaustive]
16621pub struct MacVerifyResponse {
16622 /// The resource name of the
16623 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16624 /// verification. Check this field to verify that the intended resource was
16625 /// used for verification.
16626 ///
16627 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16628 pub name: std::string::String,
16629
16630 /// This field indicates whether or not the verification operation for
16631 /// [MacVerifyRequest.mac][google.cloud.kms.v1.MacVerifyRequest.mac] over
16632 /// [MacVerifyRequest.data][google.cloud.kms.v1.MacVerifyRequest.data] was
16633 /// successful.
16634 ///
16635 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16636 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16637 pub success: bool,
16638
16639 /// Integrity verification field. A flag indicating whether
16640 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16641 /// was received by
16642 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16643 /// for the integrity verification of the
16644 /// [data][google.cloud.kms.v1.MacVerifyRequest.data]. A false value of this
16645 /// field indicates either that
16646 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16647 /// was left unset or that it was not delivered to
16648 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16649 /// set
16650 /// [MacVerifyRequest.data_crc32c][google.cloud.kms.v1.MacVerifyRequest.data_crc32c]
16651 /// but this field is still false, discard the response and perform a limited
16652 /// number of retries.
16653 ///
16654 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16655 /// [google.cloud.kms.v1.MacVerifyRequest.data]: crate::model::MacVerifyRequest::data
16656 /// [google.cloud.kms.v1.MacVerifyRequest.data_crc32c]: crate::model::MacVerifyRequest::data_crc32c
16657 pub verified_data_crc32c: bool,
16658
16659 /// Integrity verification field. A flag indicating whether
16660 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16661 /// was received by
16662 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16663 /// for the integrity verification of the
16664 /// [data][google.cloud.kms.v1.MacVerifyRequest.mac]. A false value of this
16665 /// field indicates either that
16666 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16667 /// was left unset or that it was not delivered to
16668 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16669 /// set
16670 /// [MacVerifyRequest.mac_crc32c][google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]
16671 /// but this field is still false, discard the response and perform a limited
16672 /// number of retries.
16673 ///
16674 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16675 /// [google.cloud.kms.v1.MacVerifyRequest.mac]: crate::model::MacVerifyRequest::mac
16676 /// [google.cloud.kms.v1.MacVerifyRequest.mac_crc32c]: crate::model::MacVerifyRequest::mac_crc32c
16677 pub verified_mac_crc32c: bool,
16678
16679 /// Integrity verification field. This value is used for the integrity
16680 /// verification of [MacVerifyResponse.success]. If the value of this field
16681 /// contradicts the value of [MacVerifyResponse.success], discard the response
16682 /// and perform a limited number of retries.
16683 pub verified_success_integrity: bool,
16684
16685 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16686 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16687 /// verification.
16688 ///
16689 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16690 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16691 pub protection_level: crate::model::ProtectionLevel,
16692
16693 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16694}
16695
16696impl MacVerifyResponse {
16697 /// Creates a new default instance.
16698 pub fn new() -> Self {
16699 std::default::Default::default()
16700 }
16701
16702 /// Sets the value of [name][crate::model::MacVerifyResponse::name].
16703 ///
16704 /// # Example
16705 /// ```ignore,no_run
16706 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16707 /// let x = MacVerifyResponse::new().set_name("example");
16708 /// ```
16709 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16710 self.name = v.into();
16711 self
16712 }
16713
16714 /// Sets the value of [success][crate::model::MacVerifyResponse::success].
16715 ///
16716 /// # Example
16717 /// ```ignore,no_run
16718 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16719 /// let x = MacVerifyResponse::new().set_success(true);
16720 /// ```
16721 pub fn set_success<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16722 self.success = v.into();
16723 self
16724 }
16725
16726 /// Sets the value of [verified_data_crc32c][crate::model::MacVerifyResponse::verified_data_crc32c].
16727 ///
16728 /// # Example
16729 /// ```ignore,no_run
16730 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16731 /// let x = MacVerifyResponse::new().set_verified_data_crc32c(true);
16732 /// ```
16733 pub fn set_verified_data_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16734 self.verified_data_crc32c = v.into();
16735 self
16736 }
16737
16738 /// Sets the value of [verified_mac_crc32c][crate::model::MacVerifyResponse::verified_mac_crc32c].
16739 ///
16740 /// # Example
16741 /// ```ignore,no_run
16742 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16743 /// let x = MacVerifyResponse::new().set_verified_mac_crc32c(true);
16744 /// ```
16745 pub fn set_verified_mac_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16746 self.verified_mac_crc32c = v.into();
16747 self
16748 }
16749
16750 /// Sets the value of [verified_success_integrity][crate::model::MacVerifyResponse::verified_success_integrity].
16751 ///
16752 /// # Example
16753 /// ```ignore,no_run
16754 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16755 /// let x = MacVerifyResponse::new().set_verified_success_integrity(true);
16756 /// ```
16757 pub fn set_verified_success_integrity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16758 self.verified_success_integrity = v.into();
16759 self
16760 }
16761
16762 /// Sets the value of [protection_level][crate::model::MacVerifyResponse::protection_level].
16763 ///
16764 /// # Example
16765 /// ```ignore,no_run
16766 /// # use google_cloud_kms_v1::model::MacVerifyResponse;
16767 /// use google_cloud_kms_v1::model::ProtectionLevel;
16768 /// let x0 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Software);
16769 /// let x1 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::Hsm);
16770 /// let x2 = MacVerifyResponse::new().set_protection_level(ProtectionLevel::External);
16771 /// ```
16772 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16773 mut self,
16774 v: T,
16775 ) -> Self {
16776 self.protection_level = v.into();
16777 self
16778 }
16779}
16780
16781impl wkt::message::Message for MacVerifyResponse {
16782 fn typename() -> &'static str {
16783 "type.googleapis.com/google.cloud.kms.v1.MacVerifyResponse"
16784 }
16785}
16786
16787/// Response message for
16788/// [KeyManagementService.Decapsulate][google.cloud.kms.v1.KeyManagementService.Decapsulate].
16789///
16790/// [google.cloud.kms.v1.KeyManagementService.Decapsulate]: crate::client::KeyManagementService::decapsulate
16791#[derive(Clone, Default, PartialEq)]
16792#[non_exhaustive]
16793pub struct DecapsulateResponse {
16794 /// The resource name of the
16795 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used for
16796 /// decapsulation. Check this field to verify that the intended resource was
16797 /// used for decapsulation.
16798 ///
16799 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16800 pub name: std::string::String,
16801
16802 /// The decapsulated shared_secret originally encapsulated with the matching
16803 /// public key.
16804 pub shared_secret: ::bytes::Bytes,
16805
16806 /// Integrity verification field. A CRC32C checksum of the returned
16807 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret].
16808 /// An integrity check of
16809 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16810 /// can be performed by computing the CRC32C checksum of
16811 /// [DecapsulateResponse.shared_secret][google.cloud.kms.v1.DecapsulateResponse.shared_secret]
16812 /// and comparing your results to this field. Discard the response in case of
16813 /// non-matching checksum values, and perform a limited number of retries. A
16814 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16815 /// checksum. Note: receiving this response message indicates that
16816 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] is able to
16817 /// successfully decrypt the
16818 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. Note: This
16819 /// field is defined as int64 for reasons of compatibility across different
16820 /// languages. However, it is a non-negative integer, which will never exceed
16821 /// 2^32-1, and can be safely downconverted to uint32 in languages that support
16822 /// this type.
16823 ///
16824 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16825 /// [google.cloud.kms.v1.DecapsulateResponse.shared_secret]: crate::model::DecapsulateResponse::shared_secret
16826 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16827 pub shared_secret_crc32c: std::option::Option<i64>,
16828
16829 /// Integrity verification field. A flag indicating whether
16830 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16831 /// was received by
16832 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService] and used
16833 /// for the integrity verification of the
16834 /// [ciphertext][google.cloud.kms.v1.DecapsulateRequest.ciphertext]. A false
16835 /// value of this field indicates either that
16836 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16837 /// was left unset or that it was not delivered to
16838 /// [KeyManagementService][google.cloud.kms.v1.KeyManagementService]. If you've
16839 /// set
16840 /// [DecapsulateRequest.ciphertext_crc32c][google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]
16841 /// but this field is still false, discard the response and perform a limited
16842 /// number of retries.
16843 ///
16844 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext]: crate::model::DecapsulateRequest::ciphertext
16845 /// [google.cloud.kms.v1.DecapsulateRequest.ciphertext_crc32c]: crate::model::DecapsulateRequest::ciphertext_crc32c
16846 /// [google.cloud.kms.v1.KeyManagementService]: crate::client::KeyManagementService
16847 pub verified_ciphertext_crc32c: bool,
16848
16849 /// The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] of the
16850 /// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in
16851 /// decapsulation.
16852 ///
16853 /// [google.cloud.kms.v1.CryptoKeyVersion]: crate::model::CryptoKeyVersion
16854 /// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
16855 pub protection_level: crate::model::ProtectionLevel,
16856
16857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16858}
16859
16860impl DecapsulateResponse {
16861 /// Creates a new default instance.
16862 pub fn new() -> Self {
16863 std::default::Default::default()
16864 }
16865
16866 /// Sets the value of [name][crate::model::DecapsulateResponse::name].
16867 ///
16868 /// # Example
16869 /// ```ignore,no_run
16870 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16871 /// let x = DecapsulateResponse::new().set_name("example");
16872 /// ```
16873 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16874 self.name = v.into();
16875 self
16876 }
16877
16878 /// Sets the value of [shared_secret][crate::model::DecapsulateResponse::shared_secret].
16879 ///
16880 /// # Example
16881 /// ```ignore,no_run
16882 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16883 /// let x = DecapsulateResponse::new().set_shared_secret(bytes::Bytes::from_static(b"example"));
16884 /// ```
16885 pub fn set_shared_secret<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
16886 self.shared_secret = v.into();
16887 self
16888 }
16889
16890 /// Sets the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16891 ///
16892 /// # Example
16893 /// ```ignore,no_run
16894 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16895 /// let x = DecapsulateResponse::new().set_shared_secret_crc32c(42);
16896 /// ```
16897 pub fn set_shared_secret_crc32c<T>(mut self, v: T) -> Self
16898 where
16899 T: std::convert::Into<i64>,
16900 {
16901 self.shared_secret_crc32c = std::option::Option::Some(v.into());
16902 self
16903 }
16904
16905 /// Sets or clears the value of [shared_secret_crc32c][crate::model::DecapsulateResponse::shared_secret_crc32c].
16906 ///
16907 /// # Example
16908 /// ```ignore,no_run
16909 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16910 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(Some(42));
16911 /// let x = DecapsulateResponse::new().set_or_clear_shared_secret_crc32c(None::<i32>);
16912 /// ```
16913 pub fn set_or_clear_shared_secret_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
16914 where
16915 T: std::convert::Into<i64>,
16916 {
16917 self.shared_secret_crc32c = v.map(|x| x.into());
16918 self
16919 }
16920
16921 /// Sets the value of [verified_ciphertext_crc32c][crate::model::DecapsulateResponse::verified_ciphertext_crc32c].
16922 ///
16923 /// # Example
16924 /// ```ignore,no_run
16925 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16926 /// let x = DecapsulateResponse::new().set_verified_ciphertext_crc32c(true);
16927 /// ```
16928 pub fn set_verified_ciphertext_crc32c<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16929 self.verified_ciphertext_crc32c = v.into();
16930 self
16931 }
16932
16933 /// Sets the value of [protection_level][crate::model::DecapsulateResponse::protection_level].
16934 ///
16935 /// # Example
16936 /// ```ignore,no_run
16937 /// # use google_cloud_kms_v1::model::DecapsulateResponse;
16938 /// use google_cloud_kms_v1::model::ProtectionLevel;
16939 /// let x0 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Software);
16940 /// let x1 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::Hsm);
16941 /// let x2 = DecapsulateResponse::new().set_protection_level(ProtectionLevel::External);
16942 /// ```
16943 pub fn set_protection_level<T: std::convert::Into<crate::model::ProtectionLevel>>(
16944 mut self,
16945 v: T,
16946 ) -> Self {
16947 self.protection_level = v.into();
16948 self
16949 }
16950}
16951
16952impl wkt::message::Message for DecapsulateResponse {
16953 fn typename() -> &'static str {
16954 "type.googleapis.com/google.cloud.kms.v1.DecapsulateResponse"
16955 }
16956}
16957
16958/// Response message for
16959/// [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes].
16960///
16961/// [google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]: crate::client::KeyManagementService::generate_random_bytes
16962#[derive(Clone, Default, PartialEq)]
16963#[non_exhaustive]
16964pub struct GenerateRandomBytesResponse {
16965 /// The generated data.
16966 pub data: ::bytes::Bytes,
16967
16968 /// Integrity verification field. A CRC32C checksum of the returned
16969 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data].
16970 /// An integrity check of
16971 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16972 /// can be performed by computing the CRC32C checksum of
16973 /// [GenerateRandomBytesResponse.data][google.cloud.kms.v1.GenerateRandomBytesResponse.data]
16974 /// and comparing your results to this field. Discard the response in case of
16975 /// non-matching checksum values, and perform a limited number of retries. A
16976 /// persistent mismatch may indicate an issue in your computation of the CRC32C
16977 /// checksum. Note: This field is defined as int64 for reasons of compatibility
16978 /// across different languages. However, it is a non-negative integer, which
16979 /// will never exceed 2^32-1, and can be safely downconverted to uint32 in
16980 /// languages that support this type.
16981 ///
16982 /// [google.cloud.kms.v1.GenerateRandomBytesResponse.data]: crate::model::GenerateRandomBytesResponse::data
16983 pub data_crc32c: std::option::Option<wkt::Int64Value>,
16984
16985 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16986}
16987
16988impl GenerateRandomBytesResponse {
16989 /// Creates a new default instance.
16990 pub fn new() -> Self {
16991 std::default::Default::default()
16992 }
16993
16994 /// Sets the value of [data][crate::model::GenerateRandomBytesResponse::data].
16995 ///
16996 /// # Example
16997 /// ```ignore,no_run
16998 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
16999 /// let x = GenerateRandomBytesResponse::new().set_data(bytes::Bytes::from_static(b"example"));
17000 /// ```
17001 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17002 self.data = v.into();
17003 self
17004 }
17005
17006 /// Sets the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
17007 ///
17008 /// # Example
17009 /// ```ignore,no_run
17010 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17011 /// use wkt::Int64Value;
17012 /// let x = GenerateRandomBytesResponse::new().set_data_crc32c(Int64Value::default()/* use setters */);
17013 /// ```
17014 pub fn set_data_crc32c<T>(mut self, v: T) -> Self
17015 where
17016 T: std::convert::Into<wkt::Int64Value>,
17017 {
17018 self.data_crc32c = std::option::Option::Some(v.into());
17019 self
17020 }
17021
17022 /// Sets or clears the value of [data_crc32c][crate::model::GenerateRandomBytesResponse::data_crc32c].
17023 ///
17024 /// # Example
17025 /// ```ignore,no_run
17026 /// # use google_cloud_kms_v1::model::GenerateRandomBytesResponse;
17027 /// use wkt::Int64Value;
17028 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(Some(Int64Value::default()/* use setters */));
17029 /// let x = GenerateRandomBytesResponse::new().set_or_clear_data_crc32c(None::<Int64Value>);
17030 /// ```
17031 pub fn set_or_clear_data_crc32c<T>(mut self, v: std::option::Option<T>) -> Self
17032 where
17033 T: std::convert::Into<wkt::Int64Value>,
17034 {
17035 self.data_crc32c = v.map(|x| x.into());
17036 self
17037 }
17038}
17039
17040impl wkt::message::Message for GenerateRandomBytesResponse {
17041 fn typename() -> &'static str {
17042 "type.googleapis.com/google.cloud.kms.v1.GenerateRandomBytesResponse"
17043 }
17044}
17045
17046/// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest.
17047///
17048/// [google.cloud.kms.v1.Digest]: crate::model::Digest
17049#[derive(Clone, Default, PartialEq)]
17050#[non_exhaustive]
17051pub struct Digest {
17052 /// Required. The message digest.
17053 pub digest: std::option::Option<crate::model::digest::Digest>,
17054
17055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17056}
17057
17058impl Digest {
17059 /// Creates a new default instance.
17060 pub fn new() -> Self {
17061 std::default::Default::default()
17062 }
17063
17064 /// Sets the value of [digest][crate::model::Digest::digest].
17065 ///
17066 /// Note that all the setters affecting `digest` are mutually
17067 /// exclusive.
17068 ///
17069 /// # Example
17070 /// ```ignore,no_run
17071 /// # use google_cloud_kms_v1::model::Digest;
17072 /// use google_cloud_kms_v1::model::digest::Digest as DigestOneOf;
17073 /// let x = Digest::new().set_digest(Some(DigestOneOf::Sha256(bytes::Bytes::from_static(b"example"))));
17074 /// ```
17075 pub fn set_digest<T: std::convert::Into<std::option::Option<crate::model::digest::Digest>>>(
17076 mut self,
17077 v: T,
17078 ) -> Self {
17079 self.digest = v.into();
17080 self
17081 }
17082
17083 /// The value of [digest][crate::model::Digest::digest]
17084 /// if it holds a `Sha256`, `None` if the field is not set or
17085 /// holds a different branch.
17086 pub fn sha256(&self) -> std::option::Option<&::bytes::Bytes> {
17087 #[allow(unreachable_patterns)]
17088 self.digest.as_ref().and_then(|v| match v {
17089 crate::model::digest::Digest::Sha256(v) => std::option::Option::Some(v),
17090 _ => std::option::Option::None,
17091 })
17092 }
17093
17094 /// Sets the value of [digest][crate::model::Digest::digest]
17095 /// to hold a `Sha256`.
17096 ///
17097 /// Note that all the setters affecting `digest` are
17098 /// mutually exclusive.
17099 ///
17100 /// # Example
17101 /// ```ignore,no_run
17102 /// # use google_cloud_kms_v1::model::Digest;
17103 /// let x = Digest::new().set_sha256(bytes::Bytes::from_static(b"example"));
17104 /// assert!(x.sha256().is_some());
17105 /// assert!(x.sha384().is_none());
17106 /// assert!(x.sha512().is_none());
17107 /// assert!(x.external_mu().is_none());
17108 /// ```
17109 pub fn set_sha256<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17110 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha256(v.into()));
17111 self
17112 }
17113
17114 /// The value of [digest][crate::model::Digest::digest]
17115 /// if it holds a `Sha384`, `None` if the field is not set or
17116 /// holds a different branch.
17117 pub fn sha384(&self) -> std::option::Option<&::bytes::Bytes> {
17118 #[allow(unreachable_patterns)]
17119 self.digest.as_ref().and_then(|v| match v {
17120 crate::model::digest::Digest::Sha384(v) => std::option::Option::Some(v),
17121 _ => std::option::Option::None,
17122 })
17123 }
17124
17125 /// Sets the value of [digest][crate::model::Digest::digest]
17126 /// to hold a `Sha384`.
17127 ///
17128 /// Note that all the setters affecting `digest` are
17129 /// mutually exclusive.
17130 ///
17131 /// # Example
17132 /// ```ignore,no_run
17133 /// # use google_cloud_kms_v1::model::Digest;
17134 /// let x = Digest::new().set_sha384(bytes::Bytes::from_static(b"example"));
17135 /// assert!(x.sha384().is_some());
17136 /// assert!(x.sha256().is_none());
17137 /// assert!(x.sha512().is_none());
17138 /// assert!(x.external_mu().is_none());
17139 /// ```
17140 pub fn set_sha384<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17141 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha384(v.into()));
17142 self
17143 }
17144
17145 /// The value of [digest][crate::model::Digest::digest]
17146 /// if it holds a `Sha512`, `None` if the field is not set or
17147 /// holds a different branch.
17148 pub fn sha512(&self) -> std::option::Option<&::bytes::Bytes> {
17149 #[allow(unreachable_patterns)]
17150 self.digest.as_ref().and_then(|v| match v {
17151 crate::model::digest::Digest::Sha512(v) => std::option::Option::Some(v),
17152 _ => std::option::Option::None,
17153 })
17154 }
17155
17156 /// Sets the value of [digest][crate::model::Digest::digest]
17157 /// to hold a `Sha512`.
17158 ///
17159 /// Note that all the setters affecting `digest` are
17160 /// mutually exclusive.
17161 ///
17162 /// # Example
17163 /// ```ignore,no_run
17164 /// # use google_cloud_kms_v1::model::Digest;
17165 /// let x = Digest::new().set_sha512(bytes::Bytes::from_static(b"example"));
17166 /// assert!(x.sha512().is_some());
17167 /// assert!(x.sha256().is_none());
17168 /// assert!(x.sha384().is_none());
17169 /// assert!(x.external_mu().is_none());
17170 /// ```
17171 pub fn set_sha512<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17172 self.digest = std::option::Option::Some(crate::model::digest::Digest::Sha512(v.into()));
17173 self
17174 }
17175
17176 /// The value of [digest][crate::model::Digest::digest]
17177 /// if it holds a `ExternalMu`, `None` if the field is not set or
17178 /// holds a different branch.
17179 pub fn external_mu(&self) -> std::option::Option<&::bytes::Bytes> {
17180 #[allow(unreachable_patterns)]
17181 self.digest.as_ref().and_then(|v| match v {
17182 crate::model::digest::Digest::ExternalMu(v) => std::option::Option::Some(v),
17183 _ => std::option::Option::None,
17184 })
17185 }
17186
17187 /// Sets the value of [digest][crate::model::Digest::digest]
17188 /// to hold a `ExternalMu`.
17189 ///
17190 /// Note that all the setters affecting `digest` are
17191 /// mutually exclusive.
17192 ///
17193 /// # Example
17194 /// ```ignore,no_run
17195 /// # use google_cloud_kms_v1::model::Digest;
17196 /// let x = Digest::new().set_external_mu(bytes::Bytes::from_static(b"example"));
17197 /// assert!(x.external_mu().is_some());
17198 /// assert!(x.sha256().is_none());
17199 /// assert!(x.sha384().is_none());
17200 /// assert!(x.sha512().is_none());
17201 /// ```
17202 pub fn set_external_mu<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
17203 self.digest = std::option::Option::Some(crate::model::digest::Digest::ExternalMu(v.into()));
17204 self
17205 }
17206}
17207
17208impl wkt::message::Message for Digest {
17209 fn typename() -> &'static str {
17210 "type.googleapis.com/google.cloud.kms.v1.Digest"
17211 }
17212}
17213
17214/// Defines additional types related to [Digest].
17215pub mod digest {
17216 #[allow(unused_imports)]
17217 use super::*;
17218
17219 /// Required. The message digest.
17220 #[derive(Clone, Debug, PartialEq)]
17221 #[non_exhaustive]
17222 pub enum Digest {
17223 /// A message digest produced with the SHA-256 algorithm.
17224 Sha256(::bytes::Bytes),
17225 /// A message digest produced with the SHA-384 algorithm.
17226 Sha384(::bytes::Bytes),
17227 /// A message digest produced with the SHA-512 algorithm.
17228 Sha512(::bytes::Bytes),
17229 /// A message digest produced with SHAKE-256, to be used with ML-DSA
17230 /// external-μ algorithms only. See "message representative" note in
17231 /// section 6.2, algorithm 7 of the FIPS-204 standard:
17232 /// <https://doi.org/10.6028/nist.fips.204>
17233 ExternalMu(::bytes::Bytes),
17234 }
17235}
17236
17237/// Cloud KMS metadata for the given
17238/// [google.cloud.location.Location][google.cloud.location.Location].
17239///
17240/// [google.cloud.location.Location]: google_cloud_location::model::Location
17241#[derive(Clone, Default, PartialEq)]
17242#[non_exhaustive]
17243pub struct LocationMetadata {
17244 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17245 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17246 /// [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this
17247 /// location.
17248 ///
17249 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17250 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17251 /// [google.cloud.kms.v1.ProtectionLevel.HSM]: crate::model::ProtectionLevel::Hsm
17252 pub hsm_available: bool,
17253
17254 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17255 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17256 /// [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL] can be created in
17257 /// this location.
17258 ///
17259 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17260 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17261 /// [google.cloud.kms.v1.ProtectionLevel.EXTERNAL]: crate::model::ProtectionLevel::External
17262 pub ekm_available: bool,
17263
17264 /// Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with
17265 /// [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]
17266 /// [HSM_SINGLE_TENANT][google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]
17267 /// can be created in this location.
17268 ///
17269 /// [google.cloud.kms.v1.CryptoKey]: crate::model::CryptoKey
17270 /// [google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]: crate::model::CryptoKeyVersionTemplate::protection_level
17271 /// [google.cloud.kms.v1.ProtectionLevel.HSM_SINGLE_TENANT]: crate::model::ProtectionLevel::HsmSingleTenant
17272 pub hsm_single_tenant_available: bool,
17273
17274 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17275}
17276
17277impl LocationMetadata {
17278 /// Creates a new default instance.
17279 pub fn new() -> Self {
17280 std::default::Default::default()
17281 }
17282
17283 /// Sets the value of [hsm_available][crate::model::LocationMetadata::hsm_available].
17284 ///
17285 /// # Example
17286 /// ```ignore,no_run
17287 /// # use google_cloud_kms_v1::model::LocationMetadata;
17288 /// let x = LocationMetadata::new().set_hsm_available(true);
17289 /// ```
17290 pub fn set_hsm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17291 self.hsm_available = v.into();
17292 self
17293 }
17294
17295 /// Sets the value of [ekm_available][crate::model::LocationMetadata::ekm_available].
17296 ///
17297 /// # Example
17298 /// ```ignore,no_run
17299 /// # use google_cloud_kms_v1::model::LocationMetadata;
17300 /// let x = LocationMetadata::new().set_ekm_available(true);
17301 /// ```
17302 pub fn set_ekm_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17303 self.ekm_available = v.into();
17304 self
17305 }
17306
17307 /// Sets the value of [hsm_single_tenant_available][crate::model::LocationMetadata::hsm_single_tenant_available].
17308 ///
17309 /// # Example
17310 /// ```ignore,no_run
17311 /// # use google_cloud_kms_v1::model::LocationMetadata;
17312 /// let x = LocationMetadata::new().set_hsm_single_tenant_available(true);
17313 /// ```
17314 pub fn set_hsm_single_tenant_available<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17315 self.hsm_single_tenant_available = v.into();
17316 self
17317 }
17318}
17319
17320impl wkt::message::Message for LocationMetadata {
17321 fn typename() -> &'static str {
17322 "type.googleapis.com/google.cloud.kms.v1.LocationMetadata"
17323 }
17324}
17325
17326/// Represents the metadata of the
17327/// [KeyManagementService.DeleteCryptoKey][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]
17328/// long-running operation.
17329///
17330/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKey]: crate::client::KeyManagementService::delete_crypto_key
17331#[derive(Clone, Default, PartialEq)]
17332#[non_exhaustive]
17333pub struct DeleteCryptoKeyMetadata {
17334 /// Output only. The resource name of the
17335 /// [RetiredResource][google.cloud.kms.v1.RetiredResource] created as a result
17336 /// of this operation, in the format
17337 /// `projects/*/locations/*/retiredResources/*`.
17338 ///
17339 /// [google.cloud.kms.v1.RetiredResource]: crate::model::RetiredResource
17340 pub retired_resource: std::string::String,
17341
17342 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17343}
17344
17345impl DeleteCryptoKeyMetadata {
17346 /// Creates a new default instance.
17347 pub fn new() -> Self {
17348 std::default::Default::default()
17349 }
17350
17351 /// Sets the value of [retired_resource][crate::model::DeleteCryptoKeyMetadata::retired_resource].
17352 ///
17353 /// # Example
17354 /// ```ignore,no_run
17355 /// # use google_cloud_kms_v1::model::DeleteCryptoKeyMetadata;
17356 /// # let project_id = "project_id";
17357 /// # let location_id = "location_id";
17358 /// # let retired_resource_id = "retired_resource_id";
17359 /// let x = DeleteCryptoKeyMetadata::new().set_retired_resource(format!("projects/{project_id}/locations/{location_id}/retiredResources/{retired_resource_id}"));
17360 /// ```
17361 pub fn set_retired_resource<T: std::convert::Into<std::string::String>>(
17362 mut self,
17363 v: T,
17364 ) -> Self {
17365 self.retired_resource = v.into();
17366 self
17367 }
17368}
17369
17370impl wkt::message::Message for DeleteCryptoKeyMetadata {
17371 fn typename() -> &'static str {
17372 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyMetadata"
17373 }
17374}
17375
17376/// Represents the metadata of the
17377/// [KeyManagementService.DeleteCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]
17378/// long-running operation.
17379///
17380/// [google.cloud.kms.v1.KeyManagementService.DeleteCryptoKeyVersion]: crate::client::KeyManagementService::delete_crypto_key_version
17381#[derive(Clone, Default, PartialEq)]
17382#[non_exhaustive]
17383pub struct DeleteCryptoKeyVersionMetadata {
17384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17385}
17386
17387impl DeleteCryptoKeyVersionMetadata {
17388 /// Creates a new default instance.
17389 pub fn new() -> Self {
17390 std::default::Default::default()
17391 }
17392}
17393
17394impl wkt::message::Message for DeleteCryptoKeyVersionMetadata {
17395 fn typename() -> &'static str {
17396 "type.googleapis.com/google.cloud.kms.v1.DeleteCryptoKeyVersionMetadata"
17397 }
17398}
17399
17400/// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how
17401/// cryptographic operations are performed. For more information, see [Protection
17402/// levels] (<https://cloud.google.com/kms/docs/algorithms#protection_levels>).
17403///
17404/// [google.cloud.kms.v1.ProtectionLevel]: crate::model::ProtectionLevel
17405///
17406/// # Working with unknown values
17407///
17408/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17409/// additional enum variants at any time. Adding new variants is not considered
17410/// a breaking change. Applications should write their code in anticipation of:
17411///
17412/// - New values appearing in future releases of the client library, **and**
17413/// - New values received dynamically, without application changes.
17414///
17415/// Please consult the [Working with enums] section in the user guide for some
17416/// guidelines.
17417///
17418/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17419#[derive(Clone, Debug, PartialEq)]
17420#[non_exhaustive]
17421pub enum ProtectionLevel {
17422 /// Not specified.
17423 Unspecified,
17424 /// Crypto operations are performed in software.
17425 Software,
17426 /// Crypto operations are performed in a Hardware Security Module.
17427 Hsm,
17428 /// Crypto operations are performed by an external key manager.
17429 External,
17430 /// Crypto operations are performed in an EKM-over-VPC backend.
17431 ExternalVpc,
17432 /// Crypto operations are performed in a single-tenant HSM.
17433 HsmSingleTenant,
17434 /// If set, the enum was initialized with an unknown value.
17435 ///
17436 /// Applications can examine the value using [ProtectionLevel::value] or
17437 /// [ProtectionLevel::name].
17438 UnknownValue(protection_level::UnknownValue),
17439}
17440
17441#[doc(hidden)]
17442pub mod protection_level {
17443 #[allow(unused_imports)]
17444 use super::*;
17445 #[derive(Clone, Debug, PartialEq)]
17446 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17447}
17448
17449impl ProtectionLevel {
17450 /// Gets the enum value.
17451 ///
17452 /// Returns `None` if the enum contains an unknown value deserialized from
17453 /// the string representation of enums.
17454 pub fn value(&self) -> std::option::Option<i32> {
17455 match self {
17456 Self::Unspecified => std::option::Option::Some(0),
17457 Self::Software => std::option::Option::Some(1),
17458 Self::Hsm => std::option::Option::Some(2),
17459 Self::External => std::option::Option::Some(3),
17460 Self::ExternalVpc => std::option::Option::Some(4),
17461 Self::HsmSingleTenant => std::option::Option::Some(5),
17462 Self::UnknownValue(u) => u.0.value(),
17463 }
17464 }
17465
17466 /// Gets the enum value as a string.
17467 ///
17468 /// Returns `None` if the enum contains an unknown value deserialized from
17469 /// the integer representation of enums.
17470 pub fn name(&self) -> std::option::Option<&str> {
17471 match self {
17472 Self::Unspecified => std::option::Option::Some("PROTECTION_LEVEL_UNSPECIFIED"),
17473 Self::Software => std::option::Option::Some("SOFTWARE"),
17474 Self::Hsm => std::option::Option::Some("HSM"),
17475 Self::External => std::option::Option::Some("EXTERNAL"),
17476 Self::ExternalVpc => std::option::Option::Some("EXTERNAL_VPC"),
17477 Self::HsmSingleTenant => std::option::Option::Some("HSM_SINGLE_TENANT"),
17478 Self::UnknownValue(u) => u.0.name(),
17479 }
17480 }
17481}
17482
17483impl std::default::Default for ProtectionLevel {
17484 fn default() -> Self {
17485 use std::convert::From;
17486 Self::from(0)
17487 }
17488}
17489
17490impl std::fmt::Display for ProtectionLevel {
17491 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17492 wkt::internal::display_enum(f, self.name(), self.value())
17493 }
17494}
17495
17496impl std::convert::From<i32> for ProtectionLevel {
17497 fn from(value: i32) -> Self {
17498 match value {
17499 0 => Self::Unspecified,
17500 1 => Self::Software,
17501 2 => Self::Hsm,
17502 3 => Self::External,
17503 4 => Self::ExternalVpc,
17504 5 => Self::HsmSingleTenant,
17505 _ => Self::UnknownValue(protection_level::UnknownValue(
17506 wkt::internal::UnknownEnumValue::Integer(value),
17507 )),
17508 }
17509 }
17510}
17511
17512impl std::convert::From<&str> for ProtectionLevel {
17513 fn from(value: &str) -> Self {
17514 use std::string::ToString;
17515 match value {
17516 "PROTECTION_LEVEL_UNSPECIFIED" => Self::Unspecified,
17517 "SOFTWARE" => Self::Software,
17518 "HSM" => Self::Hsm,
17519 "EXTERNAL" => Self::External,
17520 "EXTERNAL_VPC" => Self::ExternalVpc,
17521 "HSM_SINGLE_TENANT" => Self::HsmSingleTenant,
17522 _ => Self::UnknownValue(protection_level::UnknownValue(
17523 wkt::internal::UnknownEnumValue::String(value.to_string()),
17524 )),
17525 }
17526 }
17527}
17528
17529impl serde::ser::Serialize for ProtectionLevel {
17530 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17531 where
17532 S: serde::Serializer,
17533 {
17534 match self {
17535 Self::Unspecified => serializer.serialize_i32(0),
17536 Self::Software => serializer.serialize_i32(1),
17537 Self::Hsm => serializer.serialize_i32(2),
17538 Self::External => serializer.serialize_i32(3),
17539 Self::ExternalVpc => serializer.serialize_i32(4),
17540 Self::HsmSingleTenant => serializer.serialize_i32(5),
17541 Self::UnknownValue(u) => u.0.serialize(serializer),
17542 }
17543 }
17544}
17545
17546impl<'de> serde::de::Deserialize<'de> for ProtectionLevel {
17547 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17548 where
17549 D: serde::Deserializer<'de>,
17550 {
17551 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ProtectionLevel>::new(
17552 ".google.cloud.kms.v1.ProtectionLevel",
17553 ))
17554 }
17555}
17556
17557/// Describes the reason for a data access. Please refer to
17558/// <https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes>
17559/// for the detailed semantic meaning of justification reason codes.
17560///
17561/// # Working with unknown values
17562///
17563/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17564/// additional enum variants at any time. Adding new variants is not considered
17565/// a breaking change. Applications should write their code in anticipation of:
17566///
17567/// - New values appearing in future releases of the client library, **and**
17568/// - New values received dynamically, without application changes.
17569///
17570/// Please consult the [Working with enums] section in the user guide for some
17571/// guidelines.
17572///
17573/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17574#[derive(Clone, Debug, PartialEq)]
17575#[non_exhaustive]
17576pub enum AccessReason {
17577 /// Unspecified access reason.
17578 ReasonUnspecified,
17579 /// Customer-initiated support.
17580 CustomerInitiatedSupport,
17581 /// Google-initiated access for system management and troubleshooting.
17582 GoogleInitiatedService,
17583 /// Google-initiated access in response to a legal request or legal process.
17584 ThirdPartyDataRequest,
17585 /// Google-initiated access for security, fraud, abuse, or compliance purposes.
17586 GoogleInitiatedReview,
17587 /// Customer uses their account to perform any access to their own data which
17588 /// their IAM policy authorizes.
17589 CustomerInitiatedAccess,
17590 /// Google systems access customer data to help optimize the structure of the
17591 /// data or quality for future uses by the customer.
17592 GoogleInitiatedSystemOperation,
17593 /// No reason is expected for this key request.
17594 ReasonNotExpected,
17595 /// Deprecated: This code is no longer generated by
17596 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17597 /// available in both Key Access Justifications and Access Transparency logs
17598 /// provide customer-visible signals of emergency access in more precise
17599 /// contexts.
17600 ///
17601 /// Customer uses their account to perform any access to their own data which
17602 /// their IAM policy authorizes, and one of the following is true:
17603 ///
17604 /// * A Google administrator has reset the root-access account associated with
17605 /// the user's organization within the past 7 days.
17606 /// * A Google-initiated emergency access operation has interacted with a
17607 /// resource in the same project or folder as the currently accessed resource
17608 /// within the past 7 days.
17609 #[deprecated]
17610 ModifiedCustomerInitiatedAccess,
17611 /// Deprecated: This code is no longer generated by
17612 /// Google Cloud. The GOOGLE_RESPONSE_TO_PRODUCTION_ALERT justification codes
17613 /// available in both Key Access Justifications and Access Transparency logs
17614 /// provide customer-visible signals of emergency access in more precise
17615 /// contexts.
17616 ///
17617 /// Google systems access customer data to help optimize the structure of the
17618 /// data or quality for future uses by the customer, and one of the following
17619 /// is true:
17620 ///
17621 /// * A Google administrator has reset the root-access account associated with
17622 /// the user's organization within the past 7 days.
17623 /// * A Google-initiated emergency access operation has interacted with a
17624 /// resource in the same project or folder as the currently accessed resource
17625 /// within the past 7 days.
17626 #[deprecated]
17627 ModifiedGoogleInitiatedSystemOperation,
17628 /// Google-initiated access to maintain system reliability.
17629 GoogleResponseToProductionAlert,
17630 /// One of the following operations is being executed while simultaneously
17631 /// encountering an internal technical issue which prevented a more precise
17632 /// justification code from being generated:
17633 ///
17634 /// * Your account has been used to perform any access to your own data which
17635 /// your IAM policy authorizes.
17636 /// * An automated Google system operates on encrypted customer data which your
17637 /// IAM policy authorizes.
17638 /// * Customer-initiated Google support access.
17639 /// * Google-initiated support access to protect system reliability.
17640 CustomerAuthorizedWorkflowServicing,
17641 /// If set, the enum was initialized with an unknown value.
17642 ///
17643 /// Applications can examine the value using [AccessReason::value] or
17644 /// [AccessReason::name].
17645 UnknownValue(access_reason::UnknownValue),
17646}
17647
17648#[doc(hidden)]
17649pub mod access_reason {
17650 #[allow(unused_imports)]
17651 use super::*;
17652 #[derive(Clone, Debug, PartialEq)]
17653 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17654}
17655
17656impl AccessReason {
17657 /// Gets the enum value.
17658 ///
17659 /// Returns `None` if the enum contains an unknown value deserialized from
17660 /// the string representation of enums.
17661 pub fn value(&self) -> std::option::Option<i32> {
17662 match self {
17663 Self::ReasonUnspecified => std::option::Option::Some(0),
17664 Self::CustomerInitiatedSupport => std::option::Option::Some(1),
17665 Self::GoogleInitiatedService => std::option::Option::Some(2),
17666 Self::ThirdPartyDataRequest => std::option::Option::Some(3),
17667 Self::GoogleInitiatedReview => std::option::Option::Some(4),
17668 Self::CustomerInitiatedAccess => std::option::Option::Some(5),
17669 Self::GoogleInitiatedSystemOperation => std::option::Option::Some(6),
17670 Self::ReasonNotExpected => std::option::Option::Some(7),
17671 Self::ModifiedCustomerInitiatedAccess => std::option::Option::Some(8),
17672 Self::ModifiedGoogleInitiatedSystemOperation => std::option::Option::Some(9),
17673 Self::GoogleResponseToProductionAlert => std::option::Option::Some(10),
17674 Self::CustomerAuthorizedWorkflowServicing => std::option::Option::Some(11),
17675 Self::UnknownValue(u) => u.0.value(),
17676 }
17677 }
17678
17679 /// Gets the enum value as a string.
17680 ///
17681 /// Returns `None` if the enum contains an unknown value deserialized from
17682 /// the integer representation of enums.
17683 pub fn name(&self) -> std::option::Option<&str> {
17684 match self {
17685 Self::ReasonUnspecified => std::option::Option::Some("REASON_UNSPECIFIED"),
17686 Self::CustomerInitiatedSupport => {
17687 std::option::Option::Some("CUSTOMER_INITIATED_SUPPORT")
17688 }
17689 Self::GoogleInitiatedService => std::option::Option::Some("GOOGLE_INITIATED_SERVICE"),
17690 Self::ThirdPartyDataRequest => std::option::Option::Some("THIRD_PARTY_DATA_REQUEST"),
17691 Self::GoogleInitiatedReview => std::option::Option::Some("GOOGLE_INITIATED_REVIEW"),
17692 Self::CustomerInitiatedAccess => std::option::Option::Some("CUSTOMER_INITIATED_ACCESS"),
17693 Self::GoogleInitiatedSystemOperation => {
17694 std::option::Option::Some("GOOGLE_INITIATED_SYSTEM_OPERATION")
17695 }
17696 Self::ReasonNotExpected => std::option::Option::Some("REASON_NOT_EXPECTED"),
17697 Self::ModifiedCustomerInitiatedAccess => {
17698 std::option::Option::Some("MODIFIED_CUSTOMER_INITIATED_ACCESS")
17699 }
17700 Self::ModifiedGoogleInitiatedSystemOperation => {
17701 std::option::Option::Some("MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION")
17702 }
17703 Self::GoogleResponseToProductionAlert => {
17704 std::option::Option::Some("GOOGLE_RESPONSE_TO_PRODUCTION_ALERT")
17705 }
17706 Self::CustomerAuthorizedWorkflowServicing => {
17707 std::option::Option::Some("CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING")
17708 }
17709 Self::UnknownValue(u) => u.0.name(),
17710 }
17711 }
17712}
17713
17714impl std::default::Default for AccessReason {
17715 fn default() -> Self {
17716 use std::convert::From;
17717 Self::from(0)
17718 }
17719}
17720
17721impl std::fmt::Display for AccessReason {
17722 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17723 wkt::internal::display_enum(f, self.name(), self.value())
17724 }
17725}
17726
17727impl std::convert::From<i32> for AccessReason {
17728 fn from(value: i32) -> Self {
17729 match value {
17730 0 => Self::ReasonUnspecified,
17731 1 => Self::CustomerInitiatedSupport,
17732 2 => Self::GoogleInitiatedService,
17733 3 => Self::ThirdPartyDataRequest,
17734 4 => Self::GoogleInitiatedReview,
17735 5 => Self::CustomerInitiatedAccess,
17736 6 => Self::GoogleInitiatedSystemOperation,
17737 7 => Self::ReasonNotExpected,
17738 8 => Self::ModifiedCustomerInitiatedAccess,
17739 9 => Self::ModifiedGoogleInitiatedSystemOperation,
17740 10 => Self::GoogleResponseToProductionAlert,
17741 11 => Self::CustomerAuthorizedWorkflowServicing,
17742 _ => Self::UnknownValue(access_reason::UnknownValue(
17743 wkt::internal::UnknownEnumValue::Integer(value),
17744 )),
17745 }
17746 }
17747}
17748
17749impl std::convert::From<&str> for AccessReason {
17750 fn from(value: &str) -> Self {
17751 use std::string::ToString;
17752 match value {
17753 "REASON_UNSPECIFIED" => Self::ReasonUnspecified,
17754 "CUSTOMER_INITIATED_SUPPORT" => Self::CustomerInitiatedSupport,
17755 "GOOGLE_INITIATED_SERVICE" => Self::GoogleInitiatedService,
17756 "THIRD_PARTY_DATA_REQUEST" => Self::ThirdPartyDataRequest,
17757 "GOOGLE_INITIATED_REVIEW" => Self::GoogleInitiatedReview,
17758 "CUSTOMER_INITIATED_ACCESS" => Self::CustomerInitiatedAccess,
17759 "GOOGLE_INITIATED_SYSTEM_OPERATION" => Self::GoogleInitiatedSystemOperation,
17760 "REASON_NOT_EXPECTED" => Self::ReasonNotExpected,
17761 "MODIFIED_CUSTOMER_INITIATED_ACCESS" => Self::ModifiedCustomerInitiatedAccess,
17762 "MODIFIED_GOOGLE_INITIATED_SYSTEM_OPERATION" => {
17763 Self::ModifiedGoogleInitiatedSystemOperation
17764 }
17765 "GOOGLE_RESPONSE_TO_PRODUCTION_ALERT" => Self::GoogleResponseToProductionAlert,
17766 "CUSTOMER_AUTHORIZED_WORKFLOW_SERVICING" => Self::CustomerAuthorizedWorkflowServicing,
17767 _ => Self::UnknownValue(access_reason::UnknownValue(
17768 wkt::internal::UnknownEnumValue::String(value.to_string()),
17769 )),
17770 }
17771 }
17772}
17773
17774impl serde::ser::Serialize for AccessReason {
17775 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17776 where
17777 S: serde::Serializer,
17778 {
17779 match self {
17780 Self::ReasonUnspecified => serializer.serialize_i32(0),
17781 Self::CustomerInitiatedSupport => serializer.serialize_i32(1),
17782 Self::GoogleInitiatedService => serializer.serialize_i32(2),
17783 Self::ThirdPartyDataRequest => serializer.serialize_i32(3),
17784 Self::GoogleInitiatedReview => serializer.serialize_i32(4),
17785 Self::CustomerInitiatedAccess => serializer.serialize_i32(5),
17786 Self::GoogleInitiatedSystemOperation => serializer.serialize_i32(6),
17787 Self::ReasonNotExpected => serializer.serialize_i32(7),
17788 Self::ModifiedCustomerInitiatedAccess => serializer.serialize_i32(8),
17789 Self::ModifiedGoogleInitiatedSystemOperation => serializer.serialize_i32(9),
17790 Self::GoogleResponseToProductionAlert => serializer.serialize_i32(10),
17791 Self::CustomerAuthorizedWorkflowServicing => serializer.serialize_i32(11),
17792 Self::UnknownValue(u) => u.0.serialize(serializer),
17793 }
17794 }
17795}
17796
17797impl<'de> serde::de::Deserialize<'de> for AccessReason {
17798 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17799 where
17800 D: serde::Deserializer<'de>,
17801 {
17802 deserializer.deserialize_any(wkt::internal::EnumVisitor::<AccessReason>::new(
17803 ".google.cloud.kms.v1.AccessReason",
17804 ))
17805 }
17806}