google_cloud_assuredworkloads_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_longrunning;
25extern crate google_cloud_lro;
26extern crate lazy_static;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Request for creating a workload.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct CreateWorkloadRequest {
42 /// Required. The resource name of the new Workload's parent.
43 /// Must be of the form `organizations/{org_id}/locations/{location_id}`.
44 pub parent: std::string::String,
45
46 /// Required. Assured Workload to create
47 pub workload: std::option::Option<crate::model::Workload>,
48
49 /// Optional. A identifier associated with the workload and underlying projects which
50 /// allows for the break down of billing costs for a workload. The value
51 /// provided for the identifier will add a label to the workload and contained
52 /// projects with the identifier as the value.
53 pub external_id: std::string::String,
54
55 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
56}
57
58impl CreateWorkloadRequest {
59 pub fn new() -> Self {
60 std::default::Default::default()
61 }
62
63 /// Sets the value of [parent][crate::model::CreateWorkloadRequest::parent].
64 ///
65 /// # Example
66 /// ```ignore,no_run
67 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadRequest;
68 /// let x = CreateWorkloadRequest::new().set_parent("example");
69 /// ```
70 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
71 self.parent = v.into();
72 self
73 }
74
75 /// Sets the value of [workload][crate::model::CreateWorkloadRequest::workload].
76 ///
77 /// # Example
78 /// ```ignore,no_run
79 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadRequest;
80 /// use google_cloud_assuredworkloads_v1::model::Workload;
81 /// let x = CreateWorkloadRequest::new().set_workload(Workload::default()/* use setters */);
82 /// ```
83 pub fn set_workload<T>(mut self, v: T) -> Self
84 where
85 T: std::convert::Into<crate::model::Workload>,
86 {
87 self.workload = std::option::Option::Some(v.into());
88 self
89 }
90
91 /// Sets or clears the value of [workload][crate::model::CreateWorkloadRequest::workload].
92 ///
93 /// # Example
94 /// ```ignore,no_run
95 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadRequest;
96 /// use google_cloud_assuredworkloads_v1::model::Workload;
97 /// let x = CreateWorkloadRequest::new().set_or_clear_workload(Some(Workload::default()/* use setters */));
98 /// let x = CreateWorkloadRequest::new().set_or_clear_workload(None::<Workload>);
99 /// ```
100 pub fn set_or_clear_workload<T>(mut self, v: std::option::Option<T>) -> Self
101 where
102 T: std::convert::Into<crate::model::Workload>,
103 {
104 self.workload = v.map(|x| x.into());
105 self
106 }
107
108 /// Sets the value of [external_id][crate::model::CreateWorkloadRequest::external_id].
109 ///
110 /// # Example
111 /// ```ignore,no_run
112 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadRequest;
113 /// let x = CreateWorkloadRequest::new().set_external_id("example");
114 /// ```
115 pub fn set_external_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
116 self.external_id = v.into();
117 self
118 }
119}
120
121impl wkt::message::Message for CreateWorkloadRequest {
122 fn typename() -> &'static str {
123 "type.googleapis.com/google.cloud.assuredworkloads.v1.CreateWorkloadRequest"
124 }
125}
126
127/// Request for Updating a workload.
128#[derive(Clone, Default, PartialEq)]
129#[non_exhaustive]
130pub struct UpdateWorkloadRequest {
131 /// Required. The workload to update.
132 /// The workload's `name` field is used to identify the workload to be updated.
133 /// Format:
134 /// organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
135 pub workload: std::option::Option<crate::model::Workload>,
136
137 /// Required. The list of fields to be updated.
138 pub update_mask: std::option::Option<wkt::FieldMask>,
139
140 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
141}
142
143impl UpdateWorkloadRequest {
144 pub fn new() -> Self {
145 std::default::Default::default()
146 }
147
148 /// Sets the value of [workload][crate::model::UpdateWorkloadRequest::workload].
149 ///
150 /// # Example
151 /// ```ignore,no_run
152 /// # use google_cloud_assuredworkloads_v1::model::UpdateWorkloadRequest;
153 /// use google_cloud_assuredworkloads_v1::model::Workload;
154 /// let x = UpdateWorkloadRequest::new().set_workload(Workload::default()/* use setters */);
155 /// ```
156 pub fn set_workload<T>(mut self, v: T) -> Self
157 where
158 T: std::convert::Into<crate::model::Workload>,
159 {
160 self.workload = std::option::Option::Some(v.into());
161 self
162 }
163
164 /// Sets or clears the value of [workload][crate::model::UpdateWorkloadRequest::workload].
165 ///
166 /// # Example
167 /// ```ignore,no_run
168 /// # use google_cloud_assuredworkloads_v1::model::UpdateWorkloadRequest;
169 /// use google_cloud_assuredworkloads_v1::model::Workload;
170 /// let x = UpdateWorkloadRequest::new().set_or_clear_workload(Some(Workload::default()/* use setters */));
171 /// let x = UpdateWorkloadRequest::new().set_or_clear_workload(None::<Workload>);
172 /// ```
173 pub fn set_or_clear_workload<T>(mut self, v: std::option::Option<T>) -> Self
174 where
175 T: std::convert::Into<crate::model::Workload>,
176 {
177 self.workload = v.map(|x| x.into());
178 self
179 }
180
181 /// Sets the value of [update_mask][crate::model::UpdateWorkloadRequest::update_mask].
182 ///
183 /// # Example
184 /// ```ignore,no_run
185 /// # use google_cloud_assuredworkloads_v1::model::UpdateWorkloadRequest;
186 /// use wkt::FieldMask;
187 /// let x = UpdateWorkloadRequest::new().set_update_mask(FieldMask::default()/* use setters */);
188 /// ```
189 pub fn set_update_mask<T>(mut self, v: T) -> Self
190 where
191 T: std::convert::Into<wkt::FieldMask>,
192 {
193 self.update_mask = std::option::Option::Some(v.into());
194 self
195 }
196
197 /// Sets or clears the value of [update_mask][crate::model::UpdateWorkloadRequest::update_mask].
198 ///
199 /// # Example
200 /// ```ignore,no_run
201 /// # use google_cloud_assuredworkloads_v1::model::UpdateWorkloadRequest;
202 /// use wkt::FieldMask;
203 /// let x = UpdateWorkloadRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
204 /// let x = UpdateWorkloadRequest::new().set_or_clear_update_mask(None::<FieldMask>);
205 /// ```
206 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
207 where
208 T: std::convert::Into<wkt::FieldMask>,
209 {
210 self.update_mask = v.map(|x| x.into());
211 self
212 }
213}
214
215impl wkt::message::Message for UpdateWorkloadRequest {
216 fn typename() -> &'static str {
217 "type.googleapis.com/google.cloud.assuredworkloads.v1.UpdateWorkloadRequest"
218 }
219}
220
221/// Request for deleting a Workload.
222#[derive(Clone, Default, PartialEq)]
223#[non_exhaustive]
224pub struct DeleteWorkloadRequest {
225 /// Required. The `name` field is used to identify the workload.
226 /// Format:
227 /// organizations/{org_id}/locations/{location_id}/workloads/{workload_id}
228 pub name: std::string::String,
229
230 /// Optional. The etag of the workload.
231 /// If this is provided, it must match the server's etag.
232 pub etag: std::string::String,
233
234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
235}
236
237impl DeleteWorkloadRequest {
238 pub fn new() -> Self {
239 std::default::Default::default()
240 }
241
242 /// Sets the value of [name][crate::model::DeleteWorkloadRequest::name].
243 ///
244 /// # Example
245 /// ```ignore,no_run
246 /// # use google_cloud_assuredworkloads_v1::model::DeleteWorkloadRequest;
247 /// let x = DeleteWorkloadRequest::new().set_name("example");
248 /// ```
249 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250 self.name = v.into();
251 self
252 }
253
254 /// Sets the value of [etag][crate::model::DeleteWorkloadRequest::etag].
255 ///
256 /// # Example
257 /// ```ignore,no_run
258 /// # use google_cloud_assuredworkloads_v1::model::DeleteWorkloadRequest;
259 /// let x = DeleteWorkloadRequest::new().set_etag("example");
260 /// ```
261 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
262 self.etag = v.into();
263 self
264 }
265}
266
267impl wkt::message::Message for DeleteWorkloadRequest {
268 fn typename() -> &'static str {
269 "type.googleapis.com/google.cloud.assuredworkloads.v1.DeleteWorkloadRequest"
270 }
271}
272
273/// Request for fetching a workload.
274#[derive(Clone, Default, PartialEq)]
275#[non_exhaustive]
276pub struct GetWorkloadRequest {
277 /// Required. The resource name of the Workload to fetch. This is the workload's
278 /// relative path in the API, formatted as
279 /// "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}".
280 /// For example,
281 /// "organizations/123/locations/us-east1/workloads/assured-workload-1".
282 pub name: std::string::String,
283
284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
285}
286
287impl GetWorkloadRequest {
288 pub fn new() -> Self {
289 std::default::Default::default()
290 }
291
292 /// Sets the value of [name][crate::model::GetWorkloadRequest::name].
293 ///
294 /// # Example
295 /// ```ignore,no_run
296 /// # use google_cloud_assuredworkloads_v1::model::GetWorkloadRequest;
297 /// let x = GetWorkloadRequest::new().set_name("example");
298 /// ```
299 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
300 self.name = v.into();
301 self
302 }
303}
304
305impl wkt::message::Message for GetWorkloadRequest {
306 fn typename() -> &'static str {
307 "type.googleapis.com/google.cloud.assuredworkloads.v1.GetWorkloadRequest"
308 }
309}
310
311/// Request for fetching workloads in an organization.
312#[derive(Clone, Default, PartialEq)]
313#[non_exhaustive]
314pub struct ListWorkloadsRequest {
315 /// Required. Parent Resource to list workloads from.
316 /// Must be of the form `organizations/{org_id}/locations/{location}`.
317 pub parent: std::string::String,
318
319 /// Page size.
320 pub page_size: i32,
321
322 /// Page token returned from previous request. Page token contains context from
323 /// previous request. Page token needs to be passed in the second and following
324 /// requests.
325 pub page_token: std::string::String,
326
327 /// A custom filter for filtering by properties of a workload. At this time,
328 /// only filtering by labels is supported.
329 pub filter: std::string::String,
330
331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
332}
333
334impl ListWorkloadsRequest {
335 pub fn new() -> Self {
336 std::default::Default::default()
337 }
338
339 /// Sets the value of [parent][crate::model::ListWorkloadsRequest::parent].
340 ///
341 /// # Example
342 /// ```ignore,no_run
343 /// # use google_cloud_assuredworkloads_v1::model::ListWorkloadsRequest;
344 /// let x = ListWorkloadsRequest::new().set_parent("example");
345 /// ```
346 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
347 self.parent = v.into();
348 self
349 }
350
351 /// Sets the value of [page_size][crate::model::ListWorkloadsRequest::page_size].
352 ///
353 /// # Example
354 /// ```ignore,no_run
355 /// # use google_cloud_assuredworkloads_v1::model::ListWorkloadsRequest;
356 /// let x = ListWorkloadsRequest::new().set_page_size(42);
357 /// ```
358 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
359 self.page_size = v.into();
360 self
361 }
362
363 /// Sets the value of [page_token][crate::model::ListWorkloadsRequest::page_token].
364 ///
365 /// # Example
366 /// ```ignore,no_run
367 /// # use google_cloud_assuredworkloads_v1::model::ListWorkloadsRequest;
368 /// let x = ListWorkloadsRequest::new().set_page_token("example");
369 /// ```
370 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
371 self.page_token = v.into();
372 self
373 }
374
375 /// Sets the value of [filter][crate::model::ListWorkloadsRequest::filter].
376 ///
377 /// # Example
378 /// ```ignore,no_run
379 /// # use google_cloud_assuredworkloads_v1::model::ListWorkloadsRequest;
380 /// let x = ListWorkloadsRequest::new().set_filter("example");
381 /// ```
382 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
383 self.filter = v.into();
384 self
385 }
386}
387
388impl wkt::message::Message for ListWorkloadsRequest {
389 fn typename() -> &'static str {
390 "type.googleapis.com/google.cloud.assuredworkloads.v1.ListWorkloadsRequest"
391 }
392}
393
394/// Response of ListWorkloads endpoint.
395#[derive(Clone, Default, PartialEq)]
396#[non_exhaustive]
397pub struct ListWorkloadsResponse {
398 /// List of Workloads under a given parent.
399 pub workloads: std::vec::Vec<crate::model::Workload>,
400
401 /// The next page token. Return empty if reached the last page.
402 pub next_page_token: std::string::String,
403
404 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
405}
406
407impl ListWorkloadsResponse {
408 pub fn new() -> Self {
409 std::default::Default::default()
410 }
411
412 /// Sets the value of [workloads][crate::model::ListWorkloadsResponse::workloads].
413 ///
414 /// # Example
415 /// ```ignore,no_run
416 /// # use google_cloud_assuredworkloads_v1::model::ListWorkloadsResponse;
417 /// use google_cloud_assuredworkloads_v1::model::Workload;
418 /// let x = ListWorkloadsResponse::new()
419 /// .set_workloads([
420 /// Workload::default()/* use setters */,
421 /// Workload::default()/* use (different) setters */,
422 /// ]);
423 /// ```
424 pub fn set_workloads<T, V>(mut self, v: T) -> Self
425 where
426 T: std::iter::IntoIterator<Item = V>,
427 V: std::convert::Into<crate::model::Workload>,
428 {
429 use std::iter::Iterator;
430 self.workloads = v.into_iter().map(|i| i.into()).collect();
431 self
432 }
433
434 /// Sets the value of [next_page_token][crate::model::ListWorkloadsResponse::next_page_token].
435 ///
436 /// # Example
437 /// ```ignore,no_run
438 /// # use google_cloud_assuredworkloads_v1::model::ListWorkloadsResponse;
439 /// let x = ListWorkloadsResponse::new().set_next_page_token("example");
440 /// ```
441 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
442 self.next_page_token = v.into();
443 self
444 }
445}
446
447impl wkt::message::Message for ListWorkloadsResponse {
448 fn typename() -> &'static str {
449 "type.googleapis.com/google.cloud.assuredworkloads.v1.ListWorkloadsResponse"
450 }
451}
452
453#[doc(hidden)]
454impl google_cloud_gax::paginator::internal::PageableResponse for ListWorkloadsResponse {
455 type PageItem = crate::model::Workload;
456
457 fn items(self) -> std::vec::Vec<Self::PageItem> {
458 self.workloads
459 }
460
461 fn next_page_token(&self) -> std::string::String {
462 use std::clone::Clone;
463 self.next_page_token.clone()
464 }
465}
466
467/// A Workload object for managing highly regulated workloads of cloud
468/// customers.
469#[derive(Clone, Default, PartialEq)]
470#[non_exhaustive]
471pub struct Workload {
472 /// Optional. The resource name of the workload.
473 /// Format:
474 /// organizations/{organization}/locations/{location}/workloads/{workload}
475 ///
476 /// Read-only.
477 pub name: std::string::String,
478
479 /// Required. The user-assigned display name of the Workload.
480 /// When present it must be between 4 to 30 characters.
481 /// Allowed characters are: lowercase and uppercase letters, numbers,
482 /// hyphen, and spaces.
483 ///
484 /// Example: My Workload
485 pub display_name: std::string::String,
486
487 /// Output only. The resources associated with this workload.
488 /// These resources will be created when creating the workload.
489 /// If any of the projects already exist, the workload creation will fail.
490 /// Always read only.
491 pub resources: std::vec::Vec<crate::model::workload::ResourceInfo>,
492
493 /// Required. Immutable. Compliance Regime associated with this workload.
494 pub compliance_regime: crate::model::workload::ComplianceRegime,
495
496 /// Output only. Immutable. The Workload creation timestamp.
497 pub create_time: std::option::Option<wkt::Timestamp>,
498
499 /// Optional. The billing account used for the resources which are
500 /// direct children of workload. This billing account is initially associated
501 /// with the resources created as part of Workload creation.
502 /// After the initial creation of these resources, the customer can change
503 /// the assigned billing account.
504 /// The resource name has the form
505 /// `billingAccounts/{billing_account_id}`. For example,
506 /// `billingAccounts/012345-567890-ABCDEF`.
507 pub billing_account: std::string::String,
508
509 /// Optional. ETag of the workload, it is calculated on the basis
510 /// of the Workload contents. It will be used in Update & Delete operations.
511 pub etag: std::string::String,
512
513 /// Optional. Labels applied to the workload.
514 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
515
516 /// Input only. The parent resource for the resources managed by this Assured Workload. May
517 /// be either empty or a folder resource which is a child of the
518 /// Workload parent. If not specified all resources are created under the
519 /// parent organization.
520 /// Format:
521 /// folders/{folder_id}
522 pub provisioned_resources_parent: std::string::String,
523
524 /// Input only. Settings used to create a CMEK crypto key. When set, a project with a KMS
525 /// CMEK key is provisioned.
526 /// This field is deprecated as of Feb 28, 2022.
527 /// In order to create a Keyring, callers should specify,
528 /// ENCRYPTION_KEYS_PROJECT or KEYRING in ResourceSettings.resource_type field.
529 #[deprecated]
530 pub kms_settings: std::option::Option<crate::model::workload::KMSSettings>,
531
532 /// Input only. Resource properties that are used to customize workload resources.
533 /// These properties (such as custom project id) will be used to create
534 /// workload resources if possible. This field is optional.
535 pub resource_settings: std::vec::Vec<crate::model::workload::ResourceSettings>,
536
537 /// Output only. Represents the KAJ enrollment state of the given workload.
538 pub kaj_enrollment_state: crate::model::workload::KajEnrollmentState,
539
540 /// Optional. Indicates the sovereignty status of the given workload.
541 /// Currently meant to be used by Europe/Canada customers.
542 pub enable_sovereign_controls: bool,
543
544 /// Output only. Represents the SAA enrollment response of the given workload.
545 /// SAA enrollment response is queried during GetWorkload call.
546 /// In failure cases, user friendly error message is shown in SAA details page.
547 pub saa_enrollment_response: std::option::Option<crate::model::workload::SaaEnrollmentResponse>,
548
549 /// Output only. Urls for services which are compliant for this Assured Workload, but which
550 /// are currently disallowed by the ResourceUsageRestriction org policy.
551 /// Invoke RestrictAllowedResources endpoint to allow your project developers
552 /// to use these services in their environment."
553 pub compliant_but_disallowed_services: std::vec::Vec<std::string::String>,
554
555 /// Optional. Compliance Regime associated with this workload.
556 pub partner: crate::model::workload::Partner,
557
558 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
559}
560
561impl Workload {
562 pub fn new() -> Self {
563 std::default::Default::default()
564 }
565
566 /// Sets the value of [name][crate::model::Workload::name].
567 ///
568 /// # Example
569 /// ```ignore,no_run
570 /// # use google_cloud_assuredworkloads_v1::model::Workload;
571 /// let x = Workload::new().set_name("example");
572 /// ```
573 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
574 self.name = v.into();
575 self
576 }
577
578 /// Sets the value of [display_name][crate::model::Workload::display_name].
579 ///
580 /// # Example
581 /// ```ignore,no_run
582 /// # use google_cloud_assuredworkloads_v1::model::Workload;
583 /// let x = Workload::new().set_display_name("example");
584 /// ```
585 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
586 self.display_name = v.into();
587 self
588 }
589
590 /// Sets the value of [resources][crate::model::Workload::resources].
591 ///
592 /// # Example
593 /// ```ignore,no_run
594 /// # use google_cloud_assuredworkloads_v1::model::Workload;
595 /// use google_cloud_assuredworkloads_v1::model::workload::ResourceInfo;
596 /// let x = Workload::new()
597 /// .set_resources([
598 /// ResourceInfo::default()/* use setters */,
599 /// ResourceInfo::default()/* use (different) setters */,
600 /// ]);
601 /// ```
602 pub fn set_resources<T, V>(mut self, v: T) -> Self
603 where
604 T: std::iter::IntoIterator<Item = V>,
605 V: std::convert::Into<crate::model::workload::ResourceInfo>,
606 {
607 use std::iter::Iterator;
608 self.resources = v.into_iter().map(|i| i.into()).collect();
609 self
610 }
611
612 /// Sets the value of [compliance_regime][crate::model::Workload::compliance_regime].
613 ///
614 /// # Example
615 /// ```ignore,no_run
616 /// # use google_cloud_assuredworkloads_v1::model::Workload;
617 /// use google_cloud_assuredworkloads_v1::model::workload::ComplianceRegime;
618 /// let x0 = Workload::new().set_compliance_regime(ComplianceRegime::Il4);
619 /// let x1 = Workload::new().set_compliance_regime(ComplianceRegime::Cjis);
620 /// let x2 = Workload::new().set_compliance_regime(ComplianceRegime::FedrampHigh);
621 /// ```
622 pub fn set_compliance_regime<
623 T: std::convert::Into<crate::model::workload::ComplianceRegime>,
624 >(
625 mut self,
626 v: T,
627 ) -> Self {
628 self.compliance_regime = v.into();
629 self
630 }
631
632 /// Sets the value of [create_time][crate::model::Workload::create_time].
633 ///
634 /// # Example
635 /// ```ignore,no_run
636 /// # use google_cloud_assuredworkloads_v1::model::Workload;
637 /// use wkt::Timestamp;
638 /// let x = Workload::new().set_create_time(Timestamp::default()/* use setters */);
639 /// ```
640 pub fn set_create_time<T>(mut self, v: T) -> Self
641 where
642 T: std::convert::Into<wkt::Timestamp>,
643 {
644 self.create_time = std::option::Option::Some(v.into());
645 self
646 }
647
648 /// Sets or clears the value of [create_time][crate::model::Workload::create_time].
649 ///
650 /// # Example
651 /// ```ignore,no_run
652 /// # use google_cloud_assuredworkloads_v1::model::Workload;
653 /// use wkt::Timestamp;
654 /// let x = Workload::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
655 /// let x = Workload::new().set_or_clear_create_time(None::<Timestamp>);
656 /// ```
657 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
658 where
659 T: std::convert::Into<wkt::Timestamp>,
660 {
661 self.create_time = v.map(|x| x.into());
662 self
663 }
664
665 /// Sets the value of [billing_account][crate::model::Workload::billing_account].
666 ///
667 /// # Example
668 /// ```ignore,no_run
669 /// # use google_cloud_assuredworkloads_v1::model::Workload;
670 /// let x = Workload::new().set_billing_account("example");
671 /// ```
672 pub fn set_billing_account<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
673 self.billing_account = v.into();
674 self
675 }
676
677 /// Sets the value of [etag][crate::model::Workload::etag].
678 ///
679 /// # Example
680 /// ```ignore,no_run
681 /// # use google_cloud_assuredworkloads_v1::model::Workload;
682 /// let x = Workload::new().set_etag("example");
683 /// ```
684 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
685 self.etag = v.into();
686 self
687 }
688
689 /// Sets the value of [labels][crate::model::Workload::labels].
690 ///
691 /// # Example
692 /// ```ignore,no_run
693 /// # use google_cloud_assuredworkloads_v1::model::Workload;
694 /// let x = Workload::new().set_labels([
695 /// ("key0", "abc"),
696 /// ("key1", "xyz"),
697 /// ]);
698 /// ```
699 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
700 where
701 T: std::iter::IntoIterator<Item = (K, V)>,
702 K: std::convert::Into<std::string::String>,
703 V: std::convert::Into<std::string::String>,
704 {
705 use std::iter::Iterator;
706 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
707 self
708 }
709
710 /// Sets the value of [provisioned_resources_parent][crate::model::Workload::provisioned_resources_parent].
711 ///
712 /// # Example
713 /// ```ignore,no_run
714 /// # use google_cloud_assuredworkloads_v1::model::Workload;
715 /// let x = Workload::new().set_provisioned_resources_parent("example");
716 /// ```
717 pub fn set_provisioned_resources_parent<T: std::convert::Into<std::string::String>>(
718 mut self,
719 v: T,
720 ) -> Self {
721 self.provisioned_resources_parent = v.into();
722 self
723 }
724
725 /// Sets the value of [kms_settings][crate::model::Workload::kms_settings].
726 ///
727 /// # Example
728 /// ```ignore,no_run
729 /// # use google_cloud_assuredworkloads_v1::model::Workload;
730 /// use google_cloud_assuredworkloads_v1::model::workload::KMSSettings;
731 /// let x = Workload::new().set_kms_settings(KMSSettings::default()/* use setters */);
732 /// ```
733 #[deprecated]
734 pub fn set_kms_settings<T>(mut self, v: T) -> Self
735 where
736 T: std::convert::Into<crate::model::workload::KMSSettings>,
737 {
738 self.kms_settings = std::option::Option::Some(v.into());
739 self
740 }
741
742 /// Sets or clears the value of [kms_settings][crate::model::Workload::kms_settings].
743 ///
744 /// # Example
745 /// ```ignore,no_run
746 /// # use google_cloud_assuredworkloads_v1::model::Workload;
747 /// use google_cloud_assuredworkloads_v1::model::workload::KMSSettings;
748 /// let x = Workload::new().set_or_clear_kms_settings(Some(KMSSettings::default()/* use setters */));
749 /// let x = Workload::new().set_or_clear_kms_settings(None::<KMSSettings>);
750 /// ```
751 #[deprecated]
752 pub fn set_or_clear_kms_settings<T>(mut self, v: std::option::Option<T>) -> Self
753 where
754 T: std::convert::Into<crate::model::workload::KMSSettings>,
755 {
756 self.kms_settings = v.map(|x| x.into());
757 self
758 }
759
760 /// Sets the value of [resource_settings][crate::model::Workload::resource_settings].
761 ///
762 /// # Example
763 /// ```ignore,no_run
764 /// # use google_cloud_assuredworkloads_v1::model::Workload;
765 /// use google_cloud_assuredworkloads_v1::model::workload::ResourceSettings;
766 /// let x = Workload::new()
767 /// .set_resource_settings([
768 /// ResourceSettings::default()/* use setters */,
769 /// ResourceSettings::default()/* use (different) setters */,
770 /// ]);
771 /// ```
772 pub fn set_resource_settings<T, V>(mut self, v: T) -> Self
773 where
774 T: std::iter::IntoIterator<Item = V>,
775 V: std::convert::Into<crate::model::workload::ResourceSettings>,
776 {
777 use std::iter::Iterator;
778 self.resource_settings = v.into_iter().map(|i| i.into()).collect();
779 self
780 }
781
782 /// Sets the value of [kaj_enrollment_state][crate::model::Workload::kaj_enrollment_state].
783 ///
784 /// # Example
785 /// ```ignore,no_run
786 /// # use google_cloud_assuredworkloads_v1::model::Workload;
787 /// use google_cloud_assuredworkloads_v1::model::workload::KajEnrollmentState;
788 /// let x0 = Workload::new().set_kaj_enrollment_state(KajEnrollmentState::Pending);
789 /// let x1 = Workload::new().set_kaj_enrollment_state(KajEnrollmentState::Complete);
790 /// ```
791 pub fn set_kaj_enrollment_state<
792 T: std::convert::Into<crate::model::workload::KajEnrollmentState>,
793 >(
794 mut self,
795 v: T,
796 ) -> Self {
797 self.kaj_enrollment_state = v.into();
798 self
799 }
800
801 /// Sets the value of [enable_sovereign_controls][crate::model::Workload::enable_sovereign_controls].
802 ///
803 /// # Example
804 /// ```ignore,no_run
805 /// # use google_cloud_assuredworkloads_v1::model::Workload;
806 /// let x = Workload::new().set_enable_sovereign_controls(true);
807 /// ```
808 pub fn set_enable_sovereign_controls<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
809 self.enable_sovereign_controls = v.into();
810 self
811 }
812
813 /// Sets the value of [saa_enrollment_response][crate::model::Workload::saa_enrollment_response].
814 ///
815 /// # Example
816 /// ```ignore,no_run
817 /// # use google_cloud_assuredworkloads_v1::model::Workload;
818 /// use google_cloud_assuredworkloads_v1::model::workload::SaaEnrollmentResponse;
819 /// let x = Workload::new().set_saa_enrollment_response(SaaEnrollmentResponse::default()/* use setters */);
820 /// ```
821 pub fn set_saa_enrollment_response<T>(mut self, v: T) -> Self
822 where
823 T: std::convert::Into<crate::model::workload::SaaEnrollmentResponse>,
824 {
825 self.saa_enrollment_response = std::option::Option::Some(v.into());
826 self
827 }
828
829 /// Sets or clears the value of [saa_enrollment_response][crate::model::Workload::saa_enrollment_response].
830 ///
831 /// # Example
832 /// ```ignore,no_run
833 /// # use google_cloud_assuredworkloads_v1::model::Workload;
834 /// use google_cloud_assuredworkloads_v1::model::workload::SaaEnrollmentResponse;
835 /// let x = Workload::new().set_or_clear_saa_enrollment_response(Some(SaaEnrollmentResponse::default()/* use setters */));
836 /// let x = Workload::new().set_or_clear_saa_enrollment_response(None::<SaaEnrollmentResponse>);
837 /// ```
838 pub fn set_or_clear_saa_enrollment_response<T>(mut self, v: std::option::Option<T>) -> Self
839 where
840 T: std::convert::Into<crate::model::workload::SaaEnrollmentResponse>,
841 {
842 self.saa_enrollment_response = v.map(|x| x.into());
843 self
844 }
845
846 /// Sets the value of [compliant_but_disallowed_services][crate::model::Workload::compliant_but_disallowed_services].
847 ///
848 /// # Example
849 /// ```ignore,no_run
850 /// # use google_cloud_assuredworkloads_v1::model::Workload;
851 /// let x = Workload::new().set_compliant_but_disallowed_services(["a", "b", "c"]);
852 /// ```
853 pub fn set_compliant_but_disallowed_services<T, V>(mut self, v: T) -> Self
854 where
855 T: std::iter::IntoIterator<Item = V>,
856 V: std::convert::Into<std::string::String>,
857 {
858 use std::iter::Iterator;
859 self.compliant_but_disallowed_services = v.into_iter().map(|i| i.into()).collect();
860 self
861 }
862
863 /// Sets the value of [partner][crate::model::Workload::partner].
864 ///
865 /// # Example
866 /// ```ignore,no_run
867 /// # use google_cloud_assuredworkloads_v1::model::Workload;
868 /// use google_cloud_assuredworkloads_v1::model::workload::Partner;
869 /// let x0 = Workload::new().set_partner(Partner::LocalControlsByS3Ns);
870 /// ```
871 pub fn set_partner<T: std::convert::Into<crate::model::workload::Partner>>(
872 mut self,
873 v: T,
874 ) -> Self {
875 self.partner = v.into();
876 self
877 }
878}
879
880impl wkt::message::Message for Workload {
881 fn typename() -> &'static str {
882 "type.googleapis.com/google.cloud.assuredworkloads.v1.Workload"
883 }
884}
885
886/// Defines additional types related to [Workload].
887pub mod workload {
888 #[allow(unused_imports)]
889 use super::*;
890
891 /// Represent the resources that are children of this Workload.
892 #[derive(Clone, Default, PartialEq)]
893 #[non_exhaustive]
894 pub struct ResourceInfo {
895 /// Resource identifier.
896 /// For a project this represents project_number.
897 pub resource_id: i64,
898
899 /// Indicates the type of resource.
900 pub resource_type: crate::model::workload::resource_info::ResourceType,
901
902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
903 }
904
905 impl ResourceInfo {
906 pub fn new() -> Self {
907 std::default::Default::default()
908 }
909
910 /// Sets the value of [resource_id][crate::model::workload::ResourceInfo::resource_id].
911 ///
912 /// # Example
913 /// ```ignore,no_run
914 /// # use google_cloud_assuredworkloads_v1::model::workload::ResourceInfo;
915 /// let x = ResourceInfo::new().set_resource_id(42);
916 /// ```
917 pub fn set_resource_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
918 self.resource_id = v.into();
919 self
920 }
921
922 /// Sets the value of [resource_type][crate::model::workload::ResourceInfo::resource_type].
923 ///
924 /// # Example
925 /// ```ignore,no_run
926 /// # use google_cloud_assuredworkloads_v1::model::workload::ResourceInfo;
927 /// use google_cloud_assuredworkloads_v1::model::workload::resource_info::ResourceType;
928 /// let x0 = ResourceInfo::new().set_resource_type(ResourceType::ConsumerFolder);
929 /// let x1 = ResourceInfo::new().set_resource_type(ResourceType::EncryptionKeysProject);
930 /// let x2 = ResourceInfo::new().set_resource_type(ResourceType::Keyring);
931 /// ```
932 pub fn set_resource_type<
933 T: std::convert::Into<crate::model::workload::resource_info::ResourceType>,
934 >(
935 mut self,
936 v: T,
937 ) -> Self {
938 self.resource_type = v.into();
939 self
940 }
941 }
942
943 impl wkt::message::Message for ResourceInfo {
944 fn typename() -> &'static str {
945 "type.googleapis.com/google.cloud.assuredworkloads.v1.Workload.ResourceInfo"
946 }
947 }
948
949 /// Defines additional types related to [ResourceInfo].
950 pub mod resource_info {
951 #[allow(unused_imports)]
952 use super::*;
953
954 /// The type of resource.
955 ///
956 /// # Working with unknown values
957 ///
958 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
959 /// additional enum variants at any time. Adding new variants is not considered
960 /// a breaking change. Applications should write their code in anticipation of:
961 ///
962 /// - New values appearing in future releases of the client library, **and**
963 /// - New values received dynamically, without application changes.
964 ///
965 /// Please consult the [Working with enums] section in the user guide for some
966 /// guidelines.
967 ///
968 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
969 #[derive(Clone, Debug, PartialEq)]
970 #[non_exhaustive]
971 pub enum ResourceType {
972 /// Unknown resource type.
973 Unspecified,
974 /// Consumer project.
975 /// AssuredWorkloads Projects are no longer supported. This field will be
976 /// ignored only in CreateWorkload requests. ListWorkloads and GetWorkload
977 /// will continue to provide projects information.
978 /// Use CONSUMER_FOLDER instead.
979 #[deprecated]
980 ConsumerProject,
981 /// Consumer Folder.
982 ConsumerFolder,
983 /// Consumer project containing encryption keys.
984 EncryptionKeysProject,
985 /// Keyring resource that hosts encryption keys.
986 Keyring,
987 /// If set, the enum was initialized with an unknown value.
988 ///
989 /// Applications can examine the value using [ResourceType::value] or
990 /// [ResourceType::name].
991 UnknownValue(resource_type::UnknownValue),
992 }
993
994 #[doc(hidden)]
995 pub mod resource_type {
996 #[allow(unused_imports)]
997 use super::*;
998 #[derive(Clone, Debug, PartialEq)]
999 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1000 }
1001
1002 impl ResourceType {
1003 /// Gets the enum value.
1004 ///
1005 /// Returns `None` if the enum contains an unknown value deserialized from
1006 /// the string representation of enums.
1007 pub fn value(&self) -> std::option::Option<i32> {
1008 match self {
1009 Self::Unspecified => std::option::Option::Some(0),
1010 Self::ConsumerProject => std::option::Option::Some(1),
1011 Self::ConsumerFolder => std::option::Option::Some(4),
1012 Self::EncryptionKeysProject => std::option::Option::Some(2),
1013 Self::Keyring => std::option::Option::Some(3),
1014 Self::UnknownValue(u) => u.0.value(),
1015 }
1016 }
1017
1018 /// Gets the enum value as a string.
1019 ///
1020 /// Returns `None` if the enum contains an unknown value deserialized from
1021 /// the integer representation of enums.
1022 pub fn name(&self) -> std::option::Option<&str> {
1023 match self {
1024 Self::Unspecified => std::option::Option::Some("RESOURCE_TYPE_UNSPECIFIED"),
1025 Self::ConsumerProject => std::option::Option::Some("CONSUMER_PROJECT"),
1026 Self::ConsumerFolder => std::option::Option::Some("CONSUMER_FOLDER"),
1027 Self::EncryptionKeysProject => {
1028 std::option::Option::Some("ENCRYPTION_KEYS_PROJECT")
1029 }
1030 Self::Keyring => std::option::Option::Some("KEYRING"),
1031 Self::UnknownValue(u) => u.0.name(),
1032 }
1033 }
1034 }
1035
1036 impl std::default::Default for ResourceType {
1037 fn default() -> Self {
1038 use std::convert::From;
1039 Self::from(0)
1040 }
1041 }
1042
1043 impl std::fmt::Display for ResourceType {
1044 fn fmt(
1045 &self,
1046 f: &mut std::fmt::Formatter<'_>,
1047 ) -> std::result::Result<(), std::fmt::Error> {
1048 wkt::internal::display_enum(f, self.name(), self.value())
1049 }
1050 }
1051
1052 impl std::convert::From<i32> for ResourceType {
1053 fn from(value: i32) -> Self {
1054 match value {
1055 0 => Self::Unspecified,
1056 1 => Self::ConsumerProject,
1057 2 => Self::EncryptionKeysProject,
1058 3 => Self::Keyring,
1059 4 => Self::ConsumerFolder,
1060 _ => Self::UnknownValue(resource_type::UnknownValue(
1061 wkt::internal::UnknownEnumValue::Integer(value),
1062 )),
1063 }
1064 }
1065 }
1066
1067 impl std::convert::From<&str> for ResourceType {
1068 fn from(value: &str) -> Self {
1069 use std::string::ToString;
1070 match value {
1071 "RESOURCE_TYPE_UNSPECIFIED" => Self::Unspecified,
1072 "CONSUMER_PROJECT" => Self::ConsumerProject,
1073 "CONSUMER_FOLDER" => Self::ConsumerFolder,
1074 "ENCRYPTION_KEYS_PROJECT" => Self::EncryptionKeysProject,
1075 "KEYRING" => Self::Keyring,
1076 _ => Self::UnknownValue(resource_type::UnknownValue(
1077 wkt::internal::UnknownEnumValue::String(value.to_string()),
1078 )),
1079 }
1080 }
1081 }
1082
1083 impl serde::ser::Serialize for ResourceType {
1084 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1085 where
1086 S: serde::Serializer,
1087 {
1088 match self {
1089 Self::Unspecified => serializer.serialize_i32(0),
1090 Self::ConsumerProject => serializer.serialize_i32(1),
1091 Self::ConsumerFolder => serializer.serialize_i32(4),
1092 Self::EncryptionKeysProject => serializer.serialize_i32(2),
1093 Self::Keyring => serializer.serialize_i32(3),
1094 Self::UnknownValue(u) => u.0.serialize(serializer),
1095 }
1096 }
1097 }
1098
1099 impl<'de> serde::de::Deserialize<'de> for ResourceType {
1100 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1101 where
1102 D: serde::Deserializer<'de>,
1103 {
1104 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ResourceType>::new(
1105 ".google.cloud.assuredworkloads.v1.Workload.ResourceInfo.ResourceType",
1106 ))
1107 }
1108 }
1109 }
1110
1111 /// Settings specific to the Key Management Service.
1112 /// This message is deprecated.
1113 /// In order to create a Keyring, callers should specify,
1114 /// ENCRYPTION_KEYS_PROJECT or KEYRING in ResourceSettings.resource_type field.
1115 #[derive(Clone, Default, PartialEq)]
1116 #[non_exhaustive]
1117 #[deprecated]
1118 pub struct KMSSettings {
1119 /// Required. Input only. Immutable. The time at which the Key Management Service will automatically create a
1120 /// new version of the crypto key and mark it as the primary.
1121 pub next_rotation_time: std::option::Option<wkt::Timestamp>,
1122
1123 /// Required. Input only. Immutable. [next_rotation_time] will be advanced by this period when the Key
1124 /// Management Service automatically rotates a key. Must be at least 24 hours
1125 /// and at most 876,000 hours.
1126 pub rotation_period: std::option::Option<wkt::Duration>,
1127
1128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1129 }
1130
1131 impl KMSSettings {
1132 pub fn new() -> Self {
1133 std::default::Default::default()
1134 }
1135
1136 /// Sets the value of [next_rotation_time][crate::model::workload::KMSSettings::next_rotation_time].
1137 ///
1138 /// # Example
1139 /// ```ignore,no_run
1140 /// # use google_cloud_assuredworkloads_v1::model::workload::KMSSettings;
1141 /// use wkt::Timestamp;
1142 /// let x = KMSSettings::new().set_next_rotation_time(Timestamp::default()/* use setters */);
1143 /// ```
1144 pub fn set_next_rotation_time<T>(mut self, v: T) -> Self
1145 where
1146 T: std::convert::Into<wkt::Timestamp>,
1147 {
1148 self.next_rotation_time = std::option::Option::Some(v.into());
1149 self
1150 }
1151
1152 /// Sets or clears the value of [next_rotation_time][crate::model::workload::KMSSettings::next_rotation_time].
1153 ///
1154 /// # Example
1155 /// ```ignore,no_run
1156 /// # use google_cloud_assuredworkloads_v1::model::workload::KMSSettings;
1157 /// use wkt::Timestamp;
1158 /// let x = KMSSettings::new().set_or_clear_next_rotation_time(Some(Timestamp::default()/* use setters */));
1159 /// let x = KMSSettings::new().set_or_clear_next_rotation_time(None::<Timestamp>);
1160 /// ```
1161 pub fn set_or_clear_next_rotation_time<T>(mut self, v: std::option::Option<T>) -> Self
1162 where
1163 T: std::convert::Into<wkt::Timestamp>,
1164 {
1165 self.next_rotation_time = v.map(|x| x.into());
1166 self
1167 }
1168
1169 /// Sets the value of [rotation_period][crate::model::workload::KMSSettings::rotation_period].
1170 ///
1171 /// # Example
1172 /// ```ignore,no_run
1173 /// # use google_cloud_assuredworkloads_v1::model::workload::KMSSettings;
1174 /// use wkt::Duration;
1175 /// let x = KMSSettings::new().set_rotation_period(Duration::default()/* use setters */);
1176 /// ```
1177 pub fn set_rotation_period<T>(mut self, v: T) -> Self
1178 where
1179 T: std::convert::Into<wkt::Duration>,
1180 {
1181 self.rotation_period = std::option::Option::Some(v.into());
1182 self
1183 }
1184
1185 /// Sets or clears the value of [rotation_period][crate::model::workload::KMSSettings::rotation_period].
1186 ///
1187 /// # Example
1188 /// ```ignore,no_run
1189 /// # use google_cloud_assuredworkloads_v1::model::workload::KMSSettings;
1190 /// use wkt::Duration;
1191 /// let x = KMSSettings::new().set_or_clear_rotation_period(Some(Duration::default()/* use setters */));
1192 /// let x = KMSSettings::new().set_or_clear_rotation_period(None::<Duration>);
1193 /// ```
1194 pub fn set_or_clear_rotation_period<T>(mut self, v: std::option::Option<T>) -> Self
1195 where
1196 T: std::convert::Into<wkt::Duration>,
1197 {
1198 self.rotation_period = v.map(|x| x.into());
1199 self
1200 }
1201 }
1202
1203 impl wkt::message::Message for KMSSettings {
1204 fn typename() -> &'static str {
1205 "type.googleapis.com/google.cloud.assuredworkloads.v1.Workload.KMSSettings"
1206 }
1207 }
1208
1209 /// Represent the custom settings for the resources to be created.
1210 #[derive(Clone, Default, PartialEq)]
1211 #[non_exhaustive]
1212 pub struct ResourceSettings {
1213 /// Resource identifier.
1214 /// For a project this represents project_id. If the project is already
1215 /// taken, the workload creation will fail.
1216 /// For KeyRing, this represents the keyring_id.
1217 /// For a folder, don't set this value as folder_id is assigned by Google.
1218 pub resource_id: std::string::String,
1219
1220 /// Indicates the type of resource. This field should be specified to
1221 /// correspond the id to the right resource type (CONSUMER_FOLDER or
1222 /// ENCRYPTION_KEYS_PROJECT)
1223 pub resource_type: crate::model::workload::resource_info::ResourceType,
1224
1225 /// User-assigned resource display name.
1226 /// If not empty it will be used to create a resource with the specified
1227 /// name.
1228 pub display_name: std::string::String,
1229
1230 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1231 }
1232
1233 impl ResourceSettings {
1234 pub fn new() -> Self {
1235 std::default::Default::default()
1236 }
1237
1238 /// Sets the value of [resource_id][crate::model::workload::ResourceSettings::resource_id].
1239 ///
1240 /// # Example
1241 /// ```ignore,no_run
1242 /// # use google_cloud_assuredworkloads_v1::model::workload::ResourceSettings;
1243 /// let x = ResourceSettings::new().set_resource_id("example");
1244 /// ```
1245 pub fn set_resource_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1246 self.resource_id = v.into();
1247 self
1248 }
1249
1250 /// Sets the value of [resource_type][crate::model::workload::ResourceSettings::resource_type].
1251 ///
1252 /// # Example
1253 /// ```ignore,no_run
1254 /// # use google_cloud_assuredworkloads_v1::model::workload::ResourceSettings;
1255 /// use google_cloud_assuredworkloads_v1::model::workload::resource_info::ResourceType;
1256 /// let x0 = ResourceSettings::new().set_resource_type(ResourceType::ConsumerFolder);
1257 /// let x1 = ResourceSettings::new().set_resource_type(ResourceType::EncryptionKeysProject);
1258 /// let x2 = ResourceSettings::new().set_resource_type(ResourceType::Keyring);
1259 /// ```
1260 pub fn set_resource_type<
1261 T: std::convert::Into<crate::model::workload::resource_info::ResourceType>,
1262 >(
1263 mut self,
1264 v: T,
1265 ) -> Self {
1266 self.resource_type = v.into();
1267 self
1268 }
1269
1270 /// Sets the value of [display_name][crate::model::workload::ResourceSettings::display_name].
1271 ///
1272 /// # Example
1273 /// ```ignore,no_run
1274 /// # use google_cloud_assuredworkloads_v1::model::workload::ResourceSettings;
1275 /// let x = ResourceSettings::new().set_display_name("example");
1276 /// ```
1277 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
1278 mut self,
1279 v: T,
1280 ) -> Self {
1281 self.display_name = v.into();
1282 self
1283 }
1284 }
1285
1286 impl wkt::message::Message for ResourceSettings {
1287 fn typename() -> &'static str {
1288 "type.googleapis.com/google.cloud.assuredworkloads.v1.Workload.ResourceSettings"
1289 }
1290 }
1291
1292 /// Signed Access Approvals (SAA) enrollment response.
1293 #[derive(Clone, Default, PartialEq)]
1294 #[non_exhaustive]
1295 pub struct SaaEnrollmentResponse {
1296 /// Indicates SAA enrollment status of a given workload.
1297 pub setup_status:
1298 std::option::Option<crate::model::workload::saa_enrollment_response::SetupState>,
1299
1300 /// Indicates SAA enrollment setup error if any.
1301 pub setup_errors:
1302 std::vec::Vec<crate::model::workload::saa_enrollment_response::SetupError>,
1303
1304 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1305 }
1306
1307 impl SaaEnrollmentResponse {
1308 pub fn new() -> Self {
1309 std::default::Default::default()
1310 }
1311
1312 /// Sets the value of [setup_status][crate::model::workload::SaaEnrollmentResponse::setup_status].
1313 ///
1314 /// # Example
1315 /// ```ignore,no_run
1316 /// # use google_cloud_assuredworkloads_v1::model::workload::SaaEnrollmentResponse;
1317 /// use google_cloud_assuredworkloads_v1::model::workload::saa_enrollment_response::SetupState;
1318 /// let x0 = SaaEnrollmentResponse::new().set_setup_status(SetupState::StatusPending);
1319 /// let x1 = SaaEnrollmentResponse::new().set_setup_status(SetupState::StatusComplete);
1320 /// ```
1321 pub fn set_setup_status<T>(mut self, v: T) -> Self
1322 where
1323 T: std::convert::Into<crate::model::workload::saa_enrollment_response::SetupState>,
1324 {
1325 self.setup_status = std::option::Option::Some(v.into());
1326 self
1327 }
1328
1329 /// Sets or clears the value of [setup_status][crate::model::workload::SaaEnrollmentResponse::setup_status].
1330 ///
1331 /// # Example
1332 /// ```ignore,no_run
1333 /// # use google_cloud_assuredworkloads_v1::model::workload::SaaEnrollmentResponse;
1334 /// use google_cloud_assuredworkloads_v1::model::workload::saa_enrollment_response::SetupState;
1335 /// let x0 = SaaEnrollmentResponse::new().set_or_clear_setup_status(Some(SetupState::StatusPending));
1336 /// let x1 = SaaEnrollmentResponse::new().set_or_clear_setup_status(Some(SetupState::StatusComplete));
1337 /// let x_none = SaaEnrollmentResponse::new().set_or_clear_setup_status(None::<SetupState>);
1338 /// ```
1339 pub fn set_or_clear_setup_status<T>(mut self, v: std::option::Option<T>) -> Self
1340 where
1341 T: std::convert::Into<crate::model::workload::saa_enrollment_response::SetupState>,
1342 {
1343 self.setup_status = v.map(|x| x.into());
1344 self
1345 }
1346
1347 /// Sets the value of [setup_errors][crate::model::workload::SaaEnrollmentResponse::setup_errors].
1348 ///
1349 /// # Example
1350 /// ```ignore,no_run
1351 /// # use google_cloud_assuredworkloads_v1::model::workload::SaaEnrollmentResponse;
1352 /// use google_cloud_assuredworkloads_v1::model::workload::saa_enrollment_response::SetupError;
1353 /// let x = SaaEnrollmentResponse::new().set_setup_errors([
1354 /// SetupError::ErrorInvalidBaseSetup,
1355 /// SetupError::ErrorMissingExternalSigningKey,
1356 /// SetupError::ErrorNotAllServicesEnrolled,
1357 /// ]);
1358 /// ```
1359 pub fn set_setup_errors<T, V>(mut self, v: T) -> Self
1360 where
1361 T: std::iter::IntoIterator<Item = V>,
1362 V: std::convert::Into<crate::model::workload::saa_enrollment_response::SetupError>,
1363 {
1364 use std::iter::Iterator;
1365 self.setup_errors = v.into_iter().map(|i| i.into()).collect();
1366 self
1367 }
1368 }
1369
1370 impl wkt::message::Message for SaaEnrollmentResponse {
1371 fn typename() -> &'static str {
1372 "type.googleapis.com/google.cloud.assuredworkloads.v1.Workload.SaaEnrollmentResponse"
1373 }
1374 }
1375
1376 /// Defines additional types related to [SaaEnrollmentResponse].
1377 pub mod saa_enrollment_response {
1378 #[allow(unused_imports)]
1379 use super::*;
1380
1381 /// Setup state of SAA enrollment.
1382 ///
1383 /// # Working with unknown values
1384 ///
1385 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1386 /// additional enum variants at any time. Adding new variants is not considered
1387 /// a breaking change. Applications should write their code in anticipation of:
1388 ///
1389 /// - New values appearing in future releases of the client library, **and**
1390 /// - New values received dynamically, without application changes.
1391 ///
1392 /// Please consult the [Working with enums] section in the user guide for some
1393 /// guidelines.
1394 ///
1395 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1396 #[derive(Clone, Debug, PartialEq)]
1397 #[non_exhaustive]
1398 pub enum SetupState {
1399 /// Unspecified.
1400 Unspecified,
1401 /// SAA enrollment pending.
1402 StatusPending,
1403 /// SAA enrollment comopleted.
1404 StatusComplete,
1405 /// If set, the enum was initialized with an unknown value.
1406 ///
1407 /// Applications can examine the value using [SetupState::value] or
1408 /// [SetupState::name].
1409 UnknownValue(setup_state::UnknownValue),
1410 }
1411
1412 #[doc(hidden)]
1413 pub mod setup_state {
1414 #[allow(unused_imports)]
1415 use super::*;
1416 #[derive(Clone, Debug, PartialEq)]
1417 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1418 }
1419
1420 impl SetupState {
1421 /// Gets the enum value.
1422 ///
1423 /// Returns `None` if the enum contains an unknown value deserialized from
1424 /// the string representation of enums.
1425 pub fn value(&self) -> std::option::Option<i32> {
1426 match self {
1427 Self::Unspecified => std::option::Option::Some(0),
1428 Self::StatusPending => std::option::Option::Some(1),
1429 Self::StatusComplete => std::option::Option::Some(2),
1430 Self::UnknownValue(u) => u.0.value(),
1431 }
1432 }
1433
1434 /// Gets the enum value as a string.
1435 ///
1436 /// Returns `None` if the enum contains an unknown value deserialized from
1437 /// the integer representation of enums.
1438 pub fn name(&self) -> std::option::Option<&str> {
1439 match self {
1440 Self::Unspecified => std::option::Option::Some("SETUP_STATE_UNSPECIFIED"),
1441 Self::StatusPending => std::option::Option::Some("STATUS_PENDING"),
1442 Self::StatusComplete => std::option::Option::Some("STATUS_COMPLETE"),
1443 Self::UnknownValue(u) => u.0.name(),
1444 }
1445 }
1446 }
1447
1448 impl std::default::Default for SetupState {
1449 fn default() -> Self {
1450 use std::convert::From;
1451 Self::from(0)
1452 }
1453 }
1454
1455 impl std::fmt::Display for SetupState {
1456 fn fmt(
1457 &self,
1458 f: &mut std::fmt::Formatter<'_>,
1459 ) -> std::result::Result<(), std::fmt::Error> {
1460 wkt::internal::display_enum(f, self.name(), self.value())
1461 }
1462 }
1463
1464 impl std::convert::From<i32> for SetupState {
1465 fn from(value: i32) -> Self {
1466 match value {
1467 0 => Self::Unspecified,
1468 1 => Self::StatusPending,
1469 2 => Self::StatusComplete,
1470 _ => Self::UnknownValue(setup_state::UnknownValue(
1471 wkt::internal::UnknownEnumValue::Integer(value),
1472 )),
1473 }
1474 }
1475 }
1476
1477 impl std::convert::From<&str> for SetupState {
1478 fn from(value: &str) -> Self {
1479 use std::string::ToString;
1480 match value {
1481 "SETUP_STATE_UNSPECIFIED" => Self::Unspecified,
1482 "STATUS_PENDING" => Self::StatusPending,
1483 "STATUS_COMPLETE" => Self::StatusComplete,
1484 _ => Self::UnknownValue(setup_state::UnknownValue(
1485 wkt::internal::UnknownEnumValue::String(value.to_string()),
1486 )),
1487 }
1488 }
1489 }
1490
1491 impl serde::ser::Serialize for SetupState {
1492 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1493 where
1494 S: serde::Serializer,
1495 {
1496 match self {
1497 Self::Unspecified => serializer.serialize_i32(0),
1498 Self::StatusPending => serializer.serialize_i32(1),
1499 Self::StatusComplete => serializer.serialize_i32(2),
1500 Self::UnknownValue(u) => u.0.serialize(serializer),
1501 }
1502 }
1503 }
1504
1505 impl<'de> serde::de::Deserialize<'de> for SetupState {
1506 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1507 where
1508 D: serde::Deserializer<'de>,
1509 {
1510 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SetupState>::new(
1511 ".google.cloud.assuredworkloads.v1.Workload.SaaEnrollmentResponse.SetupState",
1512 ))
1513 }
1514 }
1515
1516 /// Setup error of SAA enrollment.
1517 ///
1518 /// # Working with unknown values
1519 ///
1520 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1521 /// additional enum variants at any time. Adding new variants is not considered
1522 /// a breaking change. Applications should write their code in anticipation of:
1523 ///
1524 /// - New values appearing in future releases of the client library, **and**
1525 /// - New values received dynamically, without application changes.
1526 ///
1527 /// Please consult the [Working with enums] section in the user guide for some
1528 /// guidelines.
1529 ///
1530 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1531 #[derive(Clone, Debug, PartialEq)]
1532 #[non_exhaustive]
1533 pub enum SetupError {
1534 /// Unspecified.
1535 Unspecified,
1536 /// Invalid states for all customers, to be redirected to AA UI for
1537 /// additional details.
1538 ErrorInvalidBaseSetup,
1539 /// Returned when there is not an EKM key configured.
1540 ErrorMissingExternalSigningKey,
1541 /// Returned when there are no enrolled services or the customer is
1542 /// enrolled in CAA only for a subset of services.
1543 ErrorNotAllServicesEnrolled,
1544 /// Returned when exception was encountered during evaluation of other
1545 /// criteria.
1546 ErrorSetupCheckFailed,
1547 /// If set, the enum was initialized with an unknown value.
1548 ///
1549 /// Applications can examine the value using [SetupError::value] or
1550 /// [SetupError::name].
1551 UnknownValue(setup_error::UnknownValue),
1552 }
1553
1554 #[doc(hidden)]
1555 pub mod setup_error {
1556 #[allow(unused_imports)]
1557 use super::*;
1558 #[derive(Clone, Debug, PartialEq)]
1559 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1560 }
1561
1562 impl SetupError {
1563 /// Gets the enum value.
1564 ///
1565 /// Returns `None` if the enum contains an unknown value deserialized from
1566 /// the string representation of enums.
1567 pub fn value(&self) -> std::option::Option<i32> {
1568 match self {
1569 Self::Unspecified => std::option::Option::Some(0),
1570 Self::ErrorInvalidBaseSetup => std::option::Option::Some(1),
1571 Self::ErrorMissingExternalSigningKey => std::option::Option::Some(2),
1572 Self::ErrorNotAllServicesEnrolled => std::option::Option::Some(3),
1573 Self::ErrorSetupCheckFailed => std::option::Option::Some(4),
1574 Self::UnknownValue(u) => u.0.value(),
1575 }
1576 }
1577
1578 /// Gets the enum value as a string.
1579 ///
1580 /// Returns `None` if the enum contains an unknown value deserialized from
1581 /// the integer representation of enums.
1582 pub fn name(&self) -> std::option::Option<&str> {
1583 match self {
1584 Self::Unspecified => std::option::Option::Some("SETUP_ERROR_UNSPECIFIED"),
1585 Self::ErrorInvalidBaseSetup => {
1586 std::option::Option::Some("ERROR_INVALID_BASE_SETUP")
1587 }
1588 Self::ErrorMissingExternalSigningKey => {
1589 std::option::Option::Some("ERROR_MISSING_EXTERNAL_SIGNING_KEY")
1590 }
1591 Self::ErrorNotAllServicesEnrolled => {
1592 std::option::Option::Some("ERROR_NOT_ALL_SERVICES_ENROLLED")
1593 }
1594 Self::ErrorSetupCheckFailed => {
1595 std::option::Option::Some("ERROR_SETUP_CHECK_FAILED")
1596 }
1597 Self::UnknownValue(u) => u.0.name(),
1598 }
1599 }
1600 }
1601
1602 impl std::default::Default for SetupError {
1603 fn default() -> Self {
1604 use std::convert::From;
1605 Self::from(0)
1606 }
1607 }
1608
1609 impl std::fmt::Display for SetupError {
1610 fn fmt(
1611 &self,
1612 f: &mut std::fmt::Formatter<'_>,
1613 ) -> std::result::Result<(), std::fmt::Error> {
1614 wkt::internal::display_enum(f, self.name(), self.value())
1615 }
1616 }
1617
1618 impl std::convert::From<i32> for SetupError {
1619 fn from(value: i32) -> Self {
1620 match value {
1621 0 => Self::Unspecified,
1622 1 => Self::ErrorInvalidBaseSetup,
1623 2 => Self::ErrorMissingExternalSigningKey,
1624 3 => Self::ErrorNotAllServicesEnrolled,
1625 4 => Self::ErrorSetupCheckFailed,
1626 _ => Self::UnknownValue(setup_error::UnknownValue(
1627 wkt::internal::UnknownEnumValue::Integer(value),
1628 )),
1629 }
1630 }
1631 }
1632
1633 impl std::convert::From<&str> for SetupError {
1634 fn from(value: &str) -> Self {
1635 use std::string::ToString;
1636 match value {
1637 "SETUP_ERROR_UNSPECIFIED" => Self::Unspecified,
1638 "ERROR_INVALID_BASE_SETUP" => Self::ErrorInvalidBaseSetup,
1639 "ERROR_MISSING_EXTERNAL_SIGNING_KEY" => Self::ErrorMissingExternalSigningKey,
1640 "ERROR_NOT_ALL_SERVICES_ENROLLED" => Self::ErrorNotAllServicesEnrolled,
1641 "ERROR_SETUP_CHECK_FAILED" => Self::ErrorSetupCheckFailed,
1642 _ => Self::UnknownValue(setup_error::UnknownValue(
1643 wkt::internal::UnknownEnumValue::String(value.to_string()),
1644 )),
1645 }
1646 }
1647 }
1648
1649 impl serde::ser::Serialize for SetupError {
1650 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1651 where
1652 S: serde::Serializer,
1653 {
1654 match self {
1655 Self::Unspecified => serializer.serialize_i32(0),
1656 Self::ErrorInvalidBaseSetup => serializer.serialize_i32(1),
1657 Self::ErrorMissingExternalSigningKey => serializer.serialize_i32(2),
1658 Self::ErrorNotAllServicesEnrolled => serializer.serialize_i32(3),
1659 Self::ErrorSetupCheckFailed => serializer.serialize_i32(4),
1660 Self::UnknownValue(u) => u.0.serialize(serializer),
1661 }
1662 }
1663 }
1664
1665 impl<'de> serde::de::Deserialize<'de> for SetupError {
1666 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1667 where
1668 D: serde::Deserializer<'de>,
1669 {
1670 deserializer.deserialize_any(wkt::internal::EnumVisitor::<SetupError>::new(
1671 ".google.cloud.assuredworkloads.v1.Workload.SaaEnrollmentResponse.SetupError",
1672 ))
1673 }
1674 }
1675 }
1676
1677 /// Supported Compliance Regimes.
1678 ///
1679 /// # Working with unknown values
1680 ///
1681 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1682 /// additional enum variants at any time. Adding new variants is not considered
1683 /// a breaking change. Applications should write their code in anticipation of:
1684 ///
1685 /// - New values appearing in future releases of the client library, **and**
1686 /// - New values received dynamically, without application changes.
1687 ///
1688 /// Please consult the [Working with enums] section in the user guide for some
1689 /// guidelines.
1690 ///
1691 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1692 #[derive(Clone, Debug, PartialEq)]
1693 #[non_exhaustive]
1694 pub enum ComplianceRegime {
1695 /// Unknown compliance regime.
1696 Unspecified,
1697 /// Information protection as per DoD IL4 requirements.
1698 Il4,
1699 /// Criminal Justice Information Services (CJIS) Security policies.
1700 Cjis,
1701 /// FedRAMP High data protection controls
1702 FedrampHigh,
1703 /// FedRAMP Moderate data protection controls
1704 FedrampModerate,
1705 /// Assured Workloads For US Regions data protection controls
1706 UsRegionalAccess,
1707 /// Health Insurance Portability and Accountability Act controls
1708 Hipaa,
1709 /// Health Information Trust Alliance controls
1710 Hitrust,
1711 /// Assured Workloads For EU Regions and Support controls
1712 EuRegionsAndSupport,
1713 /// Assured Workloads For Canada Regions and Support controls
1714 CaRegionsAndSupport,
1715 /// International Traffic in Arms Regulations
1716 Itar,
1717 /// Assured Workloads for Australia Regions and Support controls
1718 /// Available for public preview consumption.
1719 /// Don't create production workloads.
1720 AuRegionsAndUsSupport,
1721 /// Assured Workloads for Partners
1722 AssuredWorkloadsForPartners,
1723 /// If set, the enum was initialized with an unknown value.
1724 ///
1725 /// Applications can examine the value using [ComplianceRegime::value] or
1726 /// [ComplianceRegime::name].
1727 UnknownValue(compliance_regime::UnknownValue),
1728 }
1729
1730 #[doc(hidden)]
1731 pub mod compliance_regime {
1732 #[allow(unused_imports)]
1733 use super::*;
1734 #[derive(Clone, Debug, PartialEq)]
1735 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1736 }
1737
1738 impl ComplianceRegime {
1739 /// Gets the enum value.
1740 ///
1741 /// Returns `None` if the enum contains an unknown value deserialized from
1742 /// the string representation of enums.
1743 pub fn value(&self) -> std::option::Option<i32> {
1744 match self {
1745 Self::Unspecified => std::option::Option::Some(0),
1746 Self::Il4 => std::option::Option::Some(1),
1747 Self::Cjis => std::option::Option::Some(2),
1748 Self::FedrampHigh => std::option::Option::Some(3),
1749 Self::FedrampModerate => std::option::Option::Some(4),
1750 Self::UsRegionalAccess => std::option::Option::Some(5),
1751 Self::Hipaa => std::option::Option::Some(6),
1752 Self::Hitrust => std::option::Option::Some(7),
1753 Self::EuRegionsAndSupport => std::option::Option::Some(8),
1754 Self::CaRegionsAndSupport => std::option::Option::Some(9),
1755 Self::Itar => std::option::Option::Some(10),
1756 Self::AuRegionsAndUsSupport => std::option::Option::Some(11),
1757 Self::AssuredWorkloadsForPartners => std::option::Option::Some(12),
1758 Self::UnknownValue(u) => u.0.value(),
1759 }
1760 }
1761
1762 /// Gets the enum value as a string.
1763 ///
1764 /// Returns `None` if the enum contains an unknown value deserialized from
1765 /// the integer representation of enums.
1766 pub fn name(&self) -> std::option::Option<&str> {
1767 match self {
1768 Self::Unspecified => std::option::Option::Some("COMPLIANCE_REGIME_UNSPECIFIED"),
1769 Self::Il4 => std::option::Option::Some("IL4"),
1770 Self::Cjis => std::option::Option::Some("CJIS"),
1771 Self::FedrampHigh => std::option::Option::Some("FEDRAMP_HIGH"),
1772 Self::FedrampModerate => std::option::Option::Some("FEDRAMP_MODERATE"),
1773 Self::UsRegionalAccess => std::option::Option::Some("US_REGIONAL_ACCESS"),
1774 Self::Hipaa => std::option::Option::Some("HIPAA"),
1775 Self::Hitrust => std::option::Option::Some("HITRUST"),
1776 Self::EuRegionsAndSupport => std::option::Option::Some("EU_REGIONS_AND_SUPPORT"),
1777 Self::CaRegionsAndSupport => std::option::Option::Some("CA_REGIONS_AND_SUPPORT"),
1778 Self::Itar => std::option::Option::Some("ITAR"),
1779 Self::AuRegionsAndUsSupport => {
1780 std::option::Option::Some("AU_REGIONS_AND_US_SUPPORT")
1781 }
1782 Self::AssuredWorkloadsForPartners => {
1783 std::option::Option::Some("ASSURED_WORKLOADS_FOR_PARTNERS")
1784 }
1785 Self::UnknownValue(u) => u.0.name(),
1786 }
1787 }
1788 }
1789
1790 impl std::default::Default for ComplianceRegime {
1791 fn default() -> Self {
1792 use std::convert::From;
1793 Self::from(0)
1794 }
1795 }
1796
1797 impl std::fmt::Display for ComplianceRegime {
1798 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1799 wkt::internal::display_enum(f, self.name(), self.value())
1800 }
1801 }
1802
1803 impl std::convert::From<i32> for ComplianceRegime {
1804 fn from(value: i32) -> Self {
1805 match value {
1806 0 => Self::Unspecified,
1807 1 => Self::Il4,
1808 2 => Self::Cjis,
1809 3 => Self::FedrampHigh,
1810 4 => Self::FedrampModerate,
1811 5 => Self::UsRegionalAccess,
1812 6 => Self::Hipaa,
1813 7 => Self::Hitrust,
1814 8 => Self::EuRegionsAndSupport,
1815 9 => Self::CaRegionsAndSupport,
1816 10 => Self::Itar,
1817 11 => Self::AuRegionsAndUsSupport,
1818 12 => Self::AssuredWorkloadsForPartners,
1819 _ => Self::UnknownValue(compliance_regime::UnknownValue(
1820 wkt::internal::UnknownEnumValue::Integer(value),
1821 )),
1822 }
1823 }
1824 }
1825
1826 impl std::convert::From<&str> for ComplianceRegime {
1827 fn from(value: &str) -> Self {
1828 use std::string::ToString;
1829 match value {
1830 "COMPLIANCE_REGIME_UNSPECIFIED" => Self::Unspecified,
1831 "IL4" => Self::Il4,
1832 "CJIS" => Self::Cjis,
1833 "FEDRAMP_HIGH" => Self::FedrampHigh,
1834 "FEDRAMP_MODERATE" => Self::FedrampModerate,
1835 "US_REGIONAL_ACCESS" => Self::UsRegionalAccess,
1836 "HIPAA" => Self::Hipaa,
1837 "HITRUST" => Self::Hitrust,
1838 "EU_REGIONS_AND_SUPPORT" => Self::EuRegionsAndSupport,
1839 "CA_REGIONS_AND_SUPPORT" => Self::CaRegionsAndSupport,
1840 "ITAR" => Self::Itar,
1841 "AU_REGIONS_AND_US_SUPPORT" => Self::AuRegionsAndUsSupport,
1842 "ASSURED_WORKLOADS_FOR_PARTNERS" => Self::AssuredWorkloadsForPartners,
1843 _ => Self::UnknownValue(compliance_regime::UnknownValue(
1844 wkt::internal::UnknownEnumValue::String(value.to_string()),
1845 )),
1846 }
1847 }
1848 }
1849
1850 impl serde::ser::Serialize for ComplianceRegime {
1851 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1852 where
1853 S: serde::Serializer,
1854 {
1855 match self {
1856 Self::Unspecified => serializer.serialize_i32(0),
1857 Self::Il4 => serializer.serialize_i32(1),
1858 Self::Cjis => serializer.serialize_i32(2),
1859 Self::FedrampHigh => serializer.serialize_i32(3),
1860 Self::FedrampModerate => serializer.serialize_i32(4),
1861 Self::UsRegionalAccess => serializer.serialize_i32(5),
1862 Self::Hipaa => serializer.serialize_i32(6),
1863 Self::Hitrust => serializer.serialize_i32(7),
1864 Self::EuRegionsAndSupport => serializer.serialize_i32(8),
1865 Self::CaRegionsAndSupport => serializer.serialize_i32(9),
1866 Self::Itar => serializer.serialize_i32(10),
1867 Self::AuRegionsAndUsSupport => serializer.serialize_i32(11),
1868 Self::AssuredWorkloadsForPartners => serializer.serialize_i32(12),
1869 Self::UnknownValue(u) => u.0.serialize(serializer),
1870 }
1871 }
1872 }
1873
1874 impl<'de> serde::de::Deserialize<'de> for ComplianceRegime {
1875 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1876 where
1877 D: serde::Deserializer<'de>,
1878 {
1879 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ComplianceRegime>::new(
1880 ".google.cloud.assuredworkloads.v1.Workload.ComplianceRegime",
1881 ))
1882 }
1883 }
1884
1885 /// Key Access Justifications(KAJ) Enrollment State.
1886 ///
1887 /// # Working with unknown values
1888 ///
1889 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1890 /// additional enum variants at any time. Adding new variants is not considered
1891 /// a breaking change. Applications should write their code in anticipation of:
1892 ///
1893 /// - New values appearing in future releases of the client library, **and**
1894 /// - New values received dynamically, without application changes.
1895 ///
1896 /// Please consult the [Working with enums] section in the user guide for some
1897 /// guidelines.
1898 ///
1899 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1900 #[derive(Clone, Debug, PartialEq)]
1901 #[non_exhaustive]
1902 pub enum KajEnrollmentState {
1903 /// Default State for KAJ Enrollment.
1904 Unspecified,
1905 /// Pending State for KAJ Enrollment.
1906 Pending,
1907 /// Complete State for KAJ Enrollment.
1908 Complete,
1909 /// If set, the enum was initialized with an unknown value.
1910 ///
1911 /// Applications can examine the value using [KajEnrollmentState::value] or
1912 /// [KajEnrollmentState::name].
1913 UnknownValue(kaj_enrollment_state::UnknownValue),
1914 }
1915
1916 #[doc(hidden)]
1917 pub mod kaj_enrollment_state {
1918 #[allow(unused_imports)]
1919 use super::*;
1920 #[derive(Clone, Debug, PartialEq)]
1921 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1922 }
1923
1924 impl KajEnrollmentState {
1925 /// Gets the enum value.
1926 ///
1927 /// Returns `None` if the enum contains an unknown value deserialized from
1928 /// the string representation of enums.
1929 pub fn value(&self) -> std::option::Option<i32> {
1930 match self {
1931 Self::Unspecified => std::option::Option::Some(0),
1932 Self::Pending => std::option::Option::Some(1),
1933 Self::Complete => std::option::Option::Some(2),
1934 Self::UnknownValue(u) => u.0.value(),
1935 }
1936 }
1937
1938 /// Gets the enum value as a string.
1939 ///
1940 /// Returns `None` if the enum contains an unknown value deserialized from
1941 /// the integer representation of enums.
1942 pub fn name(&self) -> std::option::Option<&str> {
1943 match self {
1944 Self::Unspecified => std::option::Option::Some("KAJ_ENROLLMENT_STATE_UNSPECIFIED"),
1945 Self::Pending => std::option::Option::Some("KAJ_ENROLLMENT_STATE_PENDING"),
1946 Self::Complete => std::option::Option::Some("KAJ_ENROLLMENT_STATE_COMPLETE"),
1947 Self::UnknownValue(u) => u.0.name(),
1948 }
1949 }
1950 }
1951
1952 impl std::default::Default for KajEnrollmentState {
1953 fn default() -> Self {
1954 use std::convert::From;
1955 Self::from(0)
1956 }
1957 }
1958
1959 impl std::fmt::Display for KajEnrollmentState {
1960 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1961 wkt::internal::display_enum(f, self.name(), self.value())
1962 }
1963 }
1964
1965 impl std::convert::From<i32> for KajEnrollmentState {
1966 fn from(value: i32) -> Self {
1967 match value {
1968 0 => Self::Unspecified,
1969 1 => Self::Pending,
1970 2 => Self::Complete,
1971 _ => Self::UnknownValue(kaj_enrollment_state::UnknownValue(
1972 wkt::internal::UnknownEnumValue::Integer(value),
1973 )),
1974 }
1975 }
1976 }
1977
1978 impl std::convert::From<&str> for KajEnrollmentState {
1979 fn from(value: &str) -> Self {
1980 use std::string::ToString;
1981 match value {
1982 "KAJ_ENROLLMENT_STATE_UNSPECIFIED" => Self::Unspecified,
1983 "KAJ_ENROLLMENT_STATE_PENDING" => Self::Pending,
1984 "KAJ_ENROLLMENT_STATE_COMPLETE" => Self::Complete,
1985 _ => Self::UnknownValue(kaj_enrollment_state::UnknownValue(
1986 wkt::internal::UnknownEnumValue::String(value.to_string()),
1987 )),
1988 }
1989 }
1990 }
1991
1992 impl serde::ser::Serialize for KajEnrollmentState {
1993 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1994 where
1995 S: serde::Serializer,
1996 {
1997 match self {
1998 Self::Unspecified => serializer.serialize_i32(0),
1999 Self::Pending => serializer.serialize_i32(1),
2000 Self::Complete => serializer.serialize_i32(2),
2001 Self::UnknownValue(u) => u.0.serialize(serializer),
2002 }
2003 }
2004 }
2005
2006 impl<'de> serde::de::Deserialize<'de> for KajEnrollmentState {
2007 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2008 where
2009 D: serde::Deserializer<'de>,
2010 {
2011 deserializer.deserialize_any(wkt::internal::EnumVisitor::<KajEnrollmentState>::new(
2012 ".google.cloud.assuredworkloads.v1.Workload.KajEnrollmentState",
2013 ))
2014 }
2015 }
2016
2017 /// Supported Assured Workloads Partners.
2018 ///
2019 /// # Working with unknown values
2020 ///
2021 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2022 /// additional enum variants at any time. Adding new variants is not considered
2023 /// a breaking change. Applications should write their code in anticipation of:
2024 ///
2025 /// - New values appearing in future releases of the client library, **and**
2026 /// - New values received dynamically, without application changes.
2027 ///
2028 /// Please consult the [Working with enums] section in the user guide for some
2029 /// guidelines.
2030 ///
2031 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2032 #[derive(Clone, Debug, PartialEq)]
2033 #[non_exhaustive]
2034 pub enum Partner {
2035 /// Unknown partner regime/controls.
2036 Unspecified,
2037 /// S3NS regime/controls.
2038 LocalControlsByS3Ns,
2039 /// If set, the enum was initialized with an unknown value.
2040 ///
2041 /// Applications can examine the value using [Partner::value] or
2042 /// [Partner::name].
2043 UnknownValue(partner::UnknownValue),
2044 }
2045
2046 #[doc(hidden)]
2047 pub mod partner {
2048 #[allow(unused_imports)]
2049 use super::*;
2050 #[derive(Clone, Debug, PartialEq)]
2051 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2052 }
2053
2054 impl Partner {
2055 /// Gets the enum value.
2056 ///
2057 /// Returns `None` if the enum contains an unknown value deserialized from
2058 /// the string representation of enums.
2059 pub fn value(&self) -> std::option::Option<i32> {
2060 match self {
2061 Self::Unspecified => std::option::Option::Some(0),
2062 Self::LocalControlsByS3Ns => std::option::Option::Some(1),
2063 Self::UnknownValue(u) => u.0.value(),
2064 }
2065 }
2066
2067 /// Gets the enum value as a string.
2068 ///
2069 /// Returns `None` if the enum contains an unknown value deserialized from
2070 /// the integer representation of enums.
2071 pub fn name(&self) -> std::option::Option<&str> {
2072 match self {
2073 Self::Unspecified => std::option::Option::Some("PARTNER_UNSPECIFIED"),
2074 Self::LocalControlsByS3Ns => std::option::Option::Some("LOCAL_CONTROLS_BY_S3NS"),
2075 Self::UnknownValue(u) => u.0.name(),
2076 }
2077 }
2078 }
2079
2080 impl std::default::Default for Partner {
2081 fn default() -> Self {
2082 use std::convert::From;
2083 Self::from(0)
2084 }
2085 }
2086
2087 impl std::fmt::Display for Partner {
2088 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2089 wkt::internal::display_enum(f, self.name(), self.value())
2090 }
2091 }
2092
2093 impl std::convert::From<i32> for Partner {
2094 fn from(value: i32) -> Self {
2095 match value {
2096 0 => Self::Unspecified,
2097 1 => Self::LocalControlsByS3Ns,
2098 _ => Self::UnknownValue(partner::UnknownValue(
2099 wkt::internal::UnknownEnumValue::Integer(value),
2100 )),
2101 }
2102 }
2103 }
2104
2105 impl std::convert::From<&str> for Partner {
2106 fn from(value: &str) -> Self {
2107 use std::string::ToString;
2108 match value {
2109 "PARTNER_UNSPECIFIED" => Self::Unspecified,
2110 "LOCAL_CONTROLS_BY_S3NS" => Self::LocalControlsByS3Ns,
2111 _ => Self::UnknownValue(partner::UnknownValue(
2112 wkt::internal::UnknownEnumValue::String(value.to_string()),
2113 )),
2114 }
2115 }
2116 }
2117
2118 impl serde::ser::Serialize for Partner {
2119 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2120 where
2121 S: serde::Serializer,
2122 {
2123 match self {
2124 Self::Unspecified => serializer.serialize_i32(0),
2125 Self::LocalControlsByS3Ns => serializer.serialize_i32(1),
2126 Self::UnknownValue(u) => u.0.serialize(serializer),
2127 }
2128 }
2129 }
2130
2131 impl<'de> serde::de::Deserialize<'de> for Partner {
2132 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2133 where
2134 D: serde::Deserializer<'de>,
2135 {
2136 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Partner>::new(
2137 ".google.cloud.assuredworkloads.v1.Workload.Partner",
2138 ))
2139 }
2140 }
2141}
2142
2143/// Operation metadata to give request details of CreateWorkload.
2144#[derive(Clone, Default, PartialEq)]
2145#[non_exhaustive]
2146pub struct CreateWorkloadOperationMetadata {
2147 /// Optional. Time when the operation was created.
2148 pub create_time: std::option::Option<wkt::Timestamp>,
2149
2150 /// Optional. The display name of the workload.
2151 pub display_name: std::string::String,
2152
2153 /// Optional. The parent of the workload.
2154 pub parent: std::string::String,
2155
2156 /// Optional. Compliance controls that should be applied to the resources managed by
2157 /// the workload.
2158 pub compliance_regime: crate::model::workload::ComplianceRegime,
2159
2160 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2161}
2162
2163impl CreateWorkloadOperationMetadata {
2164 pub fn new() -> Self {
2165 std::default::Default::default()
2166 }
2167
2168 /// Sets the value of [create_time][crate::model::CreateWorkloadOperationMetadata::create_time].
2169 ///
2170 /// # Example
2171 /// ```ignore,no_run
2172 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadOperationMetadata;
2173 /// use wkt::Timestamp;
2174 /// let x = CreateWorkloadOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
2175 /// ```
2176 pub fn set_create_time<T>(mut self, v: T) -> Self
2177 where
2178 T: std::convert::Into<wkt::Timestamp>,
2179 {
2180 self.create_time = std::option::Option::Some(v.into());
2181 self
2182 }
2183
2184 /// Sets or clears the value of [create_time][crate::model::CreateWorkloadOperationMetadata::create_time].
2185 ///
2186 /// # Example
2187 /// ```ignore,no_run
2188 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadOperationMetadata;
2189 /// use wkt::Timestamp;
2190 /// let x = CreateWorkloadOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2191 /// let x = CreateWorkloadOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
2192 /// ```
2193 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2194 where
2195 T: std::convert::Into<wkt::Timestamp>,
2196 {
2197 self.create_time = v.map(|x| x.into());
2198 self
2199 }
2200
2201 /// Sets the value of [display_name][crate::model::CreateWorkloadOperationMetadata::display_name].
2202 ///
2203 /// # Example
2204 /// ```ignore,no_run
2205 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadOperationMetadata;
2206 /// let x = CreateWorkloadOperationMetadata::new().set_display_name("example");
2207 /// ```
2208 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2209 self.display_name = v.into();
2210 self
2211 }
2212
2213 /// Sets the value of [parent][crate::model::CreateWorkloadOperationMetadata::parent].
2214 ///
2215 /// # Example
2216 /// ```ignore,no_run
2217 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadOperationMetadata;
2218 /// let x = CreateWorkloadOperationMetadata::new().set_parent("example");
2219 /// ```
2220 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2221 self.parent = v.into();
2222 self
2223 }
2224
2225 /// Sets the value of [compliance_regime][crate::model::CreateWorkloadOperationMetadata::compliance_regime].
2226 ///
2227 /// # Example
2228 /// ```ignore,no_run
2229 /// # use google_cloud_assuredworkloads_v1::model::CreateWorkloadOperationMetadata;
2230 /// use google_cloud_assuredworkloads_v1::model::workload::ComplianceRegime;
2231 /// let x0 = CreateWorkloadOperationMetadata::new().set_compliance_regime(ComplianceRegime::Il4);
2232 /// let x1 = CreateWorkloadOperationMetadata::new().set_compliance_regime(ComplianceRegime::Cjis);
2233 /// let x2 = CreateWorkloadOperationMetadata::new().set_compliance_regime(ComplianceRegime::FedrampHigh);
2234 /// ```
2235 pub fn set_compliance_regime<
2236 T: std::convert::Into<crate::model::workload::ComplianceRegime>,
2237 >(
2238 mut self,
2239 v: T,
2240 ) -> Self {
2241 self.compliance_regime = v.into();
2242 self
2243 }
2244}
2245
2246impl wkt::message::Message for CreateWorkloadOperationMetadata {
2247 fn typename() -> &'static str {
2248 "type.googleapis.com/google.cloud.assuredworkloads.v1.CreateWorkloadOperationMetadata"
2249 }
2250}
2251
2252/// Request for restricting list of available resources in Workload environment.
2253#[derive(Clone, Default, PartialEq)]
2254#[non_exhaustive]
2255pub struct RestrictAllowedResourcesRequest {
2256 /// Required. The resource name of the Workload. This is the workloads's
2257 /// relative path in the API, formatted as
2258 /// "organizations/{organization_id}/locations/{location_id}/workloads/{workload_id}".
2259 /// For example,
2260 /// "organizations/123/locations/us-east1/workloads/assured-workload-1".
2261 pub name: std::string::String,
2262
2263 /// Required. The type of restriction for using gcp products in the Workload environment.
2264 pub restriction_type: crate::model::restrict_allowed_resources_request::RestrictionType,
2265
2266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2267}
2268
2269impl RestrictAllowedResourcesRequest {
2270 pub fn new() -> Self {
2271 std::default::Default::default()
2272 }
2273
2274 /// Sets the value of [name][crate::model::RestrictAllowedResourcesRequest::name].
2275 ///
2276 /// # Example
2277 /// ```ignore,no_run
2278 /// # use google_cloud_assuredworkloads_v1::model::RestrictAllowedResourcesRequest;
2279 /// let x = RestrictAllowedResourcesRequest::new().set_name("example");
2280 /// ```
2281 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2282 self.name = v.into();
2283 self
2284 }
2285
2286 /// Sets the value of [restriction_type][crate::model::RestrictAllowedResourcesRequest::restriction_type].
2287 ///
2288 /// # Example
2289 /// ```ignore,no_run
2290 /// # use google_cloud_assuredworkloads_v1::model::RestrictAllowedResourcesRequest;
2291 /// use google_cloud_assuredworkloads_v1::model::restrict_allowed_resources_request::RestrictionType;
2292 /// let x0 = RestrictAllowedResourcesRequest::new().set_restriction_type(RestrictionType::AllowAllGcpResources);
2293 /// let x1 = RestrictAllowedResourcesRequest::new().set_restriction_type(RestrictionType::AllowCompliantResources);
2294 /// ```
2295 pub fn set_restriction_type<
2296 T: std::convert::Into<crate::model::restrict_allowed_resources_request::RestrictionType>,
2297 >(
2298 mut self,
2299 v: T,
2300 ) -> Self {
2301 self.restriction_type = v.into();
2302 self
2303 }
2304}
2305
2306impl wkt::message::Message for RestrictAllowedResourcesRequest {
2307 fn typename() -> &'static str {
2308 "type.googleapis.com/google.cloud.assuredworkloads.v1.RestrictAllowedResourcesRequest"
2309 }
2310}
2311
2312/// Defines additional types related to [RestrictAllowedResourcesRequest].
2313pub mod restrict_allowed_resources_request {
2314 #[allow(unused_imports)]
2315 use super::*;
2316
2317 /// The type of restriction.
2318 ///
2319 /// # Working with unknown values
2320 ///
2321 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2322 /// additional enum variants at any time. Adding new variants is not considered
2323 /// a breaking change. Applications should write their code in anticipation of:
2324 ///
2325 /// - New values appearing in future releases of the client library, **and**
2326 /// - New values received dynamically, without application changes.
2327 ///
2328 /// Please consult the [Working with enums] section in the user guide for some
2329 /// guidelines.
2330 ///
2331 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2332 #[derive(Clone, Debug, PartialEq)]
2333 #[non_exhaustive]
2334 pub enum RestrictionType {
2335 /// Unknown restriction type.
2336 Unspecified,
2337 /// Allow the use all of all gcp products, irrespective of the compliance
2338 /// posture. This effectively removes gcp.restrictServiceUsage OrgPolicy
2339 /// on the AssuredWorkloads Folder.
2340 AllowAllGcpResources,
2341 /// Based on Workload's compliance regime, allowed list changes.
2342 /// See - <https://cloud.google.com/assured-workloads/docs/supported-products>
2343 /// for the list of supported resources.
2344 AllowCompliantResources,
2345 /// If set, the enum was initialized with an unknown value.
2346 ///
2347 /// Applications can examine the value using [RestrictionType::value] or
2348 /// [RestrictionType::name].
2349 UnknownValue(restriction_type::UnknownValue),
2350 }
2351
2352 #[doc(hidden)]
2353 pub mod restriction_type {
2354 #[allow(unused_imports)]
2355 use super::*;
2356 #[derive(Clone, Debug, PartialEq)]
2357 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2358 }
2359
2360 impl RestrictionType {
2361 /// Gets the enum value.
2362 ///
2363 /// Returns `None` if the enum contains an unknown value deserialized from
2364 /// the string representation of enums.
2365 pub fn value(&self) -> std::option::Option<i32> {
2366 match self {
2367 Self::Unspecified => std::option::Option::Some(0),
2368 Self::AllowAllGcpResources => std::option::Option::Some(1),
2369 Self::AllowCompliantResources => std::option::Option::Some(2),
2370 Self::UnknownValue(u) => u.0.value(),
2371 }
2372 }
2373
2374 /// Gets the enum value as a string.
2375 ///
2376 /// Returns `None` if the enum contains an unknown value deserialized from
2377 /// the integer representation of enums.
2378 pub fn name(&self) -> std::option::Option<&str> {
2379 match self {
2380 Self::Unspecified => std::option::Option::Some("RESTRICTION_TYPE_UNSPECIFIED"),
2381 Self::AllowAllGcpResources => std::option::Option::Some("ALLOW_ALL_GCP_RESOURCES"),
2382 Self::AllowCompliantResources => {
2383 std::option::Option::Some("ALLOW_COMPLIANT_RESOURCES")
2384 }
2385 Self::UnknownValue(u) => u.0.name(),
2386 }
2387 }
2388 }
2389
2390 impl std::default::Default for RestrictionType {
2391 fn default() -> Self {
2392 use std::convert::From;
2393 Self::from(0)
2394 }
2395 }
2396
2397 impl std::fmt::Display for RestrictionType {
2398 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2399 wkt::internal::display_enum(f, self.name(), self.value())
2400 }
2401 }
2402
2403 impl std::convert::From<i32> for RestrictionType {
2404 fn from(value: i32) -> Self {
2405 match value {
2406 0 => Self::Unspecified,
2407 1 => Self::AllowAllGcpResources,
2408 2 => Self::AllowCompliantResources,
2409 _ => Self::UnknownValue(restriction_type::UnknownValue(
2410 wkt::internal::UnknownEnumValue::Integer(value),
2411 )),
2412 }
2413 }
2414 }
2415
2416 impl std::convert::From<&str> for RestrictionType {
2417 fn from(value: &str) -> Self {
2418 use std::string::ToString;
2419 match value {
2420 "RESTRICTION_TYPE_UNSPECIFIED" => Self::Unspecified,
2421 "ALLOW_ALL_GCP_RESOURCES" => Self::AllowAllGcpResources,
2422 "ALLOW_COMPLIANT_RESOURCES" => Self::AllowCompliantResources,
2423 _ => Self::UnknownValue(restriction_type::UnknownValue(
2424 wkt::internal::UnknownEnumValue::String(value.to_string()),
2425 )),
2426 }
2427 }
2428 }
2429
2430 impl serde::ser::Serialize for RestrictionType {
2431 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2432 where
2433 S: serde::Serializer,
2434 {
2435 match self {
2436 Self::Unspecified => serializer.serialize_i32(0),
2437 Self::AllowAllGcpResources => serializer.serialize_i32(1),
2438 Self::AllowCompliantResources => serializer.serialize_i32(2),
2439 Self::UnknownValue(u) => u.0.serialize(serializer),
2440 }
2441 }
2442 }
2443
2444 impl<'de> serde::de::Deserialize<'de> for RestrictionType {
2445 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2446 where
2447 D: serde::Deserializer<'de>,
2448 {
2449 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RestrictionType>::new(
2450 ".google.cloud.assuredworkloads.v1.RestrictAllowedResourcesRequest.RestrictionType",
2451 ))
2452 }
2453 }
2454}
2455
2456/// Response for restricting the list of allowed resources.
2457#[derive(Clone, Default, PartialEq)]
2458#[non_exhaustive]
2459pub struct RestrictAllowedResourcesResponse {
2460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2461}
2462
2463impl RestrictAllowedResourcesResponse {
2464 pub fn new() -> Self {
2465 std::default::Default::default()
2466 }
2467}
2468
2469impl wkt::message::Message for RestrictAllowedResourcesResponse {
2470 fn typename() -> &'static str {
2471 "type.googleapis.com/google.cloud.assuredworkloads.v1.RestrictAllowedResourcesResponse"
2472 }
2473}
2474
2475/// Request for acknowledging the violation
2476/// Next Id: 4
2477#[derive(Clone, Default, PartialEq)]
2478#[non_exhaustive]
2479pub struct AcknowledgeViolationRequest {
2480 /// Required. The resource name of the Violation to acknowledge.
2481 /// Format:
2482 /// organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}
2483 pub name: std::string::String,
2484
2485 /// Required. Business justification explaining the need for violation acknowledgement
2486 pub comment: std::string::String,
2487
2488 /// Optional. This field is deprecated and will be removed in future version of the API.
2489 /// Name of the OrgPolicy which was modified with non-compliant change and
2490 /// resulted in this violation.
2491 /// Format:
2492 /// projects/{project_number}/policies/{constraint_name}
2493 /// folders/{folder_id}/policies/{constraint_name}
2494 /// organizations/{organization_id}/policies/{constraint_name}
2495 #[deprecated]
2496 pub non_compliant_org_policy: std::string::String,
2497
2498 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2499}
2500
2501impl AcknowledgeViolationRequest {
2502 pub fn new() -> Self {
2503 std::default::Default::default()
2504 }
2505
2506 /// Sets the value of [name][crate::model::AcknowledgeViolationRequest::name].
2507 ///
2508 /// # Example
2509 /// ```ignore,no_run
2510 /// # use google_cloud_assuredworkloads_v1::model::AcknowledgeViolationRequest;
2511 /// let x = AcknowledgeViolationRequest::new().set_name("example");
2512 /// ```
2513 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2514 self.name = v.into();
2515 self
2516 }
2517
2518 /// Sets the value of [comment][crate::model::AcknowledgeViolationRequest::comment].
2519 ///
2520 /// # Example
2521 /// ```ignore,no_run
2522 /// # use google_cloud_assuredworkloads_v1::model::AcknowledgeViolationRequest;
2523 /// let x = AcknowledgeViolationRequest::new().set_comment("example");
2524 /// ```
2525 pub fn set_comment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2526 self.comment = v.into();
2527 self
2528 }
2529
2530 /// Sets the value of [non_compliant_org_policy][crate::model::AcknowledgeViolationRequest::non_compliant_org_policy].
2531 ///
2532 /// # Example
2533 /// ```ignore,no_run
2534 /// # use google_cloud_assuredworkloads_v1::model::AcknowledgeViolationRequest;
2535 /// let x = AcknowledgeViolationRequest::new().set_non_compliant_org_policy("example");
2536 /// ```
2537 #[deprecated]
2538 pub fn set_non_compliant_org_policy<T: std::convert::Into<std::string::String>>(
2539 mut self,
2540 v: T,
2541 ) -> Self {
2542 self.non_compliant_org_policy = v.into();
2543 self
2544 }
2545}
2546
2547impl wkt::message::Message for AcknowledgeViolationRequest {
2548 fn typename() -> &'static str {
2549 "type.googleapis.com/google.cloud.assuredworkloads.v1.AcknowledgeViolationRequest"
2550 }
2551}
2552
2553/// Response for violation acknowledgement
2554#[derive(Clone, Default, PartialEq)]
2555#[non_exhaustive]
2556pub struct AcknowledgeViolationResponse {
2557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2558}
2559
2560impl AcknowledgeViolationResponse {
2561 pub fn new() -> Self {
2562 std::default::Default::default()
2563 }
2564}
2565
2566impl wkt::message::Message for AcknowledgeViolationResponse {
2567 fn typename() -> &'static str {
2568 "type.googleapis.com/google.cloud.assuredworkloads.v1.AcknowledgeViolationResponse"
2569 }
2570}
2571
2572/// Interval defining a time window.
2573#[derive(Clone, Default, PartialEq)]
2574#[non_exhaustive]
2575pub struct TimeWindow {
2576 /// The start of the time window.
2577 pub start_time: std::option::Option<wkt::Timestamp>,
2578
2579 /// The end of the time window.
2580 pub end_time: std::option::Option<wkt::Timestamp>,
2581
2582 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2583}
2584
2585impl TimeWindow {
2586 pub fn new() -> Self {
2587 std::default::Default::default()
2588 }
2589
2590 /// Sets the value of [start_time][crate::model::TimeWindow::start_time].
2591 ///
2592 /// # Example
2593 /// ```ignore,no_run
2594 /// # use google_cloud_assuredworkloads_v1::model::TimeWindow;
2595 /// use wkt::Timestamp;
2596 /// let x = TimeWindow::new().set_start_time(Timestamp::default()/* use setters */);
2597 /// ```
2598 pub fn set_start_time<T>(mut self, v: T) -> Self
2599 where
2600 T: std::convert::Into<wkt::Timestamp>,
2601 {
2602 self.start_time = std::option::Option::Some(v.into());
2603 self
2604 }
2605
2606 /// Sets or clears the value of [start_time][crate::model::TimeWindow::start_time].
2607 ///
2608 /// # Example
2609 /// ```ignore,no_run
2610 /// # use google_cloud_assuredworkloads_v1::model::TimeWindow;
2611 /// use wkt::Timestamp;
2612 /// let x = TimeWindow::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
2613 /// let x = TimeWindow::new().set_or_clear_start_time(None::<Timestamp>);
2614 /// ```
2615 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
2616 where
2617 T: std::convert::Into<wkt::Timestamp>,
2618 {
2619 self.start_time = v.map(|x| x.into());
2620 self
2621 }
2622
2623 /// Sets the value of [end_time][crate::model::TimeWindow::end_time].
2624 ///
2625 /// # Example
2626 /// ```ignore,no_run
2627 /// # use google_cloud_assuredworkloads_v1::model::TimeWindow;
2628 /// use wkt::Timestamp;
2629 /// let x = TimeWindow::new().set_end_time(Timestamp::default()/* use setters */);
2630 /// ```
2631 pub fn set_end_time<T>(mut self, v: T) -> Self
2632 where
2633 T: std::convert::Into<wkt::Timestamp>,
2634 {
2635 self.end_time = std::option::Option::Some(v.into());
2636 self
2637 }
2638
2639 /// Sets or clears the value of [end_time][crate::model::TimeWindow::end_time].
2640 ///
2641 /// # Example
2642 /// ```ignore,no_run
2643 /// # use google_cloud_assuredworkloads_v1::model::TimeWindow;
2644 /// use wkt::Timestamp;
2645 /// let x = TimeWindow::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
2646 /// let x = TimeWindow::new().set_or_clear_end_time(None::<Timestamp>);
2647 /// ```
2648 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
2649 where
2650 T: std::convert::Into<wkt::Timestamp>,
2651 {
2652 self.end_time = v.map(|x| x.into());
2653 self
2654 }
2655}
2656
2657impl wkt::message::Message for TimeWindow {
2658 fn typename() -> &'static str {
2659 "type.googleapis.com/google.cloud.assuredworkloads.v1.TimeWindow"
2660 }
2661}
2662
2663/// Request for fetching violations in an organization.
2664#[derive(Clone, Default, PartialEq)]
2665#[non_exhaustive]
2666pub struct ListViolationsRequest {
2667 /// Required. The Workload name.
2668 /// Format `organizations/{org_id}/locations/{location}/workloads/{workload}`.
2669 pub parent: std::string::String,
2670
2671 /// Optional. Specifies the time window for retrieving active Violations.
2672 /// When specified, retrieves Violations that were active between start_time
2673 /// and end_time.
2674 pub interval: std::option::Option<crate::model::TimeWindow>,
2675
2676 /// Optional. Page size.
2677 pub page_size: i32,
2678
2679 /// Optional. Page token returned from previous request.
2680 pub page_token: std::string::String,
2681
2682 /// Optional. A custom filter for filtering by the Violations properties.
2683 pub filter: std::string::String,
2684
2685 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2686}
2687
2688impl ListViolationsRequest {
2689 pub fn new() -> Self {
2690 std::default::Default::default()
2691 }
2692
2693 /// Sets the value of [parent][crate::model::ListViolationsRequest::parent].
2694 ///
2695 /// # Example
2696 /// ```ignore,no_run
2697 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsRequest;
2698 /// let x = ListViolationsRequest::new().set_parent("example");
2699 /// ```
2700 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2701 self.parent = v.into();
2702 self
2703 }
2704
2705 /// Sets the value of [interval][crate::model::ListViolationsRequest::interval].
2706 ///
2707 /// # Example
2708 /// ```ignore,no_run
2709 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsRequest;
2710 /// use google_cloud_assuredworkloads_v1::model::TimeWindow;
2711 /// let x = ListViolationsRequest::new().set_interval(TimeWindow::default()/* use setters */);
2712 /// ```
2713 pub fn set_interval<T>(mut self, v: T) -> Self
2714 where
2715 T: std::convert::Into<crate::model::TimeWindow>,
2716 {
2717 self.interval = std::option::Option::Some(v.into());
2718 self
2719 }
2720
2721 /// Sets or clears the value of [interval][crate::model::ListViolationsRequest::interval].
2722 ///
2723 /// # Example
2724 /// ```ignore,no_run
2725 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsRequest;
2726 /// use google_cloud_assuredworkloads_v1::model::TimeWindow;
2727 /// let x = ListViolationsRequest::new().set_or_clear_interval(Some(TimeWindow::default()/* use setters */));
2728 /// let x = ListViolationsRequest::new().set_or_clear_interval(None::<TimeWindow>);
2729 /// ```
2730 pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
2731 where
2732 T: std::convert::Into<crate::model::TimeWindow>,
2733 {
2734 self.interval = v.map(|x| x.into());
2735 self
2736 }
2737
2738 /// Sets the value of [page_size][crate::model::ListViolationsRequest::page_size].
2739 ///
2740 /// # Example
2741 /// ```ignore,no_run
2742 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsRequest;
2743 /// let x = ListViolationsRequest::new().set_page_size(42);
2744 /// ```
2745 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2746 self.page_size = v.into();
2747 self
2748 }
2749
2750 /// Sets the value of [page_token][crate::model::ListViolationsRequest::page_token].
2751 ///
2752 /// # Example
2753 /// ```ignore,no_run
2754 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsRequest;
2755 /// let x = ListViolationsRequest::new().set_page_token("example");
2756 /// ```
2757 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2758 self.page_token = v.into();
2759 self
2760 }
2761
2762 /// Sets the value of [filter][crate::model::ListViolationsRequest::filter].
2763 ///
2764 /// # Example
2765 /// ```ignore,no_run
2766 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsRequest;
2767 /// let x = ListViolationsRequest::new().set_filter("example");
2768 /// ```
2769 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2770 self.filter = v.into();
2771 self
2772 }
2773}
2774
2775impl wkt::message::Message for ListViolationsRequest {
2776 fn typename() -> &'static str {
2777 "type.googleapis.com/google.cloud.assuredworkloads.v1.ListViolationsRequest"
2778 }
2779}
2780
2781/// Response of ListViolations endpoint.
2782#[derive(Clone, Default, PartialEq)]
2783#[non_exhaustive]
2784pub struct ListViolationsResponse {
2785 /// List of Violations under a Workload.
2786 pub violations: std::vec::Vec<crate::model::Violation>,
2787
2788 /// The next page token. Returns empty if reached the last page.
2789 pub next_page_token: std::string::String,
2790
2791 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2792}
2793
2794impl ListViolationsResponse {
2795 pub fn new() -> Self {
2796 std::default::Default::default()
2797 }
2798
2799 /// Sets the value of [violations][crate::model::ListViolationsResponse::violations].
2800 ///
2801 /// # Example
2802 /// ```ignore,no_run
2803 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsResponse;
2804 /// use google_cloud_assuredworkloads_v1::model::Violation;
2805 /// let x = ListViolationsResponse::new()
2806 /// .set_violations([
2807 /// Violation::default()/* use setters */,
2808 /// Violation::default()/* use (different) setters */,
2809 /// ]);
2810 /// ```
2811 pub fn set_violations<T, V>(mut self, v: T) -> Self
2812 where
2813 T: std::iter::IntoIterator<Item = V>,
2814 V: std::convert::Into<crate::model::Violation>,
2815 {
2816 use std::iter::Iterator;
2817 self.violations = v.into_iter().map(|i| i.into()).collect();
2818 self
2819 }
2820
2821 /// Sets the value of [next_page_token][crate::model::ListViolationsResponse::next_page_token].
2822 ///
2823 /// # Example
2824 /// ```ignore,no_run
2825 /// # use google_cloud_assuredworkloads_v1::model::ListViolationsResponse;
2826 /// let x = ListViolationsResponse::new().set_next_page_token("example");
2827 /// ```
2828 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2829 self.next_page_token = v.into();
2830 self
2831 }
2832}
2833
2834impl wkt::message::Message for ListViolationsResponse {
2835 fn typename() -> &'static str {
2836 "type.googleapis.com/google.cloud.assuredworkloads.v1.ListViolationsResponse"
2837 }
2838}
2839
2840#[doc(hidden)]
2841impl google_cloud_gax::paginator::internal::PageableResponse for ListViolationsResponse {
2842 type PageItem = crate::model::Violation;
2843
2844 fn items(self) -> std::vec::Vec<Self::PageItem> {
2845 self.violations
2846 }
2847
2848 fn next_page_token(&self) -> std::string::String {
2849 use std::clone::Clone;
2850 self.next_page_token.clone()
2851 }
2852}
2853
2854/// Request for fetching a Workload Violation.
2855#[derive(Clone, Default, PartialEq)]
2856#[non_exhaustive]
2857pub struct GetViolationRequest {
2858 /// Required. The resource name of the Violation to fetch (ie. Violation.name).
2859 /// Format:
2860 /// organizations/{organization}/locations/{location}/workloads/{workload}/violations/{violation}
2861 pub name: std::string::String,
2862
2863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2864}
2865
2866impl GetViolationRequest {
2867 pub fn new() -> Self {
2868 std::default::Default::default()
2869 }
2870
2871 /// Sets the value of [name][crate::model::GetViolationRequest::name].
2872 ///
2873 /// # Example
2874 /// ```ignore,no_run
2875 /// # use google_cloud_assuredworkloads_v1::model::GetViolationRequest;
2876 /// let x = GetViolationRequest::new().set_name("example");
2877 /// ```
2878 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2879 self.name = v.into();
2880 self
2881 }
2882}
2883
2884impl wkt::message::Message for GetViolationRequest {
2885 fn typename() -> &'static str {
2886 "type.googleapis.com/google.cloud.assuredworkloads.v1.GetViolationRequest"
2887 }
2888}
2889
2890/// Workload monitoring Violation.
2891#[derive(Clone, Default, PartialEq)]
2892#[non_exhaustive]
2893pub struct Violation {
2894 /// Output only. Immutable. Name of the Violation.
2895 /// Format:
2896 /// organizations/{organization}/locations/{location}/workloads/{workload_id}/violations/{violations_id}
2897 pub name: std::string::String,
2898
2899 /// Output only. Description for the Violation.
2900 /// e.g. OrgPolicy gcp.resourceLocations has non compliant value.
2901 pub description: std::string::String,
2902
2903 /// Output only. Time of the event which triggered the Violation.
2904 pub begin_time: std::option::Option<wkt::Timestamp>,
2905
2906 /// Output only. The last time when the Violation record was updated.
2907 pub update_time: std::option::Option<wkt::Timestamp>,
2908
2909 /// Output only. Time of the event which fixed the Violation.
2910 /// If the violation is ACTIVE this will be empty.
2911 pub resolve_time: std::option::Option<wkt::Timestamp>,
2912
2913 /// Output only. Category under which this violation is mapped.
2914 /// e.g. Location, Service Usage, Access, Encryption, etc.
2915 pub category: std::string::String,
2916
2917 /// Output only. State of the violation
2918 pub state: crate::model::violation::State,
2919
2920 /// Output only. Immutable. The org-policy-constraint that was incorrectly changed, which resulted in
2921 /// this violation.
2922 pub org_policy_constraint: std::string::String,
2923
2924 /// Output only. Immutable. Audit Log Link for violated resource
2925 /// Format:
2926 /// <https://console.cloud.google.com/logs/query>;query={logName}{protoPayload.resourceName}{timeRange}{folder}
2927 pub audit_log_link: std::string::String,
2928
2929 /// Output only. Immutable. Name of the OrgPolicy which was modified with non-compliant change and
2930 /// resulted this violation.
2931 /// Format:
2932 /// projects/{project_number}/policies/{constraint_name}
2933 /// folders/{folder_id}/policies/{constraint_name}
2934 /// organizations/{organization_id}/policies/{constraint_name}
2935 pub non_compliant_org_policy: std::string::String,
2936
2937 /// Output only. Compliance violation remediation
2938 pub remediation: std::option::Option<crate::model::violation::Remediation>,
2939
2940 /// Output only. A boolean that indicates if the violation is acknowledged
2941 pub acknowledged: bool,
2942
2943 /// Optional. Timestamp when this violation was acknowledged last.
2944 /// This will be absent when acknowledged field is marked as false.
2945 pub acknowledgement_time: std::option::Option<wkt::Timestamp>,
2946
2947 /// Output only. Immutable. Audit Log link to find business justification provided for violation
2948 /// exception. Format:
2949 /// <https://console.cloud.google.com/logs/query>;query={logName}{protoPayload.resourceName}{protoPayload.methodName}{timeRange}{organization}
2950 pub exception_audit_log_link: std::string::String,
2951
2952 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2953}
2954
2955impl Violation {
2956 pub fn new() -> Self {
2957 std::default::Default::default()
2958 }
2959
2960 /// Sets the value of [name][crate::model::Violation::name].
2961 ///
2962 /// # Example
2963 /// ```ignore,no_run
2964 /// # use google_cloud_assuredworkloads_v1::model::Violation;
2965 /// let x = Violation::new().set_name("example");
2966 /// ```
2967 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2968 self.name = v.into();
2969 self
2970 }
2971
2972 /// Sets the value of [description][crate::model::Violation::description].
2973 ///
2974 /// # Example
2975 /// ```ignore,no_run
2976 /// # use google_cloud_assuredworkloads_v1::model::Violation;
2977 /// let x = Violation::new().set_description("example");
2978 /// ```
2979 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2980 self.description = v.into();
2981 self
2982 }
2983
2984 /// Sets the value of [begin_time][crate::model::Violation::begin_time].
2985 ///
2986 /// # Example
2987 /// ```ignore,no_run
2988 /// # use google_cloud_assuredworkloads_v1::model::Violation;
2989 /// use wkt::Timestamp;
2990 /// let x = Violation::new().set_begin_time(Timestamp::default()/* use setters */);
2991 /// ```
2992 pub fn set_begin_time<T>(mut self, v: T) -> Self
2993 where
2994 T: std::convert::Into<wkt::Timestamp>,
2995 {
2996 self.begin_time = std::option::Option::Some(v.into());
2997 self
2998 }
2999
3000 /// Sets or clears the value of [begin_time][crate::model::Violation::begin_time].
3001 ///
3002 /// # Example
3003 /// ```ignore,no_run
3004 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3005 /// use wkt::Timestamp;
3006 /// let x = Violation::new().set_or_clear_begin_time(Some(Timestamp::default()/* use setters */));
3007 /// let x = Violation::new().set_or_clear_begin_time(None::<Timestamp>);
3008 /// ```
3009 pub fn set_or_clear_begin_time<T>(mut self, v: std::option::Option<T>) -> Self
3010 where
3011 T: std::convert::Into<wkt::Timestamp>,
3012 {
3013 self.begin_time = v.map(|x| x.into());
3014 self
3015 }
3016
3017 /// Sets the value of [update_time][crate::model::Violation::update_time].
3018 ///
3019 /// # Example
3020 /// ```ignore,no_run
3021 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3022 /// use wkt::Timestamp;
3023 /// let x = Violation::new().set_update_time(Timestamp::default()/* use setters */);
3024 /// ```
3025 pub fn set_update_time<T>(mut self, v: T) -> Self
3026 where
3027 T: std::convert::Into<wkt::Timestamp>,
3028 {
3029 self.update_time = std::option::Option::Some(v.into());
3030 self
3031 }
3032
3033 /// Sets or clears the value of [update_time][crate::model::Violation::update_time].
3034 ///
3035 /// # Example
3036 /// ```ignore,no_run
3037 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3038 /// use wkt::Timestamp;
3039 /// let x = Violation::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3040 /// let x = Violation::new().set_or_clear_update_time(None::<Timestamp>);
3041 /// ```
3042 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3043 where
3044 T: std::convert::Into<wkt::Timestamp>,
3045 {
3046 self.update_time = v.map(|x| x.into());
3047 self
3048 }
3049
3050 /// Sets the value of [resolve_time][crate::model::Violation::resolve_time].
3051 ///
3052 /// # Example
3053 /// ```ignore,no_run
3054 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3055 /// use wkt::Timestamp;
3056 /// let x = Violation::new().set_resolve_time(Timestamp::default()/* use setters */);
3057 /// ```
3058 pub fn set_resolve_time<T>(mut self, v: T) -> Self
3059 where
3060 T: std::convert::Into<wkt::Timestamp>,
3061 {
3062 self.resolve_time = std::option::Option::Some(v.into());
3063 self
3064 }
3065
3066 /// Sets or clears the value of [resolve_time][crate::model::Violation::resolve_time].
3067 ///
3068 /// # Example
3069 /// ```ignore,no_run
3070 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3071 /// use wkt::Timestamp;
3072 /// let x = Violation::new().set_or_clear_resolve_time(Some(Timestamp::default()/* use setters */));
3073 /// let x = Violation::new().set_or_clear_resolve_time(None::<Timestamp>);
3074 /// ```
3075 pub fn set_or_clear_resolve_time<T>(mut self, v: std::option::Option<T>) -> Self
3076 where
3077 T: std::convert::Into<wkt::Timestamp>,
3078 {
3079 self.resolve_time = v.map(|x| x.into());
3080 self
3081 }
3082
3083 /// Sets the value of [category][crate::model::Violation::category].
3084 ///
3085 /// # Example
3086 /// ```ignore,no_run
3087 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3088 /// let x = Violation::new().set_category("example");
3089 /// ```
3090 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3091 self.category = v.into();
3092 self
3093 }
3094
3095 /// Sets the value of [state][crate::model::Violation::state].
3096 ///
3097 /// # Example
3098 /// ```ignore,no_run
3099 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3100 /// use google_cloud_assuredworkloads_v1::model::violation::State;
3101 /// let x0 = Violation::new().set_state(State::Resolved);
3102 /// let x1 = Violation::new().set_state(State::Unresolved);
3103 /// let x2 = Violation::new().set_state(State::Exception);
3104 /// ```
3105 pub fn set_state<T: std::convert::Into<crate::model::violation::State>>(
3106 mut self,
3107 v: T,
3108 ) -> Self {
3109 self.state = v.into();
3110 self
3111 }
3112
3113 /// Sets the value of [org_policy_constraint][crate::model::Violation::org_policy_constraint].
3114 ///
3115 /// # Example
3116 /// ```ignore,no_run
3117 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3118 /// let x = Violation::new().set_org_policy_constraint("example");
3119 /// ```
3120 pub fn set_org_policy_constraint<T: std::convert::Into<std::string::String>>(
3121 mut self,
3122 v: T,
3123 ) -> Self {
3124 self.org_policy_constraint = v.into();
3125 self
3126 }
3127
3128 /// Sets the value of [audit_log_link][crate::model::Violation::audit_log_link].
3129 ///
3130 /// # Example
3131 /// ```ignore,no_run
3132 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3133 /// let x = Violation::new().set_audit_log_link("example");
3134 /// ```
3135 pub fn set_audit_log_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3136 self.audit_log_link = v.into();
3137 self
3138 }
3139
3140 /// Sets the value of [non_compliant_org_policy][crate::model::Violation::non_compliant_org_policy].
3141 ///
3142 /// # Example
3143 /// ```ignore,no_run
3144 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3145 /// let x = Violation::new().set_non_compliant_org_policy("example");
3146 /// ```
3147 pub fn set_non_compliant_org_policy<T: std::convert::Into<std::string::String>>(
3148 mut self,
3149 v: T,
3150 ) -> Self {
3151 self.non_compliant_org_policy = v.into();
3152 self
3153 }
3154
3155 /// Sets the value of [remediation][crate::model::Violation::remediation].
3156 ///
3157 /// # Example
3158 /// ```ignore,no_run
3159 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3160 /// use google_cloud_assuredworkloads_v1::model::violation::Remediation;
3161 /// let x = Violation::new().set_remediation(Remediation::default()/* use setters */);
3162 /// ```
3163 pub fn set_remediation<T>(mut self, v: T) -> Self
3164 where
3165 T: std::convert::Into<crate::model::violation::Remediation>,
3166 {
3167 self.remediation = std::option::Option::Some(v.into());
3168 self
3169 }
3170
3171 /// Sets or clears the value of [remediation][crate::model::Violation::remediation].
3172 ///
3173 /// # Example
3174 /// ```ignore,no_run
3175 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3176 /// use google_cloud_assuredworkloads_v1::model::violation::Remediation;
3177 /// let x = Violation::new().set_or_clear_remediation(Some(Remediation::default()/* use setters */));
3178 /// let x = Violation::new().set_or_clear_remediation(None::<Remediation>);
3179 /// ```
3180 pub fn set_or_clear_remediation<T>(mut self, v: std::option::Option<T>) -> Self
3181 where
3182 T: std::convert::Into<crate::model::violation::Remediation>,
3183 {
3184 self.remediation = v.map(|x| x.into());
3185 self
3186 }
3187
3188 /// Sets the value of [acknowledged][crate::model::Violation::acknowledged].
3189 ///
3190 /// # Example
3191 /// ```ignore,no_run
3192 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3193 /// let x = Violation::new().set_acknowledged(true);
3194 /// ```
3195 pub fn set_acknowledged<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3196 self.acknowledged = v.into();
3197 self
3198 }
3199
3200 /// Sets the value of [acknowledgement_time][crate::model::Violation::acknowledgement_time].
3201 ///
3202 /// # Example
3203 /// ```ignore,no_run
3204 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3205 /// use wkt::Timestamp;
3206 /// let x = Violation::new().set_acknowledgement_time(Timestamp::default()/* use setters */);
3207 /// ```
3208 pub fn set_acknowledgement_time<T>(mut self, v: T) -> Self
3209 where
3210 T: std::convert::Into<wkt::Timestamp>,
3211 {
3212 self.acknowledgement_time = std::option::Option::Some(v.into());
3213 self
3214 }
3215
3216 /// Sets or clears the value of [acknowledgement_time][crate::model::Violation::acknowledgement_time].
3217 ///
3218 /// # Example
3219 /// ```ignore,no_run
3220 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3221 /// use wkt::Timestamp;
3222 /// let x = Violation::new().set_or_clear_acknowledgement_time(Some(Timestamp::default()/* use setters */));
3223 /// let x = Violation::new().set_or_clear_acknowledgement_time(None::<Timestamp>);
3224 /// ```
3225 pub fn set_or_clear_acknowledgement_time<T>(mut self, v: std::option::Option<T>) -> Self
3226 where
3227 T: std::convert::Into<wkt::Timestamp>,
3228 {
3229 self.acknowledgement_time = v.map(|x| x.into());
3230 self
3231 }
3232
3233 /// Sets the value of [exception_audit_log_link][crate::model::Violation::exception_audit_log_link].
3234 ///
3235 /// # Example
3236 /// ```ignore,no_run
3237 /// # use google_cloud_assuredworkloads_v1::model::Violation;
3238 /// let x = Violation::new().set_exception_audit_log_link("example");
3239 /// ```
3240 pub fn set_exception_audit_log_link<T: std::convert::Into<std::string::String>>(
3241 mut self,
3242 v: T,
3243 ) -> Self {
3244 self.exception_audit_log_link = v.into();
3245 self
3246 }
3247}
3248
3249impl wkt::message::Message for Violation {
3250 fn typename() -> &'static str {
3251 "type.googleapis.com/google.cloud.assuredworkloads.v1.Violation"
3252 }
3253}
3254
3255/// Defines additional types related to [Violation].
3256pub mod violation {
3257 #[allow(unused_imports)]
3258 use super::*;
3259
3260 /// Represents remediation guidance to resolve compliance violation for
3261 /// AssuredWorkload
3262 #[derive(Clone, Default, PartialEq)]
3263 #[non_exhaustive]
3264 pub struct Remediation {
3265 /// Required. Remediation instructions to resolve violations
3266 pub instructions: std::option::Option<crate::model::violation::remediation::Instructions>,
3267
3268 /// Values that can resolve the violation
3269 /// For example: for list org policy violations, this will either be the list
3270 /// of allowed or denied values
3271 pub compliant_values: std::vec::Vec<std::string::String>,
3272
3273 /// Output only. Reemediation type based on the type of org policy values violated
3274 pub remediation_type: crate::model::violation::remediation::RemediationType,
3275
3276 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3277 }
3278
3279 impl Remediation {
3280 pub fn new() -> Self {
3281 std::default::Default::default()
3282 }
3283
3284 /// Sets the value of [instructions][crate::model::violation::Remediation::instructions].
3285 ///
3286 /// # Example
3287 /// ```ignore,no_run
3288 /// # use google_cloud_assuredworkloads_v1::model::violation::Remediation;
3289 /// use google_cloud_assuredworkloads_v1::model::violation::remediation::Instructions;
3290 /// let x = Remediation::new().set_instructions(Instructions::default()/* use setters */);
3291 /// ```
3292 pub fn set_instructions<T>(mut self, v: T) -> Self
3293 where
3294 T: std::convert::Into<crate::model::violation::remediation::Instructions>,
3295 {
3296 self.instructions = std::option::Option::Some(v.into());
3297 self
3298 }
3299
3300 /// Sets or clears the value of [instructions][crate::model::violation::Remediation::instructions].
3301 ///
3302 /// # Example
3303 /// ```ignore,no_run
3304 /// # use google_cloud_assuredworkloads_v1::model::violation::Remediation;
3305 /// use google_cloud_assuredworkloads_v1::model::violation::remediation::Instructions;
3306 /// let x = Remediation::new().set_or_clear_instructions(Some(Instructions::default()/* use setters */));
3307 /// let x = Remediation::new().set_or_clear_instructions(None::<Instructions>);
3308 /// ```
3309 pub fn set_or_clear_instructions<T>(mut self, v: std::option::Option<T>) -> Self
3310 where
3311 T: std::convert::Into<crate::model::violation::remediation::Instructions>,
3312 {
3313 self.instructions = v.map(|x| x.into());
3314 self
3315 }
3316
3317 /// Sets the value of [compliant_values][crate::model::violation::Remediation::compliant_values].
3318 ///
3319 /// # Example
3320 /// ```ignore,no_run
3321 /// # use google_cloud_assuredworkloads_v1::model::violation::Remediation;
3322 /// let x = Remediation::new().set_compliant_values(["a", "b", "c"]);
3323 /// ```
3324 pub fn set_compliant_values<T, V>(mut self, v: T) -> Self
3325 where
3326 T: std::iter::IntoIterator<Item = V>,
3327 V: std::convert::Into<std::string::String>,
3328 {
3329 use std::iter::Iterator;
3330 self.compliant_values = v.into_iter().map(|i| i.into()).collect();
3331 self
3332 }
3333
3334 /// Sets the value of [remediation_type][crate::model::violation::Remediation::remediation_type].
3335 ///
3336 /// # Example
3337 /// ```ignore,no_run
3338 /// # use google_cloud_assuredworkloads_v1::model::violation::Remediation;
3339 /// use google_cloud_assuredworkloads_v1::model::violation::remediation::RemediationType;
3340 /// let x0 = Remediation::new().set_remediation_type(RemediationType::RemediationBooleanOrgPolicyViolation);
3341 /// let x1 = Remediation::new().set_remediation_type(RemediationType::RemediationListAllowedValuesOrgPolicyViolation);
3342 /// let x2 = Remediation::new().set_remediation_type(RemediationType::RemediationListDeniedValuesOrgPolicyViolation);
3343 /// ```
3344 pub fn set_remediation_type<
3345 T: std::convert::Into<crate::model::violation::remediation::RemediationType>,
3346 >(
3347 mut self,
3348 v: T,
3349 ) -> Self {
3350 self.remediation_type = v.into();
3351 self
3352 }
3353 }
3354
3355 impl wkt::message::Message for Remediation {
3356 fn typename() -> &'static str {
3357 "type.googleapis.com/google.cloud.assuredworkloads.v1.Violation.Remediation"
3358 }
3359 }
3360
3361 /// Defines additional types related to [Remediation].
3362 pub mod remediation {
3363 #[allow(unused_imports)]
3364 use super::*;
3365
3366 /// Instructions to remediate violation
3367 #[derive(Clone, Default, PartialEq)]
3368 #[non_exhaustive]
3369 pub struct Instructions {
3370 /// Remediation instructions to resolve violation via gcloud cli
3371 pub gcloud_instructions:
3372 std::option::Option<crate::model::violation::remediation::instructions::Gcloud>,
3373
3374 /// Remediation instructions to resolve violation via cloud console
3375 pub console_instructions:
3376 std::option::Option<crate::model::violation::remediation::instructions::Console>,
3377
3378 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3379 }
3380
3381 impl Instructions {
3382 pub fn new() -> Self {
3383 std::default::Default::default()
3384 }
3385
3386 /// Sets the value of [gcloud_instructions][crate::model::violation::remediation::Instructions::gcloud_instructions].
3387 ///
3388 /// # Example
3389 /// ```ignore,no_run
3390 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::Instructions;
3391 /// use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Gcloud;
3392 /// let x = Instructions::new().set_gcloud_instructions(Gcloud::default()/* use setters */);
3393 /// ```
3394 pub fn set_gcloud_instructions<T>(mut self, v: T) -> Self
3395 where
3396 T: std::convert::Into<crate::model::violation::remediation::instructions::Gcloud>,
3397 {
3398 self.gcloud_instructions = std::option::Option::Some(v.into());
3399 self
3400 }
3401
3402 /// Sets or clears the value of [gcloud_instructions][crate::model::violation::remediation::Instructions::gcloud_instructions].
3403 ///
3404 /// # Example
3405 /// ```ignore,no_run
3406 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::Instructions;
3407 /// use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Gcloud;
3408 /// let x = Instructions::new().set_or_clear_gcloud_instructions(Some(Gcloud::default()/* use setters */));
3409 /// let x = Instructions::new().set_or_clear_gcloud_instructions(None::<Gcloud>);
3410 /// ```
3411 pub fn set_or_clear_gcloud_instructions<T>(mut self, v: std::option::Option<T>) -> Self
3412 where
3413 T: std::convert::Into<crate::model::violation::remediation::instructions::Gcloud>,
3414 {
3415 self.gcloud_instructions = v.map(|x| x.into());
3416 self
3417 }
3418
3419 /// Sets the value of [console_instructions][crate::model::violation::remediation::Instructions::console_instructions].
3420 ///
3421 /// # Example
3422 /// ```ignore,no_run
3423 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::Instructions;
3424 /// use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Console;
3425 /// let x = Instructions::new().set_console_instructions(Console::default()/* use setters */);
3426 /// ```
3427 pub fn set_console_instructions<T>(mut self, v: T) -> Self
3428 where
3429 T: std::convert::Into<crate::model::violation::remediation::instructions::Console>,
3430 {
3431 self.console_instructions = std::option::Option::Some(v.into());
3432 self
3433 }
3434
3435 /// Sets or clears the value of [console_instructions][crate::model::violation::remediation::Instructions::console_instructions].
3436 ///
3437 /// # Example
3438 /// ```ignore,no_run
3439 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::Instructions;
3440 /// use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Console;
3441 /// let x = Instructions::new().set_or_clear_console_instructions(Some(Console::default()/* use setters */));
3442 /// let x = Instructions::new().set_or_clear_console_instructions(None::<Console>);
3443 /// ```
3444 pub fn set_or_clear_console_instructions<T>(mut self, v: std::option::Option<T>) -> Self
3445 where
3446 T: std::convert::Into<crate::model::violation::remediation::instructions::Console>,
3447 {
3448 self.console_instructions = v.map(|x| x.into());
3449 self
3450 }
3451 }
3452
3453 impl wkt::message::Message for Instructions {
3454 fn typename() -> &'static str {
3455 "type.googleapis.com/google.cloud.assuredworkloads.v1.Violation.Remediation.Instructions"
3456 }
3457 }
3458
3459 /// Defines additional types related to [Instructions].
3460 pub mod instructions {
3461 #[allow(unused_imports)]
3462 use super::*;
3463
3464 /// Remediation instructions to resolve violation via gcloud cli
3465 #[derive(Clone, Default, PartialEq)]
3466 #[non_exhaustive]
3467 pub struct Gcloud {
3468 /// Gcloud command to resolve violation
3469 pub gcloud_commands: std::vec::Vec<std::string::String>,
3470
3471 /// Steps to resolve violation via gcloud cli
3472 pub steps: std::vec::Vec<std::string::String>,
3473
3474 /// Additional urls for more information about steps
3475 pub additional_links: std::vec::Vec<std::string::String>,
3476
3477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3478 }
3479
3480 impl Gcloud {
3481 pub fn new() -> Self {
3482 std::default::Default::default()
3483 }
3484
3485 /// Sets the value of [gcloud_commands][crate::model::violation::remediation::instructions::Gcloud::gcloud_commands].
3486 ///
3487 /// # Example
3488 /// ```ignore,no_run
3489 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Gcloud;
3490 /// let x = Gcloud::new().set_gcloud_commands(["a", "b", "c"]);
3491 /// ```
3492 pub fn set_gcloud_commands<T, V>(mut self, v: T) -> Self
3493 where
3494 T: std::iter::IntoIterator<Item = V>,
3495 V: std::convert::Into<std::string::String>,
3496 {
3497 use std::iter::Iterator;
3498 self.gcloud_commands = v.into_iter().map(|i| i.into()).collect();
3499 self
3500 }
3501
3502 /// Sets the value of [steps][crate::model::violation::remediation::instructions::Gcloud::steps].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Gcloud;
3507 /// let x = Gcloud::new().set_steps(["a", "b", "c"]);
3508 /// ```
3509 pub fn set_steps<T, V>(mut self, v: T) -> Self
3510 where
3511 T: std::iter::IntoIterator<Item = V>,
3512 V: std::convert::Into<std::string::String>,
3513 {
3514 use std::iter::Iterator;
3515 self.steps = v.into_iter().map(|i| i.into()).collect();
3516 self
3517 }
3518
3519 /// Sets the value of [additional_links][crate::model::violation::remediation::instructions::Gcloud::additional_links].
3520 ///
3521 /// # Example
3522 /// ```ignore,no_run
3523 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Gcloud;
3524 /// let x = Gcloud::new().set_additional_links(["a", "b", "c"]);
3525 /// ```
3526 pub fn set_additional_links<T, V>(mut self, v: T) -> Self
3527 where
3528 T: std::iter::IntoIterator<Item = V>,
3529 V: std::convert::Into<std::string::String>,
3530 {
3531 use std::iter::Iterator;
3532 self.additional_links = v.into_iter().map(|i| i.into()).collect();
3533 self
3534 }
3535 }
3536
3537 impl wkt::message::Message for Gcloud {
3538 fn typename() -> &'static str {
3539 "type.googleapis.com/google.cloud.assuredworkloads.v1.Violation.Remediation.Instructions.Gcloud"
3540 }
3541 }
3542
3543 /// Remediation instructions to resolve violation via cloud console
3544 #[derive(Clone, Default, PartialEq)]
3545 #[non_exhaustive]
3546 pub struct Console {
3547 /// Link to console page where violations can be resolved
3548 pub console_uris: std::vec::Vec<std::string::String>,
3549
3550 /// Steps to resolve violation via cloud console
3551 pub steps: std::vec::Vec<std::string::String>,
3552
3553 /// Additional urls for more information about steps
3554 pub additional_links: std::vec::Vec<std::string::String>,
3555
3556 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3557 }
3558
3559 impl Console {
3560 pub fn new() -> Self {
3561 std::default::Default::default()
3562 }
3563
3564 /// Sets the value of [console_uris][crate::model::violation::remediation::instructions::Console::console_uris].
3565 ///
3566 /// # Example
3567 /// ```ignore,no_run
3568 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Console;
3569 /// let x = Console::new().set_console_uris(["a", "b", "c"]);
3570 /// ```
3571 pub fn set_console_uris<T, V>(mut self, v: T) -> Self
3572 where
3573 T: std::iter::IntoIterator<Item = V>,
3574 V: std::convert::Into<std::string::String>,
3575 {
3576 use std::iter::Iterator;
3577 self.console_uris = v.into_iter().map(|i| i.into()).collect();
3578 self
3579 }
3580
3581 /// Sets the value of [steps][crate::model::violation::remediation::instructions::Console::steps].
3582 ///
3583 /// # Example
3584 /// ```ignore,no_run
3585 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Console;
3586 /// let x = Console::new().set_steps(["a", "b", "c"]);
3587 /// ```
3588 pub fn set_steps<T, V>(mut self, v: T) -> Self
3589 where
3590 T: std::iter::IntoIterator<Item = V>,
3591 V: std::convert::Into<std::string::String>,
3592 {
3593 use std::iter::Iterator;
3594 self.steps = v.into_iter().map(|i| i.into()).collect();
3595 self
3596 }
3597
3598 /// Sets the value of [additional_links][crate::model::violation::remediation::instructions::Console::additional_links].
3599 ///
3600 /// # Example
3601 /// ```ignore,no_run
3602 /// # use google_cloud_assuredworkloads_v1::model::violation::remediation::instructions::Console;
3603 /// let x = Console::new().set_additional_links(["a", "b", "c"]);
3604 /// ```
3605 pub fn set_additional_links<T, V>(mut self, v: T) -> Self
3606 where
3607 T: std::iter::IntoIterator<Item = V>,
3608 V: std::convert::Into<std::string::String>,
3609 {
3610 use std::iter::Iterator;
3611 self.additional_links = v.into_iter().map(|i| i.into()).collect();
3612 self
3613 }
3614 }
3615
3616 impl wkt::message::Message for Console {
3617 fn typename() -> &'static str {
3618 "type.googleapis.com/google.cloud.assuredworkloads.v1.Violation.Remediation.Instructions.Console"
3619 }
3620 }
3621 }
3622
3623 /// Classifying remediation into various types based on the kind of
3624 /// violation. For example, violations caused due to changes in boolean org
3625 /// policy requires different remediation instructions compared to violation
3626 /// caused due to changes in allowed values of list org policy.
3627 ///
3628 /// # Working with unknown values
3629 ///
3630 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3631 /// additional enum variants at any time. Adding new variants is not considered
3632 /// a breaking change. Applications should write their code in anticipation of:
3633 ///
3634 /// - New values appearing in future releases of the client library, **and**
3635 /// - New values received dynamically, without application changes.
3636 ///
3637 /// Please consult the [Working with enums] section in the user guide for some
3638 /// guidelines.
3639 ///
3640 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3641 #[derive(Clone, Debug, PartialEq)]
3642 #[non_exhaustive]
3643 pub enum RemediationType {
3644 /// Unspecified remediation type
3645 Unspecified,
3646 /// Remediation type for boolean org policy
3647 RemediationBooleanOrgPolicyViolation,
3648 /// Remediation type for list org policy which have allowed values in the
3649 /// monitoring rule
3650 RemediationListAllowedValuesOrgPolicyViolation,
3651 /// Remediation type for list org policy which have denied values in the
3652 /// monitoring rule
3653 RemediationListDeniedValuesOrgPolicyViolation,
3654 /// Remediation type for gcp.restrictCmekCryptoKeyProjects
3655 RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation,
3656 /// If set, the enum was initialized with an unknown value.
3657 ///
3658 /// Applications can examine the value using [RemediationType::value] or
3659 /// [RemediationType::name].
3660 UnknownValue(remediation_type::UnknownValue),
3661 }
3662
3663 #[doc(hidden)]
3664 pub mod remediation_type {
3665 #[allow(unused_imports)]
3666 use super::*;
3667 #[derive(Clone, Debug, PartialEq)]
3668 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3669 }
3670
3671 impl RemediationType {
3672 /// Gets the enum value.
3673 ///
3674 /// Returns `None` if the enum contains an unknown value deserialized from
3675 /// the string representation of enums.
3676 pub fn value(&self) -> std::option::Option<i32> {
3677 match self {
3678 Self::Unspecified => std::option::Option::Some(0),
3679 Self::RemediationBooleanOrgPolicyViolation => std::option::Option::Some(1),
3680 Self::RemediationListAllowedValuesOrgPolicyViolation => {
3681 std::option::Option::Some(2)
3682 }
3683 Self::RemediationListDeniedValuesOrgPolicyViolation => {
3684 std::option::Option::Some(3)
3685 }
3686 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation => {
3687 std::option::Option::Some(4)
3688 }
3689 Self::UnknownValue(u) => u.0.value(),
3690 }
3691 }
3692
3693 /// Gets the enum value as a string.
3694 ///
3695 /// Returns `None` if the enum contains an unknown value deserialized from
3696 /// the integer representation of enums.
3697 pub fn name(&self) -> std::option::Option<&str> {
3698 match self {
3699 Self::Unspecified => std::option::Option::Some("REMEDIATION_TYPE_UNSPECIFIED"),
3700 Self::RemediationBooleanOrgPolicyViolation => {
3701 std::option::Option::Some("REMEDIATION_BOOLEAN_ORG_POLICY_VIOLATION")
3702 }
3703 Self::RemediationListAllowedValuesOrgPolicyViolation => {
3704 std::option::Option::Some(
3705 "REMEDIATION_LIST_ALLOWED_VALUES_ORG_POLICY_VIOLATION",
3706 )
3707 }
3708 Self::RemediationListDeniedValuesOrgPolicyViolation => {
3709 std::option::Option::Some(
3710 "REMEDIATION_LIST_DENIED_VALUES_ORG_POLICY_VIOLATION",
3711 )
3712 }
3713 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation => {
3714 std::option::Option::Some(
3715 "REMEDIATION_RESTRICT_CMEK_CRYPTO_KEY_PROJECTS_ORG_POLICY_VIOLATION",
3716 )
3717 }
3718 Self::UnknownValue(u) => u.0.name(),
3719 }
3720 }
3721 }
3722
3723 impl std::default::Default for RemediationType {
3724 fn default() -> Self {
3725 use std::convert::From;
3726 Self::from(0)
3727 }
3728 }
3729
3730 impl std::fmt::Display for RemediationType {
3731 fn fmt(
3732 &self,
3733 f: &mut std::fmt::Formatter<'_>,
3734 ) -> std::result::Result<(), std::fmt::Error> {
3735 wkt::internal::display_enum(f, self.name(), self.value())
3736 }
3737 }
3738
3739 impl std::convert::From<i32> for RemediationType {
3740 fn from(value: i32) -> Self {
3741 match value {
3742 0 => Self::Unspecified,
3743 1 => Self::RemediationBooleanOrgPolicyViolation,
3744 2 => Self::RemediationListAllowedValuesOrgPolicyViolation,
3745 3 => Self::RemediationListDeniedValuesOrgPolicyViolation,
3746 4 => Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation,
3747 _ => Self::UnknownValue(remediation_type::UnknownValue(
3748 wkt::internal::UnknownEnumValue::Integer(value),
3749 )),
3750 }
3751 }
3752 }
3753
3754 impl std::convert::From<&str> for RemediationType {
3755 fn from(value: &str) -> Self {
3756 use std::string::ToString;
3757 match value {
3758 "REMEDIATION_TYPE_UNSPECIFIED" => Self::Unspecified,
3759 "REMEDIATION_BOOLEAN_ORG_POLICY_VIOLATION" => {
3760 Self::RemediationBooleanOrgPolicyViolation
3761 }
3762 "REMEDIATION_LIST_ALLOWED_VALUES_ORG_POLICY_VIOLATION" => {
3763 Self::RemediationListAllowedValuesOrgPolicyViolation
3764 }
3765 "REMEDIATION_LIST_DENIED_VALUES_ORG_POLICY_VIOLATION" => {
3766 Self::RemediationListDeniedValuesOrgPolicyViolation
3767 }
3768 "REMEDIATION_RESTRICT_CMEK_CRYPTO_KEY_PROJECTS_ORG_POLICY_VIOLATION" => {
3769 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation
3770 }
3771 _ => Self::UnknownValue(remediation_type::UnknownValue(
3772 wkt::internal::UnknownEnumValue::String(value.to_string()),
3773 )),
3774 }
3775 }
3776 }
3777
3778 impl serde::ser::Serialize for RemediationType {
3779 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3780 where
3781 S: serde::Serializer,
3782 {
3783 match self {
3784 Self::Unspecified => serializer.serialize_i32(0),
3785 Self::RemediationBooleanOrgPolicyViolation => serializer.serialize_i32(1),
3786 Self::RemediationListAllowedValuesOrgPolicyViolation => {
3787 serializer.serialize_i32(2)
3788 }
3789 Self::RemediationListDeniedValuesOrgPolicyViolation => {
3790 serializer.serialize_i32(3)
3791 }
3792 Self::RemediationRestrictCmekCryptoKeyProjectsOrgPolicyViolation => {
3793 serializer.serialize_i32(4)
3794 }
3795 Self::UnknownValue(u) => u.0.serialize(serializer),
3796 }
3797 }
3798 }
3799
3800 impl<'de> serde::de::Deserialize<'de> for RemediationType {
3801 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3802 where
3803 D: serde::Deserializer<'de>,
3804 {
3805 deserializer.deserialize_any(wkt::internal::EnumVisitor::<RemediationType>::new(
3806 ".google.cloud.assuredworkloads.v1.Violation.Remediation.RemediationType",
3807 ))
3808 }
3809 }
3810 }
3811
3812 /// Violation State Values
3813 ///
3814 /// # Working with unknown values
3815 ///
3816 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3817 /// additional enum variants at any time. Adding new variants is not considered
3818 /// a breaking change. Applications should write their code in anticipation of:
3819 ///
3820 /// - New values appearing in future releases of the client library, **and**
3821 /// - New values received dynamically, without application changes.
3822 ///
3823 /// Please consult the [Working with enums] section in the user guide for some
3824 /// guidelines.
3825 ///
3826 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3827 #[derive(Clone, Debug, PartialEq)]
3828 #[non_exhaustive]
3829 pub enum State {
3830 /// Unspecified state.
3831 Unspecified,
3832 /// Violation is resolved.
3833 Resolved,
3834 /// Violation is Unresolved
3835 Unresolved,
3836 /// Violation is Exception
3837 Exception,
3838 /// If set, the enum was initialized with an unknown value.
3839 ///
3840 /// Applications can examine the value using [State::value] or
3841 /// [State::name].
3842 UnknownValue(state::UnknownValue),
3843 }
3844
3845 #[doc(hidden)]
3846 pub mod state {
3847 #[allow(unused_imports)]
3848 use super::*;
3849 #[derive(Clone, Debug, PartialEq)]
3850 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3851 }
3852
3853 impl State {
3854 /// Gets the enum value.
3855 ///
3856 /// Returns `None` if the enum contains an unknown value deserialized from
3857 /// the string representation of enums.
3858 pub fn value(&self) -> std::option::Option<i32> {
3859 match self {
3860 Self::Unspecified => std::option::Option::Some(0),
3861 Self::Resolved => std::option::Option::Some(2),
3862 Self::Unresolved => std::option::Option::Some(3),
3863 Self::Exception => std::option::Option::Some(4),
3864 Self::UnknownValue(u) => u.0.value(),
3865 }
3866 }
3867
3868 /// Gets the enum value as a string.
3869 ///
3870 /// Returns `None` if the enum contains an unknown value deserialized from
3871 /// the integer representation of enums.
3872 pub fn name(&self) -> std::option::Option<&str> {
3873 match self {
3874 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3875 Self::Resolved => std::option::Option::Some("RESOLVED"),
3876 Self::Unresolved => std::option::Option::Some("UNRESOLVED"),
3877 Self::Exception => std::option::Option::Some("EXCEPTION"),
3878 Self::UnknownValue(u) => u.0.name(),
3879 }
3880 }
3881 }
3882
3883 impl std::default::Default for State {
3884 fn default() -> Self {
3885 use std::convert::From;
3886 Self::from(0)
3887 }
3888 }
3889
3890 impl std::fmt::Display for State {
3891 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3892 wkt::internal::display_enum(f, self.name(), self.value())
3893 }
3894 }
3895
3896 impl std::convert::From<i32> for State {
3897 fn from(value: i32) -> Self {
3898 match value {
3899 0 => Self::Unspecified,
3900 2 => Self::Resolved,
3901 3 => Self::Unresolved,
3902 4 => Self::Exception,
3903 _ => Self::UnknownValue(state::UnknownValue(
3904 wkt::internal::UnknownEnumValue::Integer(value),
3905 )),
3906 }
3907 }
3908 }
3909
3910 impl std::convert::From<&str> for State {
3911 fn from(value: &str) -> Self {
3912 use std::string::ToString;
3913 match value {
3914 "STATE_UNSPECIFIED" => Self::Unspecified,
3915 "RESOLVED" => Self::Resolved,
3916 "UNRESOLVED" => Self::Unresolved,
3917 "EXCEPTION" => Self::Exception,
3918 _ => Self::UnknownValue(state::UnknownValue(
3919 wkt::internal::UnknownEnumValue::String(value.to_string()),
3920 )),
3921 }
3922 }
3923 }
3924
3925 impl serde::ser::Serialize for State {
3926 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3927 where
3928 S: serde::Serializer,
3929 {
3930 match self {
3931 Self::Unspecified => serializer.serialize_i32(0),
3932 Self::Resolved => serializer.serialize_i32(2),
3933 Self::Unresolved => serializer.serialize_i32(3),
3934 Self::Exception => serializer.serialize_i32(4),
3935 Self::UnknownValue(u) => u.0.serialize(serializer),
3936 }
3937 }
3938 }
3939
3940 impl<'de> serde::de::Deserialize<'de> for State {
3941 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3942 where
3943 D: serde::Deserializer<'de>,
3944 {
3945 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3946 ".google.cloud.assuredworkloads.v1.Violation.State",
3947 ))
3948 }
3949 }
3950}