google_cloud_securityposture_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_location;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_type;
28extern crate serde;
29extern crate serde_json;
30extern crate serde_with;
31extern crate std;
32extern crate tracing;
33extern crate wkt;
34
35mod debug;
36mod deserialize;
37mod serialize;
38
39/// A rule used to express this policy.
40#[derive(Clone, Default, PartialEq)]
41#[non_exhaustive]
42pub struct PolicyRule {
43 /// A condition which determines whether this rule is used
44 /// in the evaluation of the policy. When set, the `expression` field in
45 /// the `Expr' must include from 1 to 10 subexpressions, joined by the "||"
46 /// or "&&" operators. Each subexpression must be of the form
47 /// "resource.matchTag('<ORG_ID>/tag_key_short_name,
48 /// 'tag_value_short_name')" or "resource.matchTagId('tagKeys/key_id',
49 /// 'tagValues/value_id')" where key_name and value_name are the resource
50 /// names for Label Keys and Values. These names are available from the Tag
51 /// Manager Service. An example expression is:
52 /// "resource.matchTag('123456789/environment,
53 /// 'prod')" or "resource.matchTagId('tagKeys/123',
54 /// 'tagValues/456')".
55 pub condition: std::option::Option<google_cloud_type::model::Expr>,
56
57 #[allow(missing_docs)]
58 pub kind: std::option::Option<crate::model::policy_rule::Kind>,
59
60 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
61}
62
63impl PolicyRule {
64 /// Creates a new default instance.
65 pub fn new() -> Self {
66 std::default::Default::default()
67 }
68
69 /// Sets the value of [condition][crate::model::PolicyRule::condition].
70 ///
71 /// # Example
72 /// ```ignore,no_run
73 /// # use google_cloud_securityposture_v1::model::PolicyRule;
74 /// use google_cloud_type::model::Expr;
75 /// let x = PolicyRule::new().set_condition(Expr::default()/* use setters */);
76 /// ```
77 pub fn set_condition<T>(mut self, v: T) -> Self
78 where
79 T: std::convert::Into<google_cloud_type::model::Expr>,
80 {
81 self.condition = std::option::Option::Some(v.into());
82 self
83 }
84
85 /// Sets or clears the value of [condition][crate::model::PolicyRule::condition].
86 ///
87 /// # Example
88 /// ```ignore,no_run
89 /// # use google_cloud_securityposture_v1::model::PolicyRule;
90 /// use google_cloud_type::model::Expr;
91 /// let x = PolicyRule::new().set_or_clear_condition(Some(Expr::default()/* use setters */));
92 /// let x = PolicyRule::new().set_or_clear_condition(None::<Expr>);
93 /// ```
94 pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
95 where
96 T: std::convert::Into<google_cloud_type::model::Expr>,
97 {
98 self.condition = v.map(|x| x.into());
99 self
100 }
101
102 /// Sets the value of [kind][crate::model::PolicyRule::kind].
103 ///
104 /// Note that all the setters affecting `kind` are mutually
105 /// exclusive.
106 ///
107 /// # Example
108 /// ```ignore,no_run
109 /// # use google_cloud_securityposture_v1::model::PolicyRule;
110 /// use google_cloud_securityposture_v1::model::policy_rule::Kind;
111 /// let x = PolicyRule::new().set_kind(Some(Kind::AllowAll(true)));
112 /// ```
113 pub fn set_kind<T: std::convert::Into<std::option::Option<crate::model::policy_rule::Kind>>>(
114 mut self,
115 v: T,
116 ) -> Self {
117 self.kind = v.into();
118 self
119 }
120
121 /// The value of [kind][crate::model::PolicyRule::kind]
122 /// if it holds a `Values`, `None` if the field is not set or
123 /// holds a different branch.
124 pub fn values(
125 &self,
126 ) -> std::option::Option<&std::boxed::Box<crate::model::policy_rule::StringValues>> {
127 #[allow(unreachable_patterns)]
128 self.kind.as_ref().and_then(|v| match v {
129 crate::model::policy_rule::Kind::Values(v) => std::option::Option::Some(v),
130 _ => std::option::Option::None,
131 })
132 }
133
134 /// Sets the value of [kind][crate::model::PolicyRule::kind]
135 /// to hold a `Values`.
136 ///
137 /// Note that all the setters affecting `kind` are
138 /// mutually exclusive.
139 ///
140 /// # Example
141 /// ```ignore,no_run
142 /// # use google_cloud_securityposture_v1::model::PolicyRule;
143 /// use google_cloud_securityposture_v1::model::policy_rule::StringValues;
144 /// let x = PolicyRule::new().set_values(StringValues::default()/* use setters */);
145 /// assert!(x.values().is_some());
146 /// assert!(x.allow_all().is_none());
147 /// assert!(x.deny_all().is_none());
148 /// assert!(x.enforce().is_none());
149 /// ```
150 pub fn set_values<
151 T: std::convert::Into<std::boxed::Box<crate::model::policy_rule::StringValues>>,
152 >(
153 mut self,
154 v: T,
155 ) -> Self {
156 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Values(v.into()));
157 self
158 }
159
160 /// The value of [kind][crate::model::PolicyRule::kind]
161 /// if it holds a `AllowAll`, `None` if the field is not set or
162 /// holds a different branch.
163 pub fn allow_all(&self) -> std::option::Option<&bool> {
164 #[allow(unreachable_patterns)]
165 self.kind.as_ref().and_then(|v| match v {
166 crate::model::policy_rule::Kind::AllowAll(v) => std::option::Option::Some(v),
167 _ => std::option::Option::None,
168 })
169 }
170
171 /// Sets the value of [kind][crate::model::PolicyRule::kind]
172 /// to hold a `AllowAll`.
173 ///
174 /// Note that all the setters affecting `kind` are
175 /// mutually exclusive.
176 ///
177 /// # Example
178 /// ```ignore,no_run
179 /// # use google_cloud_securityposture_v1::model::PolicyRule;
180 /// let x = PolicyRule::new().set_allow_all(true);
181 /// assert!(x.allow_all().is_some());
182 /// assert!(x.values().is_none());
183 /// assert!(x.deny_all().is_none());
184 /// assert!(x.enforce().is_none());
185 /// ```
186 pub fn set_allow_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
187 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::AllowAll(v.into()));
188 self
189 }
190
191 /// The value of [kind][crate::model::PolicyRule::kind]
192 /// if it holds a `DenyAll`, `None` if the field is not set or
193 /// holds a different branch.
194 pub fn deny_all(&self) -> std::option::Option<&bool> {
195 #[allow(unreachable_patterns)]
196 self.kind.as_ref().and_then(|v| match v {
197 crate::model::policy_rule::Kind::DenyAll(v) => std::option::Option::Some(v),
198 _ => std::option::Option::None,
199 })
200 }
201
202 /// Sets the value of [kind][crate::model::PolicyRule::kind]
203 /// to hold a `DenyAll`.
204 ///
205 /// Note that all the setters affecting `kind` are
206 /// mutually exclusive.
207 ///
208 /// # Example
209 /// ```ignore,no_run
210 /// # use google_cloud_securityposture_v1::model::PolicyRule;
211 /// let x = PolicyRule::new().set_deny_all(true);
212 /// assert!(x.deny_all().is_some());
213 /// assert!(x.values().is_none());
214 /// assert!(x.allow_all().is_none());
215 /// assert!(x.enforce().is_none());
216 /// ```
217 pub fn set_deny_all<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
218 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::DenyAll(v.into()));
219 self
220 }
221
222 /// The value of [kind][crate::model::PolicyRule::kind]
223 /// if it holds a `Enforce`, `None` if the field is not set or
224 /// holds a different branch.
225 pub fn enforce(&self) -> std::option::Option<&bool> {
226 #[allow(unreachable_patterns)]
227 self.kind.as_ref().and_then(|v| match v {
228 crate::model::policy_rule::Kind::Enforce(v) => std::option::Option::Some(v),
229 _ => std::option::Option::None,
230 })
231 }
232
233 /// Sets the value of [kind][crate::model::PolicyRule::kind]
234 /// to hold a `Enforce`.
235 ///
236 /// Note that all the setters affecting `kind` are
237 /// mutually exclusive.
238 ///
239 /// # Example
240 /// ```ignore,no_run
241 /// # use google_cloud_securityposture_v1::model::PolicyRule;
242 /// let x = PolicyRule::new().set_enforce(true);
243 /// assert!(x.enforce().is_some());
244 /// assert!(x.values().is_none());
245 /// assert!(x.allow_all().is_none());
246 /// assert!(x.deny_all().is_none());
247 /// ```
248 pub fn set_enforce<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
249 self.kind = std::option::Option::Some(crate::model::policy_rule::Kind::Enforce(v.into()));
250 self
251 }
252}
253
254impl wkt::message::Message for PolicyRule {
255 fn typename() -> &'static str {
256 "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule"
257 }
258}
259
260/// Defines additional types related to [PolicyRule].
261pub mod policy_rule {
262 #[allow(unused_imports)]
263 use super::*;
264
265 /// A message that holds specific allowed and denied values.
266 /// This message can define specific values and subtrees of the Resource
267 /// Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that
268 /// are allowed or denied. This is achieved by using the `under:` and
269 /// optional `is:` prefixes.
270 /// The `under:` prefix is used to denote resource subtree values.
271 /// The `is:` prefix is used to denote specific values, and is required only
272 /// if the value contains a ":". Values prefixed with "is:" are treated the
273 /// same as values with no prefix.
274 /// Ancestry subtrees must be in one of the following formats:
275 ///
276 /// - `projects/<project-id>` (for example, `projects/tokyo-rain-123`)
277 /// - `folders/<folder-id>` (for example, `folders/1234`)
278 /// - `organizations/<organization-id>` (for example, `organizations/1234`)
279 ///
280 /// The `supports_under` field of the associated `Constraint` defines
281 /// whether ancestry prefixes can be used.
282 #[derive(Clone, Default, PartialEq)]
283 #[non_exhaustive]
284 pub struct StringValues {
285 /// List of values allowed at this resource.
286 pub allowed_values: std::vec::Vec<std::string::String>,
287
288 /// List of values denied at this resource.
289 pub denied_values: std::vec::Vec<std::string::String>,
290
291 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
292 }
293
294 impl StringValues {
295 /// Creates a new default instance.
296 pub fn new() -> Self {
297 std::default::Default::default()
298 }
299
300 /// Sets the value of [allowed_values][crate::model::policy_rule::StringValues::allowed_values].
301 ///
302 /// # Example
303 /// ```ignore,no_run
304 /// # use google_cloud_securityposture_v1::model::policy_rule::StringValues;
305 /// let x = StringValues::new().set_allowed_values(["a", "b", "c"]);
306 /// ```
307 pub fn set_allowed_values<T, V>(mut self, v: T) -> Self
308 where
309 T: std::iter::IntoIterator<Item = V>,
310 V: std::convert::Into<std::string::String>,
311 {
312 use std::iter::Iterator;
313 self.allowed_values = v.into_iter().map(|i| i.into()).collect();
314 self
315 }
316
317 /// Sets the value of [denied_values][crate::model::policy_rule::StringValues::denied_values].
318 ///
319 /// # Example
320 /// ```ignore,no_run
321 /// # use google_cloud_securityposture_v1::model::policy_rule::StringValues;
322 /// let x = StringValues::new().set_denied_values(["a", "b", "c"]);
323 /// ```
324 pub fn set_denied_values<T, V>(mut self, v: T) -> Self
325 where
326 T: std::iter::IntoIterator<Item = V>,
327 V: std::convert::Into<std::string::String>,
328 {
329 use std::iter::Iterator;
330 self.denied_values = v.into_iter().map(|i| i.into()).collect();
331 self
332 }
333 }
334
335 impl wkt::message::Message for StringValues {
336 fn typename() -> &'static str {
337 "type.googleapis.com/google.cloud.securityposture.v1.PolicyRule.StringValues"
338 }
339 }
340
341 #[allow(missing_docs)]
342 #[derive(Clone, Debug, PartialEq)]
343 #[non_exhaustive]
344 pub enum Kind {
345 /// List of values to be used for this policy rule. This field can be set
346 /// only in policies for list constraints.
347 Values(std::boxed::Box<crate::model::policy_rule::StringValues>),
348 /// Setting this to true means that all values are allowed. This field can
349 /// be set only in policies for list constraints.
350 AllowAll(bool),
351 /// Setting this to true means that all values are denied. This field can
352 /// be set only in policies for list constraints.
353 DenyAll(bool),
354 /// If `true`, then the policy is enforced. If `false`, then any
355 /// configuration is acceptable.
356 /// This field can be set only in policies for boolean constraints.
357 Enforce(bool),
358 }
359}
360
361/// A custom constraint defined by customers which can *only* be applied to the
362/// given resource types and organization.
363///
364/// By creating a custom constraint, customers can apply policies of this
365/// custom constraint. *Creating a custom constraint itself does NOT apply any
366/// policy enforcement*.
367#[derive(Clone, Default, PartialEq)]
368#[non_exhaustive]
369pub struct CustomConstraint {
370 /// Immutable. Name of the constraint. This is unique within the organization.
371 /// Format of the name should be
372 ///
373 ///
374 /// `organizations/{organization_id}/customConstraints/{custom_constraint_id}`
375 ///
376 /// Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms`
377 ///
378 /// The max length is 70 characters and the minimum length is 1. Note that the
379 /// prefix `organizations/{organization_id}/customConstraints/` is not counted.
380 pub name: std::string::String,
381
382 /// Immutable. The resource instance type on which this policy applies. Format
383 /// will be of the form : `<canonical service name>/<type>` Example:
384 ///
385 /// - `compute.googleapis.com/Instance`.
386 pub resource_types: std::vec::Vec<std::string::String>,
387
388 /// All the operations being applied for this constraint.
389 pub method_types: std::vec::Vec<crate::model::custom_constraint::MethodType>,
390
391 /// Org policy condition/expression. For example:
392 /// `resource.instanceName.matches("[production|test]_.*_(\d)+")` or,
393 /// `resource.management.auto_upgrade == true`
394 ///
395 /// The max length of the condition is 1000 characters.
396 pub condition: std::string::String,
397
398 /// Allow or deny type.
399 pub action_type: crate::model::custom_constraint::ActionType,
400
401 /// One line display name for the UI.
402 /// The max length of the display_name is 200 characters.
403 pub display_name: std::string::String,
404
405 /// Detailed information about this custom policy constraint.
406 /// The max length of the description is 2000 characters.
407 pub description: std::string::String,
408
409 /// Output only. The last time this custom constraint was updated. This
410 /// represents the last time that the `CreateCustomConstraint` or
411 /// `UpdateCustomConstraint` RPC was called
412 pub update_time: std::option::Option<wkt::Timestamp>,
413
414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
415}
416
417impl CustomConstraint {
418 /// Creates a new default instance.
419 pub fn new() -> Self {
420 std::default::Default::default()
421 }
422
423 /// Sets the value of [name][crate::model::CustomConstraint::name].
424 ///
425 /// # Example
426 /// ```ignore,no_run
427 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
428 /// let x = CustomConstraint::new().set_name("example");
429 /// ```
430 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
431 self.name = v.into();
432 self
433 }
434
435 /// Sets the value of [resource_types][crate::model::CustomConstraint::resource_types].
436 ///
437 /// # Example
438 /// ```ignore,no_run
439 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
440 /// let x = CustomConstraint::new().set_resource_types(["a", "b", "c"]);
441 /// ```
442 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
443 where
444 T: std::iter::IntoIterator<Item = V>,
445 V: std::convert::Into<std::string::String>,
446 {
447 use std::iter::Iterator;
448 self.resource_types = v.into_iter().map(|i| i.into()).collect();
449 self
450 }
451
452 /// Sets the value of [method_types][crate::model::CustomConstraint::method_types].
453 ///
454 /// # Example
455 /// ```ignore,no_run
456 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
457 /// use google_cloud_securityposture_v1::model::custom_constraint::MethodType;
458 /// let x = CustomConstraint::new().set_method_types([
459 /// MethodType::Create,
460 /// MethodType::Update,
461 /// MethodType::Delete,
462 /// ]);
463 /// ```
464 pub fn set_method_types<T, V>(mut self, v: T) -> Self
465 where
466 T: std::iter::IntoIterator<Item = V>,
467 V: std::convert::Into<crate::model::custom_constraint::MethodType>,
468 {
469 use std::iter::Iterator;
470 self.method_types = v.into_iter().map(|i| i.into()).collect();
471 self
472 }
473
474 /// Sets the value of [condition][crate::model::CustomConstraint::condition].
475 ///
476 /// # Example
477 /// ```ignore,no_run
478 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
479 /// let x = CustomConstraint::new().set_condition("example");
480 /// ```
481 pub fn set_condition<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
482 self.condition = v.into();
483 self
484 }
485
486 /// Sets the value of [action_type][crate::model::CustomConstraint::action_type].
487 ///
488 /// # Example
489 /// ```ignore,no_run
490 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
491 /// use google_cloud_securityposture_v1::model::custom_constraint::ActionType;
492 /// let x0 = CustomConstraint::new().set_action_type(ActionType::Allow);
493 /// let x1 = CustomConstraint::new().set_action_type(ActionType::Deny);
494 /// ```
495 pub fn set_action_type<T: std::convert::Into<crate::model::custom_constraint::ActionType>>(
496 mut self,
497 v: T,
498 ) -> Self {
499 self.action_type = v.into();
500 self
501 }
502
503 /// Sets the value of [display_name][crate::model::CustomConstraint::display_name].
504 ///
505 /// # Example
506 /// ```ignore,no_run
507 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
508 /// let x = CustomConstraint::new().set_display_name("example");
509 /// ```
510 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
511 self.display_name = v.into();
512 self
513 }
514
515 /// Sets the value of [description][crate::model::CustomConstraint::description].
516 ///
517 /// # Example
518 /// ```ignore,no_run
519 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
520 /// let x = CustomConstraint::new().set_description("example");
521 /// ```
522 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
523 self.description = v.into();
524 self
525 }
526
527 /// Sets the value of [update_time][crate::model::CustomConstraint::update_time].
528 ///
529 /// # Example
530 /// ```ignore,no_run
531 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
532 /// use wkt::Timestamp;
533 /// let x = CustomConstraint::new().set_update_time(Timestamp::default()/* use setters */);
534 /// ```
535 pub fn set_update_time<T>(mut self, v: T) -> Self
536 where
537 T: std::convert::Into<wkt::Timestamp>,
538 {
539 self.update_time = std::option::Option::Some(v.into());
540 self
541 }
542
543 /// Sets or clears the value of [update_time][crate::model::CustomConstraint::update_time].
544 ///
545 /// # Example
546 /// ```ignore,no_run
547 /// # use google_cloud_securityposture_v1::model::CustomConstraint;
548 /// use wkt::Timestamp;
549 /// let x = CustomConstraint::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
550 /// let x = CustomConstraint::new().set_or_clear_update_time(None::<Timestamp>);
551 /// ```
552 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
553 where
554 T: std::convert::Into<wkt::Timestamp>,
555 {
556 self.update_time = v.map(|x| x.into());
557 self
558 }
559}
560
561impl wkt::message::Message for CustomConstraint {
562 fn typename() -> &'static str {
563 "type.googleapis.com/google.cloud.securityposture.v1.CustomConstraint"
564 }
565}
566
567/// Defines additional types related to [CustomConstraint].
568pub mod custom_constraint {
569 #[allow(unused_imports)]
570 use super::*;
571
572 /// The operation for which this constraint will be applied. To apply this
573 /// constraint only when creating new VMs, the `method_types` should be
574 /// `CREATE` only. To apply this constraint when creating or deleting
575 /// VMs, the `method_types` should be `CREATE` and `DELETE`.
576 ///
577 /// `UPDATE` only custom constraints are not supported. Use `CREATE` or
578 /// `CREATE, UPDATE`.
579 ///
580 /// # Working with unknown values
581 ///
582 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
583 /// additional enum variants at any time. Adding new variants is not considered
584 /// a breaking change. Applications should write their code in anticipation of:
585 ///
586 /// - New values appearing in future releases of the client library, **and**
587 /// - New values received dynamically, without application changes.
588 ///
589 /// Please consult the [Working with enums] section in the user guide for some
590 /// guidelines.
591 ///
592 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
593 #[derive(Clone, Debug, PartialEq)]
594 #[non_exhaustive]
595 pub enum MethodType {
596 /// Unspecified. Results in an error.
597 Unspecified,
598 /// Constraint applied when creating the resource.
599 Create,
600 /// Constraint applied when updating the resource.
601 Update,
602 /// Constraint applied when deleting the resource.
603 /// Not supported yet.
604 Delete,
605 /// If set, the enum was initialized with an unknown value.
606 ///
607 /// Applications can examine the value using [MethodType::value] or
608 /// [MethodType::name].
609 UnknownValue(method_type::UnknownValue),
610 }
611
612 #[doc(hidden)]
613 pub mod method_type {
614 #[allow(unused_imports)]
615 use super::*;
616 #[derive(Clone, Debug, PartialEq)]
617 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
618 }
619
620 impl MethodType {
621 /// Gets the enum value.
622 ///
623 /// Returns `None` if the enum contains an unknown value deserialized from
624 /// the string representation of enums.
625 pub fn value(&self) -> std::option::Option<i32> {
626 match self {
627 Self::Unspecified => std::option::Option::Some(0),
628 Self::Create => std::option::Option::Some(1),
629 Self::Update => std::option::Option::Some(2),
630 Self::Delete => std::option::Option::Some(3),
631 Self::UnknownValue(u) => u.0.value(),
632 }
633 }
634
635 /// Gets the enum value as a string.
636 ///
637 /// Returns `None` if the enum contains an unknown value deserialized from
638 /// the integer representation of enums.
639 pub fn name(&self) -> std::option::Option<&str> {
640 match self {
641 Self::Unspecified => std::option::Option::Some("METHOD_TYPE_UNSPECIFIED"),
642 Self::Create => std::option::Option::Some("CREATE"),
643 Self::Update => std::option::Option::Some("UPDATE"),
644 Self::Delete => std::option::Option::Some("DELETE"),
645 Self::UnknownValue(u) => u.0.name(),
646 }
647 }
648 }
649
650 impl std::default::Default for MethodType {
651 fn default() -> Self {
652 use std::convert::From;
653 Self::from(0)
654 }
655 }
656
657 impl std::fmt::Display for MethodType {
658 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
659 wkt::internal::display_enum(f, self.name(), self.value())
660 }
661 }
662
663 impl std::convert::From<i32> for MethodType {
664 fn from(value: i32) -> Self {
665 match value {
666 0 => Self::Unspecified,
667 1 => Self::Create,
668 2 => Self::Update,
669 3 => Self::Delete,
670 _ => Self::UnknownValue(method_type::UnknownValue(
671 wkt::internal::UnknownEnumValue::Integer(value),
672 )),
673 }
674 }
675 }
676
677 impl std::convert::From<&str> for MethodType {
678 fn from(value: &str) -> Self {
679 use std::string::ToString;
680 match value {
681 "METHOD_TYPE_UNSPECIFIED" => Self::Unspecified,
682 "CREATE" => Self::Create,
683 "UPDATE" => Self::Update,
684 "DELETE" => Self::Delete,
685 _ => Self::UnknownValue(method_type::UnknownValue(
686 wkt::internal::UnknownEnumValue::String(value.to_string()),
687 )),
688 }
689 }
690 }
691
692 impl serde::ser::Serialize for MethodType {
693 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
694 where
695 S: serde::Serializer,
696 {
697 match self {
698 Self::Unspecified => serializer.serialize_i32(0),
699 Self::Create => serializer.serialize_i32(1),
700 Self::Update => serializer.serialize_i32(2),
701 Self::Delete => serializer.serialize_i32(3),
702 Self::UnknownValue(u) => u.0.serialize(serializer),
703 }
704 }
705 }
706
707 impl<'de> serde::de::Deserialize<'de> for MethodType {
708 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
709 where
710 D: serde::Deserializer<'de>,
711 {
712 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MethodType>::new(
713 ".google.cloud.securityposture.v1.CustomConstraint.MethodType",
714 ))
715 }
716 }
717
718 /// Allow or deny type.
719 ///
720 /// # Working with unknown values
721 ///
722 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
723 /// additional enum variants at any time. Adding new variants is not considered
724 /// a breaking change. Applications should write their code in anticipation of:
725 ///
726 /// - New values appearing in future releases of the client library, **and**
727 /// - New values received dynamically, without application changes.
728 ///
729 /// Please consult the [Working with enums] section in the user guide for some
730 /// guidelines.
731 ///
732 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
733 #[derive(Clone, Debug, PartialEq)]
734 #[non_exhaustive]
735 pub enum ActionType {
736 /// Unspecified. Results in an error.
737 Unspecified,
738 /// Allowed action type.
739 Allow,
740 /// Deny action type.
741 Deny,
742 /// If set, the enum was initialized with an unknown value.
743 ///
744 /// Applications can examine the value using [ActionType::value] or
745 /// [ActionType::name].
746 UnknownValue(action_type::UnknownValue),
747 }
748
749 #[doc(hidden)]
750 pub mod action_type {
751 #[allow(unused_imports)]
752 use super::*;
753 #[derive(Clone, Debug, PartialEq)]
754 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
755 }
756
757 impl ActionType {
758 /// Gets the enum value.
759 ///
760 /// Returns `None` if the enum contains an unknown value deserialized from
761 /// the string representation of enums.
762 pub fn value(&self) -> std::option::Option<i32> {
763 match self {
764 Self::Unspecified => std::option::Option::Some(0),
765 Self::Allow => std::option::Option::Some(1),
766 Self::Deny => std::option::Option::Some(2),
767 Self::UnknownValue(u) => u.0.value(),
768 }
769 }
770
771 /// Gets the enum value as a string.
772 ///
773 /// Returns `None` if the enum contains an unknown value deserialized from
774 /// the integer representation of enums.
775 pub fn name(&self) -> std::option::Option<&str> {
776 match self {
777 Self::Unspecified => std::option::Option::Some("ACTION_TYPE_UNSPECIFIED"),
778 Self::Allow => std::option::Option::Some("ALLOW"),
779 Self::Deny => std::option::Option::Some("DENY"),
780 Self::UnknownValue(u) => u.0.name(),
781 }
782 }
783 }
784
785 impl std::default::Default for ActionType {
786 fn default() -> Self {
787 use std::convert::From;
788 Self::from(0)
789 }
790 }
791
792 impl std::fmt::Display for ActionType {
793 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
794 wkt::internal::display_enum(f, self.name(), self.value())
795 }
796 }
797
798 impl std::convert::From<i32> for ActionType {
799 fn from(value: i32) -> Self {
800 match value {
801 0 => Self::Unspecified,
802 1 => Self::Allow,
803 2 => Self::Deny,
804 _ => Self::UnknownValue(action_type::UnknownValue(
805 wkt::internal::UnknownEnumValue::Integer(value),
806 )),
807 }
808 }
809 }
810
811 impl std::convert::From<&str> for ActionType {
812 fn from(value: &str) -> Self {
813 use std::string::ToString;
814 match value {
815 "ACTION_TYPE_UNSPECIFIED" => Self::Unspecified,
816 "ALLOW" => Self::Allow,
817 "DENY" => Self::Deny,
818 _ => Self::UnknownValue(action_type::UnknownValue(
819 wkt::internal::UnknownEnumValue::String(value.to_string()),
820 )),
821 }
822 }
823 }
824
825 impl serde::ser::Serialize for ActionType {
826 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
827 where
828 S: serde::Serializer,
829 {
830 match self {
831 Self::Unspecified => serializer.serialize_i32(0),
832 Self::Allow => serializer.serialize_i32(1),
833 Self::Deny => serializer.serialize_i32(2),
834 Self::UnknownValue(u) => u.0.serialize(serializer),
835 }
836 }
837 }
838
839 impl<'de> serde::de::Deserialize<'de> for ActionType {
840 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
841 where
842 D: serde::Deserializer<'de>,
843 {
844 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ActionType>::new(
845 ".google.cloud.securityposture.v1.CustomConstraint.ActionType",
846 ))
847 }
848 }
849}
850
851/// Message for Org Policy Canned Constraint.
852#[derive(Clone, Default, PartialEq)]
853#[non_exhaustive]
854pub struct OrgPolicyConstraint {
855 /// Required. Org Policy Canned Constraint id.
856 pub canned_constraint_id: std::string::String,
857
858 /// Required. Org PolicySpec rules.
859 pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
860
861 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
862}
863
864impl OrgPolicyConstraint {
865 /// Creates a new default instance.
866 pub fn new() -> Self {
867 std::default::Default::default()
868 }
869
870 /// Sets the value of [canned_constraint_id][crate::model::OrgPolicyConstraint::canned_constraint_id].
871 ///
872 /// # Example
873 /// ```ignore,no_run
874 /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraint;
875 /// let x = OrgPolicyConstraint::new().set_canned_constraint_id("example");
876 /// ```
877 pub fn set_canned_constraint_id<T: std::convert::Into<std::string::String>>(
878 mut self,
879 v: T,
880 ) -> Self {
881 self.canned_constraint_id = v.into();
882 self
883 }
884
885 /// Sets the value of [policy_rules][crate::model::OrgPolicyConstraint::policy_rules].
886 ///
887 /// # Example
888 /// ```ignore,no_run
889 /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraint;
890 /// use google_cloud_securityposture_v1::model::PolicyRule;
891 /// let x = OrgPolicyConstraint::new()
892 /// .set_policy_rules([
893 /// PolicyRule::default()/* use setters */,
894 /// PolicyRule::default()/* use (different) setters */,
895 /// ]);
896 /// ```
897 pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
898 where
899 T: std::iter::IntoIterator<Item = V>,
900 V: std::convert::Into<crate::model::PolicyRule>,
901 {
902 use std::iter::Iterator;
903 self.policy_rules = v.into_iter().map(|i| i.into()).collect();
904 self
905 }
906}
907
908impl wkt::message::Message for OrgPolicyConstraint {
909 fn typename() -> &'static str {
910 "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraint"
911 }
912}
913
914/// Message for Org Policy Custom Constraint.
915#[derive(Clone, Default, PartialEq)]
916#[non_exhaustive]
917pub struct OrgPolicyConstraintCustom {
918 /// Required. Org Policy Custom Constraint.
919 pub custom_constraint: std::option::Option<crate::model::CustomConstraint>,
920
921 /// Required. Org Policyspec rules.
922 pub policy_rules: std::vec::Vec<crate::model::PolicyRule>,
923
924 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
925}
926
927impl OrgPolicyConstraintCustom {
928 /// Creates a new default instance.
929 pub fn new() -> Self {
930 std::default::Default::default()
931 }
932
933 /// Sets the value of [custom_constraint][crate::model::OrgPolicyConstraintCustom::custom_constraint].
934 ///
935 /// # Example
936 /// ```ignore,no_run
937 /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
938 /// use google_cloud_securityposture_v1::model::CustomConstraint;
939 /// let x = OrgPolicyConstraintCustom::new().set_custom_constraint(CustomConstraint::default()/* use setters */);
940 /// ```
941 pub fn set_custom_constraint<T>(mut self, v: T) -> Self
942 where
943 T: std::convert::Into<crate::model::CustomConstraint>,
944 {
945 self.custom_constraint = std::option::Option::Some(v.into());
946 self
947 }
948
949 /// Sets or clears the value of [custom_constraint][crate::model::OrgPolicyConstraintCustom::custom_constraint].
950 ///
951 /// # Example
952 /// ```ignore,no_run
953 /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
954 /// use google_cloud_securityposture_v1::model::CustomConstraint;
955 /// let x = OrgPolicyConstraintCustom::new().set_or_clear_custom_constraint(Some(CustomConstraint::default()/* use setters */));
956 /// let x = OrgPolicyConstraintCustom::new().set_or_clear_custom_constraint(None::<CustomConstraint>);
957 /// ```
958 pub fn set_or_clear_custom_constraint<T>(mut self, v: std::option::Option<T>) -> Self
959 where
960 T: std::convert::Into<crate::model::CustomConstraint>,
961 {
962 self.custom_constraint = v.map(|x| x.into());
963 self
964 }
965
966 /// Sets the value of [policy_rules][crate::model::OrgPolicyConstraintCustom::policy_rules].
967 ///
968 /// # Example
969 /// ```ignore,no_run
970 /// # use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
971 /// use google_cloud_securityposture_v1::model::PolicyRule;
972 /// let x = OrgPolicyConstraintCustom::new()
973 /// .set_policy_rules([
974 /// PolicyRule::default()/* use setters */,
975 /// PolicyRule::default()/* use (different) setters */,
976 /// ]);
977 /// ```
978 pub fn set_policy_rules<T, V>(mut self, v: T) -> Self
979 where
980 T: std::iter::IntoIterator<Item = V>,
981 V: std::convert::Into<crate::model::PolicyRule>,
982 {
983 use std::iter::Iterator;
984 self.policy_rules = v.into_iter().map(|i| i.into()).collect();
985 self
986 }
987}
988
989impl wkt::message::Message for OrgPolicyConstraintCustom {
990 fn typename() -> &'static str {
991 "type.googleapis.com/google.cloud.securityposture.v1.OrgPolicyConstraintCustom"
992 }
993}
994
995/// Represents the metadata of the long-running operation.
996#[derive(Clone, Default, PartialEq)]
997#[non_exhaustive]
998pub struct OperationMetadata {
999 /// Output only. The time the operation was created.
1000 pub create_time: std::option::Option<wkt::Timestamp>,
1001
1002 /// Output only. The time the operation finished running.
1003 pub end_time: std::option::Option<wkt::Timestamp>,
1004
1005 /// Output only. Server-defined resource path for the target of the operation.
1006 pub target: std::string::String,
1007
1008 /// Output only. Name of the verb executed by the operation.
1009 pub verb: std::string::String,
1010
1011 /// Output only. Human-readable status of the operation, if any.
1012 pub status_message: std::string::String,
1013
1014 /// Output only. Identifies whether the user has requested cancellation
1015 /// of the operation. Operations that have been cancelled successfully
1016 /// have [Operation.error][] value with a
1017 /// [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to
1018 /// `Code.CANCELLED`.
1019 pub requested_cancellation: bool,
1020
1021 /// Output only. API version used to start the operation.
1022 pub api_version: std::string::String,
1023
1024 /// Output only. This is a output only optional field which will be filled only
1025 /// in cases where PostureDeployments enter failure states like UPDATE_FAILED
1026 /// or CREATE_FAILED or DELETE_FAILED.
1027 pub error_message: std::string::String,
1028
1029 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1030}
1031
1032impl OperationMetadata {
1033 /// Creates a new default instance.
1034 pub fn new() -> Self {
1035 std::default::Default::default()
1036 }
1037
1038 /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
1039 ///
1040 /// # Example
1041 /// ```ignore,no_run
1042 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1043 /// use wkt::Timestamp;
1044 /// let x = OperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
1045 /// ```
1046 pub fn set_create_time<T>(mut self, v: T) -> Self
1047 where
1048 T: std::convert::Into<wkt::Timestamp>,
1049 {
1050 self.create_time = std::option::Option::Some(v.into());
1051 self
1052 }
1053
1054 /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
1055 ///
1056 /// # Example
1057 /// ```ignore,no_run
1058 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1059 /// use wkt::Timestamp;
1060 /// let x = OperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1061 /// let x = OperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
1062 /// ```
1063 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1064 where
1065 T: std::convert::Into<wkt::Timestamp>,
1066 {
1067 self.create_time = v.map(|x| x.into());
1068 self
1069 }
1070
1071 /// Sets the value of [end_time][crate::model::OperationMetadata::end_time].
1072 ///
1073 /// # Example
1074 /// ```ignore,no_run
1075 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1076 /// use wkt::Timestamp;
1077 /// let x = OperationMetadata::new().set_end_time(Timestamp::default()/* use setters */);
1078 /// ```
1079 pub fn set_end_time<T>(mut self, v: T) -> Self
1080 where
1081 T: std::convert::Into<wkt::Timestamp>,
1082 {
1083 self.end_time = std::option::Option::Some(v.into());
1084 self
1085 }
1086
1087 /// Sets or clears the value of [end_time][crate::model::OperationMetadata::end_time].
1088 ///
1089 /// # Example
1090 /// ```ignore,no_run
1091 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1092 /// use wkt::Timestamp;
1093 /// let x = OperationMetadata::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
1094 /// let x = OperationMetadata::new().set_or_clear_end_time(None::<Timestamp>);
1095 /// ```
1096 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
1097 where
1098 T: std::convert::Into<wkt::Timestamp>,
1099 {
1100 self.end_time = v.map(|x| x.into());
1101 self
1102 }
1103
1104 /// Sets the value of [target][crate::model::OperationMetadata::target].
1105 ///
1106 /// # Example
1107 /// ```ignore,no_run
1108 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1109 /// let x = OperationMetadata::new().set_target("example");
1110 /// ```
1111 pub fn set_target<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1112 self.target = v.into();
1113 self
1114 }
1115
1116 /// Sets the value of [verb][crate::model::OperationMetadata::verb].
1117 ///
1118 /// # Example
1119 /// ```ignore,no_run
1120 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1121 /// let x = OperationMetadata::new().set_verb("example");
1122 /// ```
1123 pub fn set_verb<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1124 self.verb = v.into();
1125 self
1126 }
1127
1128 /// Sets the value of [status_message][crate::model::OperationMetadata::status_message].
1129 ///
1130 /// # Example
1131 /// ```ignore,no_run
1132 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1133 /// let x = OperationMetadata::new().set_status_message("example");
1134 /// ```
1135 pub fn set_status_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1136 self.status_message = v.into();
1137 self
1138 }
1139
1140 /// Sets the value of [requested_cancellation][crate::model::OperationMetadata::requested_cancellation].
1141 ///
1142 /// # Example
1143 /// ```ignore,no_run
1144 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1145 /// let x = OperationMetadata::new().set_requested_cancellation(true);
1146 /// ```
1147 pub fn set_requested_cancellation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1148 self.requested_cancellation = v.into();
1149 self
1150 }
1151
1152 /// Sets the value of [api_version][crate::model::OperationMetadata::api_version].
1153 ///
1154 /// # Example
1155 /// ```ignore,no_run
1156 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1157 /// let x = OperationMetadata::new().set_api_version("example");
1158 /// ```
1159 pub fn set_api_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1160 self.api_version = v.into();
1161 self
1162 }
1163
1164 /// Sets the value of [error_message][crate::model::OperationMetadata::error_message].
1165 ///
1166 /// # Example
1167 /// ```ignore,no_run
1168 /// # use google_cloud_securityposture_v1::model::OperationMetadata;
1169 /// let x = OperationMetadata::new().set_error_message("example");
1170 /// ```
1171 pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1172 self.error_message = v.into();
1173 self
1174 }
1175}
1176
1177impl wkt::message::Message for OperationMetadata {
1178 fn typename() -> &'static str {
1179 "type.googleapis.com/google.cloud.securityposture.v1.OperationMetadata"
1180 }
1181}
1182
1183/// Postures
1184/// Definition of a Posture.
1185#[derive(Clone, Default, PartialEq)]
1186#[non_exhaustive]
1187pub struct Posture {
1188 /// Required. Identifier. The name of this Posture resource, in the format of
1189 /// organizations/{org_id}/locations/{location_id}/postures/{posture}.
1190 pub name: std::string::String,
1191
1192 /// Required. State of Posture resource.
1193 pub state: crate::model::posture::State,
1194
1195 /// Output only. Immutable. The revision ID of the posture.
1196 /// The format is an 8-character hexadecimal string.
1197 /// <https://google.aip.dev/162>
1198 pub revision_id: std::string::String,
1199
1200 /// Output only. The timestamp that the posture was created.
1201 pub create_time: std::option::Option<wkt::Timestamp>,
1202
1203 /// Output only. The timestamp that the posture was updated.
1204 pub update_time: std::option::Option<wkt::Timestamp>,
1205
1206 /// Optional. User provided description of the posture.
1207 pub description: std::string::String,
1208
1209 /// Required. List of Policy sets.
1210 pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
1211
1212 /// Optional. An opaque tag indicating the current version of the Posture, used
1213 /// for concurrency control. When the `Posture` is returned from either a
1214 /// `GetPosture` or a `ListPostures` request, this `etag` indicates the version
1215 /// of the current `Posture` to use when executing a read-modify-write loop.
1216 ///
1217 /// When the `Posture` is used in a `UpdatePosture` method, use the `etag`
1218 /// value that was returned from a `GetPosture` request as part of a
1219 /// read-modify-write loop for concurrency control. Not setting the `etag` in a
1220 /// `UpdatePosture` request will result in an unconditional write of the
1221 /// `Posture`.
1222 pub etag: std::string::String,
1223
1224 /// Optional. User annotations. These attributes can only be set and used by
1225 /// the user, and not by Google Security Postures.
1226 /// .
1227 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
1228
1229 /// Output only. Whether or not this Posture is in the process of being
1230 /// updated.
1231 pub reconciling: bool,
1232
1233 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1234}
1235
1236impl Posture {
1237 /// Creates a new default instance.
1238 pub fn new() -> Self {
1239 std::default::Default::default()
1240 }
1241
1242 /// Sets the value of [name][crate::model::Posture::name].
1243 ///
1244 /// # Example
1245 /// ```ignore,no_run
1246 /// # use google_cloud_securityposture_v1::model::Posture;
1247 /// # let organization_id = "organization_id";
1248 /// # let location_id = "location_id";
1249 /// # let posture_id = "posture_id";
1250 /// let x = Posture::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
1251 /// ```
1252 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1253 self.name = v.into();
1254 self
1255 }
1256
1257 /// Sets the value of [state][crate::model::Posture::state].
1258 ///
1259 /// # Example
1260 /// ```ignore,no_run
1261 /// # use google_cloud_securityposture_v1::model::Posture;
1262 /// use google_cloud_securityposture_v1::model::posture::State;
1263 /// let x0 = Posture::new().set_state(State::Deprecated);
1264 /// let x1 = Posture::new().set_state(State::Draft);
1265 /// let x2 = Posture::new().set_state(State::Active);
1266 /// ```
1267 pub fn set_state<T: std::convert::Into<crate::model::posture::State>>(mut self, v: T) -> Self {
1268 self.state = v.into();
1269 self
1270 }
1271
1272 /// Sets the value of [revision_id][crate::model::Posture::revision_id].
1273 ///
1274 /// # Example
1275 /// ```ignore,no_run
1276 /// # use google_cloud_securityposture_v1::model::Posture;
1277 /// let x = Posture::new().set_revision_id("example");
1278 /// ```
1279 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1280 self.revision_id = v.into();
1281 self
1282 }
1283
1284 /// Sets the value of [create_time][crate::model::Posture::create_time].
1285 ///
1286 /// # Example
1287 /// ```ignore,no_run
1288 /// # use google_cloud_securityposture_v1::model::Posture;
1289 /// use wkt::Timestamp;
1290 /// let x = Posture::new().set_create_time(Timestamp::default()/* use setters */);
1291 /// ```
1292 pub fn set_create_time<T>(mut self, v: T) -> Self
1293 where
1294 T: std::convert::Into<wkt::Timestamp>,
1295 {
1296 self.create_time = std::option::Option::Some(v.into());
1297 self
1298 }
1299
1300 /// Sets or clears the value of [create_time][crate::model::Posture::create_time].
1301 ///
1302 /// # Example
1303 /// ```ignore,no_run
1304 /// # use google_cloud_securityposture_v1::model::Posture;
1305 /// use wkt::Timestamp;
1306 /// let x = Posture::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
1307 /// let x = Posture::new().set_or_clear_create_time(None::<Timestamp>);
1308 /// ```
1309 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
1310 where
1311 T: std::convert::Into<wkt::Timestamp>,
1312 {
1313 self.create_time = v.map(|x| x.into());
1314 self
1315 }
1316
1317 /// Sets the value of [update_time][crate::model::Posture::update_time].
1318 ///
1319 /// # Example
1320 /// ```ignore,no_run
1321 /// # use google_cloud_securityposture_v1::model::Posture;
1322 /// use wkt::Timestamp;
1323 /// let x = Posture::new().set_update_time(Timestamp::default()/* use setters */);
1324 /// ```
1325 pub fn set_update_time<T>(mut self, v: T) -> Self
1326 where
1327 T: std::convert::Into<wkt::Timestamp>,
1328 {
1329 self.update_time = std::option::Option::Some(v.into());
1330 self
1331 }
1332
1333 /// Sets or clears the value of [update_time][crate::model::Posture::update_time].
1334 ///
1335 /// # Example
1336 /// ```ignore,no_run
1337 /// # use google_cloud_securityposture_v1::model::Posture;
1338 /// use wkt::Timestamp;
1339 /// let x = Posture::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1340 /// let x = Posture::new().set_or_clear_update_time(None::<Timestamp>);
1341 /// ```
1342 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1343 where
1344 T: std::convert::Into<wkt::Timestamp>,
1345 {
1346 self.update_time = v.map(|x| x.into());
1347 self
1348 }
1349
1350 /// Sets the value of [description][crate::model::Posture::description].
1351 ///
1352 /// # Example
1353 /// ```ignore,no_run
1354 /// # use google_cloud_securityposture_v1::model::Posture;
1355 /// let x = Posture::new().set_description("example");
1356 /// ```
1357 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1358 self.description = v.into();
1359 self
1360 }
1361
1362 /// Sets the value of [policy_sets][crate::model::Posture::policy_sets].
1363 ///
1364 /// # Example
1365 /// ```ignore,no_run
1366 /// # use google_cloud_securityposture_v1::model::Posture;
1367 /// use google_cloud_securityposture_v1::model::PolicySet;
1368 /// let x = Posture::new()
1369 /// .set_policy_sets([
1370 /// PolicySet::default()/* use setters */,
1371 /// PolicySet::default()/* use (different) setters */,
1372 /// ]);
1373 /// ```
1374 pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
1375 where
1376 T: std::iter::IntoIterator<Item = V>,
1377 V: std::convert::Into<crate::model::PolicySet>,
1378 {
1379 use std::iter::Iterator;
1380 self.policy_sets = v.into_iter().map(|i| i.into()).collect();
1381 self
1382 }
1383
1384 /// Sets the value of [etag][crate::model::Posture::etag].
1385 ///
1386 /// # Example
1387 /// ```ignore,no_run
1388 /// # use google_cloud_securityposture_v1::model::Posture;
1389 /// let x = Posture::new().set_etag("example");
1390 /// ```
1391 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1392 self.etag = v.into();
1393 self
1394 }
1395
1396 /// Sets the value of [annotations][crate::model::Posture::annotations].
1397 ///
1398 /// # Example
1399 /// ```ignore,no_run
1400 /// # use google_cloud_securityposture_v1::model::Posture;
1401 /// let x = Posture::new().set_annotations([
1402 /// ("key0", "abc"),
1403 /// ("key1", "xyz"),
1404 /// ]);
1405 /// ```
1406 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1407 where
1408 T: std::iter::IntoIterator<Item = (K, V)>,
1409 K: std::convert::Into<std::string::String>,
1410 V: std::convert::Into<std::string::String>,
1411 {
1412 use std::iter::Iterator;
1413 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1414 self
1415 }
1416
1417 /// Sets the value of [reconciling][crate::model::Posture::reconciling].
1418 ///
1419 /// # Example
1420 /// ```ignore,no_run
1421 /// # use google_cloud_securityposture_v1::model::Posture;
1422 /// let x = Posture::new().set_reconciling(true);
1423 /// ```
1424 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1425 self.reconciling = v.into();
1426 self
1427 }
1428}
1429
1430impl wkt::message::Message for Posture {
1431 fn typename() -> &'static str {
1432 "type.googleapis.com/google.cloud.securityposture.v1.Posture"
1433 }
1434}
1435
1436/// Defines additional types related to [Posture].
1437pub mod posture {
1438 #[allow(unused_imports)]
1439 use super::*;
1440
1441 /// State of a Posture.
1442 ///
1443 /// # Working with unknown values
1444 ///
1445 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1446 /// additional enum variants at any time. Adding new variants is not considered
1447 /// a breaking change. Applications should write their code in anticipation of:
1448 ///
1449 /// - New values appearing in future releases of the client library, **and**
1450 /// - New values received dynamically, without application changes.
1451 ///
1452 /// Please consult the [Working with enums] section in the user guide for some
1453 /// guidelines.
1454 ///
1455 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1456 #[derive(Clone, Debug, PartialEq)]
1457 #[non_exhaustive]
1458 pub enum State {
1459 /// Unspecified operation state.
1460 Unspecified,
1461 /// The Posture is marked deprecated when it is not in use by the user.
1462 Deprecated,
1463 /// The Posture is created successfully but is not yet ready for usage.
1464 Draft,
1465 /// The Posture state is active. Ready for use/deployments.
1466 Active,
1467 /// If set, the enum was initialized with an unknown value.
1468 ///
1469 /// Applications can examine the value using [State::value] or
1470 /// [State::name].
1471 UnknownValue(state::UnknownValue),
1472 }
1473
1474 #[doc(hidden)]
1475 pub mod state {
1476 #[allow(unused_imports)]
1477 use super::*;
1478 #[derive(Clone, Debug, PartialEq)]
1479 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1480 }
1481
1482 impl State {
1483 /// Gets the enum value.
1484 ///
1485 /// Returns `None` if the enum contains an unknown value deserialized from
1486 /// the string representation of enums.
1487 pub fn value(&self) -> std::option::Option<i32> {
1488 match self {
1489 Self::Unspecified => std::option::Option::Some(0),
1490 Self::Deprecated => std::option::Option::Some(1),
1491 Self::Draft => std::option::Option::Some(2),
1492 Self::Active => std::option::Option::Some(3),
1493 Self::UnknownValue(u) => u.0.value(),
1494 }
1495 }
1496
1497 /// Gets the enum value as a string.
1498 ///
1499 /// Returns `None` if the enum contains an unknown value deserialized from
1500 /// the integer representation of enums.
1501 pub fn name(&self) -> std::option::Option<&str> {
1502 match self {
1503 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
1504 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
1505 Self::Draft => std::option::Option::Some("DRAFT"),
1506 Self::Active => std::option::Option::Some("ACTIVE"),
1507 Self::UnknownValue(u) => u.0.name(),
1508 }
1509 }
1510 }
1511
1512 impl std::default::Default for State {
1513 fn default() -> Self {
1514 use std::convert::From;
1515 Self::from(0)
1516 }
1517 }
1518
1519 impl std::fmt::Display for State {
1520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1521 wkt::internal::display_enum(f, self.name(), self.value())
1522 }
1523 }
1524
1525 impl std::convert::From<i32> for State {
1526 fn from(value: i32) -> Self {
1527 match value {
1528 0 => Self::Unspecified,
1529 1 => Self::Deprecated,
1530 2 => Self::Draft,
1531 3 => Self::Active,
1532 _ => Self::UnknownValue(state::UnknownValue(
1533 wkt::internal::UnknownEnumValue::Integer(value),
1534 )),
1535 }
1536 }
1537 }
1538
1539 impl std::convert::From<&str> for State {
1540 fn from(value: &str) -> Self {
1541 use std::string::ToString;
1542 match value {
1543 "STATE_UNSPECIFIED" => Self::Unspecified,
1544 "DEPRECATED" => Self::Deprecated,
1545 "DRAFT" => Self::Draft,
1546 "ACTIVE" => Self::Active,
1547 _ => Self::UnknownValue(state::UnknownValue(
1548 wkt::internal::UnknownEnumValue::String(value.to_string()),
1549 )),
1550 }
1551 }
1552 }
1553
1554 impl serde::ser::Serialize for State {
1555 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1556 where
1557 S: serde::Serializer,
1558 {
1559 match self {
1560 Self::Unspecified => serializer.serialize_i32(0),
1561 Self::Deprecated => serializer.serialize_i32(1),
1562 Self::Draft => serializer.serialize_i32(2),
1563 Self::Active => serializer.serialize_i32(3),
1564 Self::UnknownValue(u) => u.0.serialize(serializer),
1565 }
1566 }
1567 }
1568
1569 impl<'de> serde::de::Deserialize<'de> for State {
1570 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1571 where
1572 D: serde::Deserializer<'de>,
1573 {
1574 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
1575 ".google.cloud.securityposture.v1.Posture.State",
1576 ))
1577 }
1578 }
1579}
1580
1581/// PolicySet representation.
1582#[derive(Clone, Default, PartialEq)]
1583#[non_exhaustive]
1584pub struct PolicySet {
1585 /// Required. ID of the Policy set.
1586 pub policy_set_id: std::string::String,
1587
1588 /// Optional. Description of the Policy set.
1589 pub description: std::string::String,
1590
1591 /// Required. List of policies.
1592 pub policies: std::vec::Vec<crate::model::Policy>,
1593
1594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1595}
1596
1597impl PolicySet {
1598 /// Creates a new default instance.
1599 pub fn new() -> Self {
1600 std::default::Default::default()
1601 }
1602
1603 /// Sets the value of [policy_set_id][crate::model::PolicySet::policy_set_id].
1604 ///
1605 /// # Example
1606 /// ```ignore,no_run
1607 /// # use google_cloud_securityposture_v1::model::PolicySet;
1608 /// let x = PolicySet::new().set_policy_set_id("example");
1609 /// ```
1610 pub fn set_policy_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1611 self.policy_set_id = v.into();
1612 self
1613 }
1614
1615 /// Sets the value of [description][crate::model::PolicySet::description].
1616 ///
1617 /// # Example
1618 /// ```ignore,no_run
1619 /// # use google_cloud_securityposture_v1::model::PolicySet;
1620 /// let x = PolicySet::new().set_description("example");
1621 /// ```
1622 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1623 self.description = v.into();
1624 self
1625 }
1626
1627 /// Sets the value of [policies][crate::model::PolicySet::policies].
1628 ///
1629 /// # Example
1630 /// ```ignore,no_run
1631 /// # use google_cloud_securityposture_v1::model::PolicySet;
1632 /// use google_cloud_securityposture_v1::model::Policy;
1633 /// let x = PolicySet::new()
1634 /// .set_policies([
1635 /// Policy::default()/* use setters */,
1636 /// Policy::default()/* use (different) setters */,
1637 /// ]);
1638 /// ```
1639 pub fn set_policies<T, V>(mut self, v: T) -> Self
1640 where
1641 T: std::iter::IntoIterator<Item = V>,
1642 V: std::convert::Into<crate::model::Policy>,
1643 {
1644 use std::iter::Iterator;
1645 self.policies = v.into_iter().map(|i| i.into()).collect();
1646 self
1647 }
1648}
1649
1650impl wkt::message::Message for PolicySet {
1651 fn typename() -> &'static str {
1652 "type.googleapis.com/google.cloud.securityposture.v1.PolicySet"
1653 }
1654}
1655
1656/// Policy representation.
1657#[derive(Clone, Default, PartialEq)]
1658#[non_exhaustive]
1659pub struct Policy {
1660 /// Required. ID of the Policy that is user generated, immutable and unique
1661 /// within the scope of a policy set.
1662 pub policy_id: std::string::String,
1663
1664 /// Optional. Contains list of mapping for a Policy to a standard and control.
1665 pub compliance_standards: std::vec::Vec<crate::model::policy::ComplianceStandard>,
1666
1667 /// Required. Constraint details.
1668 pub constraint: std::option::Option<crate::model::Constraint>,
1669
1670 /// Optional. Description of the Policy.
1671 pub description: std::string::String,
1672
1673 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1674}
1675
1676impl Policy {
1677 /// Creates a new default instance.
1678 pub fn new() -> Self {
1679 std::default::Default::default()
1680 }
1681
1682 /// Sets the value of [policy_id][crate::model::Policy::policy_id].
1683 ///
1684 /// # Example
1685 /// ```ignore,no_run
1686 /// # use google_cloud_securityposture_v1::model::Policy;
1687 /// let x = Policy::new().set_policy_id("example");
1688 /// ```
1689 pub fn set_policy_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1690 self.policy_id = v.into();
1691 self
1692 }
1693
1694 /// Sets the value of [compliance_standards][crate::model::Policy::compliance_standards].
1695 ///
1696 /// # Example
1697 /// ```ignore,no_run
1698 /// # use google_cloud_securityposture_v1::model::Policy;
1699 /// use google_cloud_securityposture_v1::model::policy::ComplianceStandard;
1700 /// let x = Policy::new()
1701 /// .set_compliance_standards([
1702 /// ComplianceStandard::default()/* use setters */,
1703 /// ComplianceStandard::default()/* use (different) setters */,
1704 /// ]);
1705 /// ```
1706 pub fn set_compliance_standards<T, V>(mut self, v: T) -> Self
1707 where
1708 T: std::iter::IntoIterator<Item = V>,
1709 V: std::convert::Into<crate::model::policy::ComplianceStandard>,
1710 {
1711 use std::iter::Iterator;
1712 self.compliance_standards = v.into_iter().map(|i| i.into()).collect();
1713 self
1714 }
1715
1716 /// Sets the value of [constraint][crate::model::Policy::constraint].
1717 ///
1718 /// # Example
1719 /// ```ignore,no_run
1720 /// # use google_cloud_securityposture_v1::model::Policy;
1721 /// use google_cloud_securityposture_v1::model::Constraint;
1722 /// let x = Policy::new().set_constraint(Constraint::default()/* use setters */);
1723 /// ```
1724 pub fn set_constraint<T>(mut self, v: T) -> Self
1725 where
1726 T: std::convert::Into<crate::model::Constraint>,
1727 {
1728 self.constraint = std::option::Option::Some(v.into());
1729 self
1730 }
1731
1732 /// Sets or clears the value of [constraint][crate::model::Policy::constraint].
1733 ///
1734 /// # Example
1735 /// ```ignore,no_run
1736 /// # use google_cloud_securityposture_v1::model::Policy;
1737 /// use google_cloud_securityposture_v1::model::Constraint;
1738 /// let x = Policy::new().set_or_clear_constraint(Some(Constraint::default()/* use setters */));
1739 /// let x = Policy::new().set_or_clear_constraint(None::<Constraint>);
1740 /// ```
1741 pub fn set_or_clear_constraint<T>(mut self, v: std::option::Option<T>) -> Self
1742 where
1743 T: std::convert::Into<crate::model::Constraint>,
1744 {
1745 self.constraint = v.map(|x| x.into());
1746 self
1747 }
1748
1749 /// Sets the value of [description][crate::model::Policy::description].
1750 ///
1751 /// # Example
1752 /// ```ignore,no_run
1753 /// # use google_cloud_securityposture_v1::model::Policy;
1754 /// let x = Policy::new().set_description("example");
1755 /// ```
1756 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1757 self.description = v.into();
1758 self
1759 }
1760}
1761
1762impl wkt::message::Message for Policy {
1763 fn typename() -> &'static str {
1764 "type.googleapis.com/google.cloud.securityposture.v1.Policy"
1765 }
1766}
1767
1768/// Defines additional types related to [Policy].
1769pub mod policy {
1770 #[allow(unused_imports)]
1771 use super::*;
1772
1773 /// Mapping for a Policy to standard and control.
1774 #[derive(Clone, Default, PartialEq)]
1775 #[non_exhaustive]
1776 pub struct ComplianceStandard {
1777 /// Optional. The compliance standard that the Policy maps to, e.g.: CIS-2.0.
1778 pub standard: std::string::String,
1779
1780 /// Optional. Control mapping provided by user for this Policy. e.g.: 1.5.
1781 pub control: std::string::String,
1782
1783 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1784 }
1785
1786 impl ComplianceStandard {
1787 /// Creates a new default instance.
1788 pub fn new() -> Self {
1789 std::default::Default::default()
1790 }
1791
1792 /// Sets the value of [standard][crate::model::policy::ComplianceStandard::standard].
1793 ///
1794 /// # Example
1795 /// ```ignore,no_run
1796 /// # use google_cloud_securityposture_v1::model::policy::ComplianceStandard;
1797 /// let x = ComplianceStandard::new().set_standard("example");
1798 /// ```
1799 pub fn set_standard<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1800 self.standard = v.into();
1801 self
1802 }
1803
1804 /// Sets the value of [control][crate::model::policy::ComplianceStandard::control].
1805 ///
1806 /// # Example
1807 /// ```ignore,no_run
1808 /// # use google_cloud_securityposture_v1::model::policy::ComplianceStandard;
1809 /// let x = ComplianceStandard::new().set_control("example");
1810 /// ```
1811 pub fn set_control<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1812 self.control = v.into();
1813 self
1814 }
1815 }
1816
1817 impl wkt::message::Message for ComplianceStandard {
1818 fn typename() -> &'static str {
1819 "type.googleapis.com/google.cloud.securityposture.v1.Policy.ComplianceStandard"
1820 }
1821 }
1822}
1823
1824/// Representation of a Constraint.
1825#[derive(Clone, Default, PartialEq)]
1826#[non_exhaustive]
1827pub struct Constraint {
1828 #[allow(missing_docs)]
1829 pub implementation: std::option::Option<crate::model::constraint::Implementation>,
1830
1831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1832}
1833
1834impl Constraint {
1835 /// Creates a new default instance.
1836 pub fn new() -> Self {
1837 std::default::Default::default()
1838 }
1839
1840 /// Sets the value of [implementation][crate::model::Constraint::implementation].
1841 ///
1842 /// Note that all the setters affecting `implementation` are mutually
1843 /// exclusive.
1844 ///
1845 /// # Example
1846 /// ```ignore,no_run
1847 /// # use google_cloud_securityposture_v1::model::Constraint;
1848 /// use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
1849 /// let x = Constraint::new().set_implementation(Some(
1850 /// google_cloud_securityposture_v1::model::constraint::Implementation::SecurityHealthAnalyticsModule(SecurityHealthAnalyticsModule::default().into())));
1851 /// ```
1852 pub fn set_implementation<
1853 T: std::convert::Into<std::option::Option<crate::model::constraint::Implementation>>,
1854 >(
1855 mut self,
1856 v: T,
1857 ) -> Self {
1858 self.implementation = v.into();
1859 self
1860 }
1861
1862 /// The value of [implementation][crate::model::Constraint::implementation]
1863 /// if it holds a `SecurityHealthAnalyticsModule`, `None` if the field is not set or
1864 /// holds a different branch.
1865 pub fn security_health_analytics_module(
1866 &self,
1867 ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>> {
1868 #[allow(unreachable_patterns)]
1869 self.implementation.as_ref().and_then(|v| match v {
1870 crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v) => {
1871 std::option::Option::Some(v)
1872 }
1873 _ => std::option::Option::None,
1874 })
1875 }
1876
1877 /// Sets the value of [implementation][crate::model::Constraint::implementation]
1878 /// to hold a `SecurityHealthAnalyticsModule`.
1879 ///
1880 /// Note that all the setters affecting `implementation` are
1881 /// mutually exclusive.
1882 ///
1883 /// # Example
1884 /// ```ignore,no_run
1885 /// # use google_cloud_securityposture_v1::model::Constraint;
1886 /// use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
1887 /// let x = Constraint::new().set_security_health_analytics_module(SecurityHealthAnalyticsModule::default()/* use setters */);
1888 /// assert!(x.security_health_analytics_module().is_some());
1889 /// assert!(x.security_health_analytics_custom_module().is_none());
1890 /// assert!(x.org_policy_constraint().is_none());
1891 /// assert!(x.org_policy_constraint_custom().is_none());
1892 /// ```
1893 pub fn set_security_health_analytics_module<
1894 T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>>,
1895 >(
1896 mut self,
1897 v: T,
1898 ) -> Self {
1899 self.implementation = std::option::Option::Some(
1900 crate::model::constraint::Implementation::SecurityHealthAnalyticsModule(v.into()),
1901 );
1902 self
1903 }
1904
1905 /// The value of [implementation][crate::model::Constraint::implementation]
1906 /// if it holds a `SecurityHealthAnalyticsCustomModule`, `None` if the field is not set or
1907 /// holds a different branch.
1908 pub fn security_health_analytics_custom_module(
1909 &self,
1910 ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>
1911 {
1912 #[allow(unreachable_patterns)]
1913 self.implementation.as_ref().and_then(|v| match v {
1914 crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v) => {
1915 std::option::Option::Some(v)
1916 }
1917 _ => std::option::Option::None,
1918 })
1919 }
1920
1921 /// Sets the value of [implementation][crate::model::Constraint::implementation]
1922 /// to hold a `SecurityHealthAnalyticsCustomModule`.
1923 ///
1924 /// Note that all the setters affecting `implementation` are
1925 /// mutually exclusive.
1926 ///
1927 /// # Example
1928 /// ```ignore,no_run
1929 /// # use google_cloud_securityposture_v1::model::Constraint;
1930 /// use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
1931 /// let x = Constraint::new().set_security_health_analytics_custom_module(SecurityHealthAnalyticsCustomModule::default()/* use setters */);
1932 /// assert!(x.security_health_analytics_custom_module().is_some());
1933 /// assert!(x.security_health_analytics_module().is_none());
1934 /// assert!(x.org_policy_constraint().is_none());
1935 /// assert!(x.org_policy_constraint_custom().is_none());
1936 /// ```
1937 pub fn set_security_health_analytics_custom_module<
1938 T: std::convert::Into<std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>>,
1939 >(
1940 mut self,
1941 v: T,
1942 ) -> Self {
1943 self.implementation = std::option::Option::Some(
1944 crate::model::constraint::Implementation::SecurityHealthAnalyticsCustomModule(v.into()),
1945 );
1946 self
1947 }
1948
1949 /// The value of [implementation][crate::model::Constraint::implementation]
1950 /// if it holds a `OrgPolicyConstraint`, `None` if the field is not set or
1951 /// holds a different branch.
1952 pub fn org_policy_constraint(
1953 &self,
1954 ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraint>> {
1955 #[allow(unreachable_patterns)]
1956 self.implementation.as_ref().and_then(|v| match v {
1957 crate::model::constraint::Implementation::OrgPolicyConstraint(v) => {
1958 std::option::Option::Some(v)
1959 }
1960 _ => std::option::Option::None,
1961 })
1962 }
1963
1964 /// Sets the value of [implementation][crate::model::Constraint::implementation]
1965 /// to hold a `OrgPolicyConstraint`.
1966 ///
1967 /// Note that all the setters affecting `implementation` are
1968 /// mutually exclusive.
1969 ///
1970 /// # Example
1971 /// ```ignore,no_run
1972 /// # use google_cloud_securityposture_v1::model::Constraint;
1973 /// use google_cloud_securityposture_v1::model::OrgPolicyConstraint;
1974 /// let x = Constraint::new().set_org_policy_constraint(OrgPolicyConstraint::default()/* use setters */);
1975 /// assert!(x.org_policy_constraint().is_some());
1976 /// assert!(x.security_health_analytics_module().is_none());
1977 /// assert!(x.security_health_analytics_custom_module().is_none());
1978 /// assert!(x.org_policy_constraint_custom().is_none());
1979 /// ```
1980 pub fn set_org_policy_constraint<
1981 T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraint>>,
1982 >(
1983 mut self,
1984 v: T,
1985 ) -> Self {
1986 self.implementation = std::option::Option::Some(
1987 crate::model::constraint::Implementation::OrgPolicyConstraint(v.into()),
1988 );
1989 self
1990 }
1991
1992 /// The value of [implementation][crate::model::Constraint::implementation]
1993 /// if it holds a `OrgPolicyConstraintCustom`, `None` if the field is not set or
1994 /// holds a different branch.
1995 pub fn org_policy_constraint_custom(
1996 &self,
1997 ) -> std::option::Option<&std::boxed::Box<crate::model::OrgPolicyConstraintCustom>> {
1998 #[allow(unreachable_patterns)]
1999 self.implementation.as_ref().and_then(|v| match v {
2000 crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v) => {
2001 std::option::Option::Some(v)
2002 }
2003 _ => std::option::Option::None,
2004 })
2005 }
2006
2007 /// Sets the value of [implementation][crate::model::Constraint::implementation]
2008 /// to hold a `OrgPolicyConstraintCustom`.
2009 ///
2010 /// Note that all the setters affecting `implementation` are
2011 /// mutually exclusive.
2012 ///
2013 /// # Example
2014 /// ```ignore,no_run
2015 /// # use google_cloud_securityposture_v1::model::Constraint;
2016 /// use google_cloud_securityposture_v1::model::OrgPolicyConstraintCustom;
2017 /// let x = Constraint::new().set_org_policy_constraint_custom(OrgPolicyConstraintCustom::default()/* use setters */);
2018 /// assert!(x.org_policy_constraint_custom().is_some());
2019 /// assert!(x.security_health_analytics_module().is_none());
2020 /// assert!(x.security_health_analytics_custom_module().is_none());
2021 /// assert!(x.org_policy_constraint().is_none());
2022 /// ```
2023 pub fn set_org_policy_constraint_custom<
2024 T: std::convert::Into<std::boxed::Box<crate::model::OrgPolicyConstraintCustom>>,
2025 >(
2026 mut self,
2027 v: T,
2028 ) -> Self {
2029 self.implementation = std::option::Option::Some(
2030 crate::model::constraint::Implementation::OrgPolicyConstraintCustom(v.into()),
2031 );
2032 self
2033 }
2034}
2035
2036impl wkt::message::Message for Constraint {
2037 fn typename() -> &'static str {
2038 "type.googleapis.com/google.cloud.securityposture.v1.Constraint"
2039 }
2040}
2041
2042/// Defines additional types related to [Constraint].
2043pub mod constraint {
2044 #[allow(unused_imports)]
2045 use super::*;
2046
2047 #[allow(missing_docs)]
2048 #[derive(Clone, Debug, PartialEq)]
2049 #[non_exhaustive]
2050 pub enum Implementation {
2051 /// Optional. SHA built-in detector.
2052 SecurityHealthAnalyticsModule(std::boxed::Box<crate::model::SecurityHealthAnalyticsModule>),
2053 /// Optional. SHA custom detector.
2054 SecurityHealthAnalyticsCustomModule(
2055 std::boxed::Box<crate::model::SecurityHealthAnalyticsCustomModule>,
2056 ),
2057 /// Optional. Org Policy builtin constraint.
2058 OrgPolicyConstraint(std::boxed::Box<crate::model::OrgPolicyConstraint>),
2059 /// Optional. Org Policy custom constraint.
2060 OrgPolicyConstraintCustom(std::boxed::Box<crate::model::OrgPolicyConstraintCustom>),
2061 }
2062}
2063
2064/// Message for requesting list of Postures.
2065#[derive(Clone, Default, PartialEq)]
2066#[non_exhaustive]
2067pub struct ListPosturesRequest {
2068 /// Required. Parent value for ListPosturesRequest.
2069 pub parent: std::string::String,
2070
2071 /// Requested page size. Server may return fewer items than requested.
2072 /// If unspecified, server will pick an appropriate default.
2073 pub page_size: i32,
2074
2075 /// A token identifying a page of results the server should return.
2076 pub page_token: std::string::String,
2077
2078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2079}
2080
2081impl ListPosturesRequest {
2082 /// Creates a new default instance.
2083 pub fn new() -> Self {
2084 std::default::Default::default()
2085 }
2086
2087 /// Sets the value of [parent][crate::model::ListPosturesRequest::parent].
2088 ///
2089 /// # Example
2090 /// ```ignore,no_run
2091 /// # use google_cloud_securityposture_v1::model::ListPosturesRequest;
2092 /// # let organization_id = "organization_id";
2093 /// # let location_id = "location_id";
2094 /// let x = ListPosturesRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
2095 /// ```
2096 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2097 self.parent = v.into();
2098 self
2099 }
2100
2101 /// Sets the value of [page_size][crate::model::ListPosturesRequest::page_size].
2102 ///
2103 /// # Example
2104 /// ```ignore,no_run
2105 /// # use google_cloud_securityposture_v1::model::ListPosturesRequest;
2106 /// let x = ListPosturesRequest::new().set_page_size(42);
2107 /// ```
2108 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2109 self.page_size = v.into();
2110 self
2111 }
2112
2113 /// Sets the value of [page_token][crate::model::ListPosturesRequest::page_token].
2114 ///
2115 /// # Example
2116 /// ```ignore,no_run
2117 /// # use google_cloud_securityposture_v1::model::ListPosturesRequest;
2118 /// let x = ListPosturesRequest::new().set_page_token("example");
2119 /// ```
2120 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2121 self.page_token = v.into();
2122 self
2123 }
2124}
2125
2126impl wkt::message::Message for ListPosturesRequest {
2127 fn typename() -> &'static str {
2128 "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesRequest"
2129 }
2130}
2131
2132/// Message for response to listing Postures.
2133#[derive(Clone, Default, PartialEq)]
2134#[non_exhaustive]
2135pub struct ListPosturesResponse {
2136 /// The list of Posture.
2137 pub postures: std::vec::Vec<crate::model::Posture>,
2138
2139 /// A token identifying a page of results the server should return.
2140 pub next_page_token: std::string::String,
2141
2142 /// Unreachable resources.
2143 pub unreachable: std::vec::Vec<std::string::String>,
2144
2145 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2146}
2147
2148impl ListPosturesResponse {
2149 /// Creates a new default instance.
2150 pub fn new() -> Self {
2151 std::default::Default::default()
2152 }
2153
2154 /// Sets the value of [postures][crate::model::ListPosturesResponse::postures].
2155 ///
2156 /// # Example
2157 /// ```ignore,no_run
2158 /// # use google_cloud_securityposture_v1::model::ListPosturesResponse;
2159 /// use google_cloud_securityposture_v1::model::Posture;
2160 /// let x = ListPosturesResponse::new()
2161 /// .set_postures([
2162 /// Posture::default()/* use setters */,
2163 /// Posture::default()/* use (different) setters */,
2164 /// ]);
2165 /// ```
2166 pub fn set_postures<T, V>(mut self, v: T) -> Self
2167 where
2168 T: std::iter::IntoIterator<Item = V>,
2169 V: std::convert::Into<crate::model::Posture>,
2170 {
2171 use std::iter::Iterator;
2172 self.postures = v.into_iter().map(|i| i.into()).collect();
2173 self
2174 }
2175
2176 /// Sets the value of [next_page_token][crate::model::ListPosturesResponse::next_page_token].
2177 ///
2178 /// # Example
2179 /// ```ignore,no_run
2180 /// # use google_cloud_securityposture_v1::model::ListPosturesResponse;
2181 /// let x = ListPosturesResponse::new().set_next_page_token("example");
2182 /// ```
2183 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2184 self.next_page_token = v.into();
2185 self
2186 }
2187
2188 /// Sets the value of [unreachable][crate::model::ListPosturesResponse::unreachable].
2189 ///
2190 /// # Example
2191 /// ```ignore,no_run
2192 /// # use google_cloud_securityposture_v1::model::ListPosturesResponse;
2193 /// let x = ListPosturesResponse::new().set_unreachable(["a", "b", "c"]);
2194 /// ```
2195 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
2196 where
2197 T: std::iter::IntoIterator<Item = V>,
2198 V: std::convert::Into<std::string::String>,
2199 {
2200 use std::iter::Iterator;
2201 self.unreachable = v.into_iter().map(|i| i.into()).collect();
2202 self
2203 }
2204}
2205
2206impl wkt::message::Message for ListPosturesResponse {
2207 fn typename() -> &'static str {
2208 "type.googleapis.com/google.cloud.securityposture.v1.ListPosturesResponse"
2209 }
2210}
2211
2212#[doc(hidden)]
2213impl google_cloud_gax::paginator::internal::PageableResponse for ListPosturesResponse {
2214 type PageItem = crate::model::Posture;
2215
2216 fn items(self) -> std::vec::Vec<Self::PageItem> {
2217 self.postures
2218 }
2219
2220 fn next_page_token(&self) -> std::string::String {
2221 use std::clone::Clone;
2222 self.next_page_token.clone()
2223 }
2224}
2225
2226/// Message for requesting list of Posture revisions.
2227#[derive(Clone, Default, PartialEq)]
2228#[non_exhaustive]
2229pub struct ListPostureRevisionsRequest {
2230 /// Required. Name value for ListPostureRevisionsRequest.
2231 pub name: std::string::String,
2232
2233 /// Optional. Requested page size. Server may return fewer items than
2234 /// requested. If unspecified, server will pick 100 as default.
2235 pub page_size: i32,
2236
2237 /// Optional. A token identifying a page of results the server should return.
2238 pub page_token: std::string::String,
2239
2240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2241}
2242
2243impl ListPostureRevisionsRequest {
2244 /// Creates a new default instance.
2245 pub fn new() -> Self {
2246 std::default::Default::default()
2247 }
2248
2249 /// Sets the value of [name][crate::model::ListPostureRevisionsRequest::name].
2250 ///
2251 /// # Example
2252 /// ```ignore,no_run
2253 /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsRequest;
2254 /// # let organization_id = "organization_id";
2255 /// # let location_id = "location_id";
2256 /// # let posture_id = "posture_id";
2257 /// let x = ListPostureRevisionsRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
2258 /// ```
2259 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2260 self.name = v.into();
2261 self
2262 }
2263
2264 /// Sets the value of [page_size][crate::model::ListPostureRevisionsRequest::page_size].
2265 ///
2266 /// # Example
2267 /// ```ignore,no_run
2268 /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsRequest;
2269 /// let x = ListPostureRevisionsRequest::new().set_page_size(42);
2270 /// ```
2271 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2272 self.page_size = v.into();
2273 self
2274 }
2275
2276 /// Sets the value of [page_token][crate::model::ListPostureRevisionsRequest::page_token].
2277 ///
2278 /// # Example
2279 /// ```ignore,no_run
2280 /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsRequest;
2281 /// let x = ListPostureRevisionsRequest::new().set_page_token("example");
2282 /// ```
2283 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2284 self.page_token = v.into();
2285 self
2286 }
2287}
2288
2289impl wkt::message::Message for ListPostureRevisionsRequest {
2290 fn typename() -> &'static str {
2291 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsRequest"
2292 }
2293}
2294
2295/// Message for response to listing PostureRevisions.
2296#[derive(Clone, Default, PartialEq)]
2297#[non_exhaustive]
2298pub struct ListPostureRevisionsResponse {
2299 /// The list of Posture revisions.
2300 pub revisions: std::vec::Vec<crate::model::Posture>,
2301
2302 /// A token identifying a page of results the server should return.
2303 pub next_page_token: std::string::String,
2304
2305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2306}
2307
2308impl ListPostureRevisionsResponse {
2309 /// Creates a new default instance.
2310 pub fn new() -> Self {
2311 std::default::Default::default()
2312 }
2313
2314 /// Sets the value of [revisions][crate::model::ListPostureRevisionsResponse::revisions].
2315 ///
2316 /// # Example
2317 /// ```ignore,no_run
2318 /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsResponse;
2319 /// use google_cloud_securityposture_v1::model::Posture;
2320 /// let x = ListPostureRevisionsResponse::new()
2321 /// .set_revisions([
2322 /// Posture::default()/* use setters */,
2323 /// Posture::default()/* use (different) setters */,
2324 /// ]);
2325 /// ```
2326 pub fn set_revisions<T, V>(mut self, v: T) -> Self
2327 where
2328 T: std::iter::IntoIterator<Item = V>,
2329 V: std::convert::Into<crate::model::Posture>,
2330 {
2331 use std::iter::Iterator;
2332 self.revisions = v.into_iter().map(|i| i.into()).collect();
2333 self
2334 }
2335
2336 /// Sets the value of [next_page_token][crate::model::ListPostureRevisionsResponse::next_page_token].
2337 ///
2338 /// # Example
2339 /// ```ignore,no_run
2340 /// # use google_cloud_securityposture_v1::model::ListPostureRevisionsResponse;
2341 /// let x = ListPostureRevisionsResponse::new().set_next_page_token("example");
2342 /// ```
2343 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2344 self.next_page_token = v.into();
2345 self
2346 }
2347}
2348
2349impl wkt::message::Message for ListPostureRevisionsResponse {
2350 fn typename() -> &'static str {
2351 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureRevisionsResponse"
2352 }
2353}
2354
2355#[doc(hidden)]
2356impl google_cloud_gax::paginator::internal::PageableResponse for ListPostureRevisionsResponse {
2357 type PageItem = crate::model::Posture;
2358
2359 fn items(self) -> std::vec::Vec<Self::PageItem> {
2360 self.revisions
2361 }
2362
2363 fn next_page_token(&self) -> std::string::String {
2364 use std::clone::Clone;
2365 self.next_page_token.clone()
2366 }
2367}
2368
2369/// Message for getting a Posture.
2370#[derive(Clone, Default, PartialEq)]
2371#[non_exhaustive]
2372pub struct GetPostureRequest {
2373 /// Required. Name of the resource.
2374 pub name: std::string::String,
2375
2376 /// Optional. Posture revision which needs to be retrieved.
2377 pub revision_id: std::string::String,
2378
2379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2380}
2381
2382impl GetPostureRequest {
2383 /// Creates a new default instance.
2384 pub fn new() -> Self {
2385 std::default::Default::default()
2386 }
2387
2388 /// Sets the value of [name][crate::model::GetPostureRequest::name].
2389 ///
2390 /// # Example
2391 /// ```ignore,no_run
2392 /// # use google_cloud_securityposture_v1::model::GetPostureRequest;
2393 /// # let organization_id = "organization_id";
2394 /// # let location_id = "location_id";
2395 /// # let posture_id = "posture_id";
2396 /// let x = GetPostureRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
2397 /// ```
2398 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2399 self.name = v.into();
2400 self
2401 }
2402
2403 /// Sets the value of [revision_id][crate::model::GetPostureRequest::revision_id].
2404 ///
2405 /// # Example
2406 /// ```ignore,no_run
2407 /// # use google_cloud_securityposture_v1::model::GetPostureRequest;
2408 /// let x = GetPostureRequest::new().set_revision_id("example");
2409 /// ```
2410 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2411 self.revision_id = v.into();
2412 self
2413 }
2414}
2415
2416impl wkt::message::Message for GetPostureRequest {
2417 fn typename() -> &'static str {
2418 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureRequest"
2419 }
2420}
2421
2422/// Message for creating a Posture.
2423#[derive(Clone, Default, PartialEq)]
2424#[non_exhaustive]
2425pub struct CreatePostureRequest {
2426 /// Required. Value for parent.
2427 pub parent: std::string::String,
2428
2429 /// Required. User provided identifier. It should be unique in scope of an
2430 /// Organization and location.
2431 pub posture_id: std::string::String,
2432
2433 /// Required. The resource being created.
2434 pub posture: std::option::Option<crate::model::Posture>,
2435
2436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2437}
2438
2439impl CreatePostureRequest {
2440 /// Creates a new default instance.
2441 pub fn new() -> Self {
2442 std::default::Default::default()
2443 }
2444
2445 /// Sets the value of [parent][crate::model::CreatePostureRequest::parent].
2446 ///
2447 /// # Example
2448 /// ```ignore,no_run
2449 /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2450 /// # let organization_id = "organization_id";
2451 /// # let location_id = "location_id";
2452 /// let x = CreatePostureRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
2453 /// ```
2454 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2455 self.parent = v.into();
2456 self
2457 }
2458
2459 /// Sets the value of [posture_id][crate::model::CreatePostureRequest::posture_id].
2460 ///
2461 /// # Example
2462 /// ```ignore,no_run
2463 /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2464 /// let x = CreatePostureRequest::new().set_posture_id("example");
2465 /// ```
2466 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2467 self.posture_id = v.into();
2468 self
2469 }
2470
2471 /// Sets the value of [posture][crate::model::CreatePostureRequest::posture].
2472 ///
2473 /// # Example
2474 /// ```ignore,no_run
2475 /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2476 /// use google_cloud_securityposture_v1::model::Posture;
2477 /// let x = CreatePostureRequest::new().set_posture(Posture::default()/* use setters */);
2478 /// ```
2479 pub fn set_posture<T>(mut self, v: T) -> Self
2480 where
2481 T: std::convert::Into<crate::model::Posture>,
2482 {
2483 self.posture = std::option::Option::Some(v.into());
2484 self
2485 }
2486
2487 /// Sets or clears the value of [posture][crate::model::CreatePostureRequest::posture].
2488 ///
2489 /// # Example
2490 /// ```ignore,no_run
2491 /// # use google_cloud_securityposture_v1::model::CreatePostureRequest;
2492 /// use google_cloud_securityposture_v1::model::Posture;
2493 /// let x = CreatePostureRequest::new().set_or_clear_posture(Some(Posture::default()/* use setters */));
2494 /// let x = CreatePostureRequest::new().set_or_clear_posture(None::<Posture>);
2495 /// ```
2496 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
2497 where
2498 T: std::convert::Into<crate::model::Posture>,
2499 {
2500 self.posture = v.map(|x| x.into());
2501 self
2502 }
2503}
2504
2505impl wkt::message::Message for CreatePostureRequest {
2506 fn typename() -> &'static str {
2507 "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureRequest"
2508 }
2509}
2510
2511/// Message for updating a Posture.
2512#[derive(Clone, Default, PartialEq)]
2513#[non_exhaustive]
2514pub struct UpdatePostureRequest {
2515 /// Required. Field mask is used to specify the fields to be overwritten in the
2516 /// Posture resource by the update.
2517 /// The fields specified in the update_mask are relative to the resource, not
2518 /// the full request. A field will be overwritten if it is in the mask. If the
2519 /// user does not provide a mask then all fields will be overwritten.
2520 pub update_mask: std::option::Option<wkt::FieldMask>,
2521
2522 /// Required. The resource being updated.
2523 pub posture: std::option::Option<crate::model::Posture>,
2524
2525 /// Required. Posture revision which needs to be updated.
2526 pub revision_id: std::string::String,
2527
2528 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2529}
2530
2531impl UpdatePostureRequest {
2532 /// Creates a new default instance.
2533 pub fn new() -> Self {
2534 std::default::Default::default()
2535 }
2536
2537 /// Sets the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
2538 ///
2539 /// # Example
2540 /// ```ignore,no_run
2541 /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2542 /// use wkt::FieldMask;
2543 /// let x = UpdatePostureRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2544 /// ```
2545 pub fn set_update_mask<T>(mut self, v: T) -> Self
2546 where
2547 T: std::convert::Into<wkt::FieldMask>,
2548 {
2549 self.update_mask = std::option::Option::Some(v.into());
2550 self
2551 }
2552
2553 /// Sets or clears the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
2554 ///
2555 /// # Example
2556 /// ```ignore,no_run
2557 /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2558 /// use wkt::FieldMask;
2559 /// let x = UpdatePostureRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2560 /// let x = UpdatePostureRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2561 /// ```
2562 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2563 where
2564 T: std::convert::Into<wkt::FieldMask>,
2565 {
2566 self.update_mask = v.map(|x| x.into());
2567 self
2568 }
2569
2570 /// Sets the value of [posture][crate::model::UpdatePostureRequest::posture].
2571 ///
2572 /// # Example
2573 /// ```ignore,no_run
2574 /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2575 /// use google_cloud_securityposture_v1::model::Posture;
2576 /// let x = UpdatePostureRequest::new().set_posture(Posture::default()/* use setters */);
2577 /// ```
2578 pub fn set_posture<T>(mut self, v: T) -> Self
2579 where
2580 T: std::convert::Into<crate::model::Posture>,
2581 {
2582 self.posture = std::option::Option::Some(v.into());
2583 self
2584 }
2585
2586 /// Sets or clears the value of [posture][crate::model::UpdatePostureRequest::posture].
2587 ///
2588 /// # Example
2589 /// ```ignore,no_run
2590 /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2591 /// use google_cloud_securityposture_v1::model::Posture;
2592 /// let x = UpdatePostureRequest::new().set_or_clear_posture(Some(Posture::default()/* use setters */));
2593 /// let x = UpdatePostureRequest::new().set_or_clear_posture(None::<Posture>);
2594 /// ```
2595 pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
2596 where
2597 T: std::convert::Into<crate::model::Posture>,
2598 {
2599 self.posture = v.map(|x| x.into());
2600 self
2601 }
2602
2603 /// Sets the value of [revision_id][crate::model::UpdatePostureRequest::revision_id].
2604 ///
2605 /// # Example
2606 /// ```ignore,no_run
2607 /// # use google_cloud_securityposture_v1::model::UpdatePostureRequest;
2608 /// let x = UpdatePostureRequest::new().set_revision_id("example");
2609 /// ```
2610 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2611 self.revision_id = v.into();
2612 self
2613 }
2614}
2615
2616impl wkt::message::Message for UpdatePostureRequest {
2617 fn typename() -> &'static str {
2618 "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureRequest"
2619 }
2620}
2621
2622/// Message for deleting a Posture.
2623#[derive(Clone, Default, PartialEq)]
2624#[non_exhaustive]
2625pub struct DeletePostureRequest {
2626 /// Required. Name of the resource.
2627 pub name: std::string::String,
2628
2629 /// Optional. Etag value of the Posture to be deleted.
2630 pub etag: std::string::String,
2631
2632 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2633}
2634
2635impl DeletePostureRequest {
2636 /// Creates a new default instance.
2637 pub fn new() -> Self {
2638 std::default::Default::default()
2639 }
2640
2641 /// Sets the value of [name][crate::model::DeletePostureRequest::name].
2642 ///
2643 /// # Example
2644 /// ```ignore,no_run
2645 /// # use google_cloud_securityposture_v1::model::DeletePostureRequest;
2646 /// # let organization_id = "organization_id";
2647 /// # let location_id = "location_id";
2648 /// # let posture_id = "posture_id";
2649 /// let x = DeletePostureRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postures/{posture_id}"));
2650 /// ```
2651 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2652 self.name = v.into();
2653 self
2654 }
2655
2656 /// Sets the value of [etag][crate::model::DeletePostureRequest::etag].
2657 ///
2658 /// # Example
2659 /// ```ignore,no_run
2660 /// # use google_cloud_securityposture_v1::model::DeletePostureRequest;
2661 /// let x = DeletePostureRequest::new().set_etag("example");
2662 /// ```
2663 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2664 self.etag = v.into();
2665 self
2666 }
2667}
2668
2669impl wkt::message::Message for DeletePostureRequest {
2670 fn typename() -> &'static str {
2671 "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureRequest"
2672 }
2673}
2674
2675/// Message for extracting existing policies on a workload as a Posture.
2676#[derive(Clone, Default, PartialEq)]
2677#[non_exhaustive]
2678pub struct ExtractPostureRequest {
2679 /// Required. The parent resource name. The format of this value is as follows:
2680 /// `organizations/{organization}/locations/{location}`
2681 pub parent: std::string::String,
2682
2683 /// Required. User provided identifier. It should be unique in scope of an
2684 /// Organization and location.
2685 pub posture_id: std::string::String,
2686
2687 /// Required. Workload from which the policies are to be extracted, it should
2688 /// belong to the same organization defined in parent. The format of this value
2689 /// varies depending on the scope of the request:
2690 ///
2691 /// - `folder/folderNumber`
2692 /// - `project/projectNumber`
2693 /// - `organization/organizationNumber`
2694 pub workload: std::string::String,
2695
2696 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2697}
2698
2699impl ExtractPostureRequest {
2700 /// Creates a new default instance.
2701 pub fn new() -> Self {
2702 std::default::Default::default()
2703 }
2704
2705 /// Sets the value of [parent][crate::model::ExtractPostureRequest::parent].
2706 ///
2707 /// # Example
2708 /// ```ignore,no_run
2709 /// # use google_cloud_securityposture_v1::model::ExtractPostureRequest;
2710 /// # let organization_id = "organization_id";
2711 /// # let location_id = "location_id";
2712 /// let x = ExtractPostureRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
2713 /// ```
2714 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2715 self.parent = v.into();
2716 self
2717 }
2718
2719 /// Sets the value of [posture_id][crate::model::ExtractPostureRequest::posture_id].
2720 ///
2721 /// # Example
2722 /// ```ignore,no_run
2723 /// # use google_cloud_securityposture_v1::model::ExtractPostureRequest;
2724 /// let x = ExtractPostureRequest::new().set_posture_id("example");
2725 /// ```
2726 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2727 self.posture_id = v.into();
2728 self
2729 }
2730
2731 /// Sets the value of [workload][crate::model::ExtractPostureRequest::workload].
2732 ///
2733 /// # Example
2734 /// ```ignore,no_run
2735 /// # use google_cloud_securityposture_v1::model::ExtractPostureRequest;
2736 /// let x = ExtractPostureRequest::new().set_workload("example");
2737 /// ```
2738 pub fn set_workload<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2739 self.workload = v.into();
2740 self
2741 }
2742}
2743
2744impl wkt::message::Message for ExtractPostureRequest {
2745 fn typename() -> &'static str {
2746 "type.googleapis.com/google.cloud.securityposture.v1.ExtractPostureRequest"
2747 }
2748}
2749
2750/// ========================== PostureDeployments ==========================
2751/// Message describing PostureDeployment resource.
2752#[derive(Clone, Default, PartialEq)]
2753#[non_exhaustive]
2754pub struct PostureDeployment {
2755 /// Required. The name of this PostureDeployment resource, in the format of
2756 /// organizations/{organization}/locations/{location_id}/postureDeployments/{postureDeployment}.
2757 pub name: std::string::String,
2758
2759 /// Required. Target resource where the Posture will be deployed. Currently
2760 /// supported resources are of types: projects/projectNumber,
2761 /// folders/folderNumber, organizations/organizationNumber.
2762 pub target_resource: std::string::String,
2763
2764 /// Output only. State of PostureDeployment resource.
2765 pub state: crate::model::posture_deployment::State,
2766
2767 /// Required. Posture that needs to be deployed.
2768 /// Format:
2769 /// organizations/{org_id}/locations/{location_id}/postures/\<posture\>
2770 /// Example:
2771 /// organizations/99/locations/global/postures/les-miserables.
2772 pub posture_id: std::string::String,
2773
2774 /// Required. Revision_id of the Posture that is to be deployed.
2775 pub posture_revision_id: std::string::String,
2776
2777 /// Output only. The timestamp that the PostureDeployment was created.
2778 pub create_time: std::option::Option<wkt::Timestamp>,
2779
2780 /// Output only. The timestamp that the PostureDeployment was updated.
2781 pub update_time: std::option::Option<wkt::Timestamp>,
2782
2783 /// Optional. User provided description of the PostureDeployment.
2784 pub description: std::string::String,
2785
2786 /// Optional. An opaque tag indicating the current version of the
2787 /// PostureDeployment, used for concurrency control. When the
2788 /// `PostureDeployment` is returned from either a `GetPostureDeployment` or a
2789 /// `ListPostureDeployments` request, this `etag` indicates the version of the
2790 /// current `PostureDeployment` to use when executing a read-modify-write loop.
2791 ///
2792 /// When the `PostureDeployment` is used in a `UpdatePostureDeployment` method,
2793 /// use the `etag` value that was returned from a `GetPostureDeployment`
2794 /// request as part of a read-modify-write loop for concurrency control. Not
2795 /// setting the `etag` in a `UpdatePostureDeployment` request will result in an
2796 /// unconditional write of the `PostureDeployment`.
2797 pub etag: std::string::String,
2798
2799 /// Optional. User annotations. These attributes can only be set and used by
2800 /// the user, and not by Google Security Postures.
2801 /// .
2802 pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
2803
2804 /// Output only. Whether or not this Posture is in the process of being
2805 /// updated.
2806 pub reconciling: bool,
2807
2808 /// Output only. This is a output only optional field which will be filled in
2809 /// case where PostureDeployment state is UPDATE_FAILED or CREATE_FAILED or
2810 /// DELETE_FAILED. It denotes the desired Posture.
2811 pub desired_posture_id: std::string::String,
2812
2813 /// Output only. Output only optional field which provides revision_id of the
2814 /// desired_posture_id.
2815 pub desired_posture_revision_id: std::string::String,
2816
2817 /// Output only. This is a output only optional field which will be filled in
2818 /// case where PostureDeployment enters a failure state like UPDATE_FAILED or
2819 /// CREATE_FAILED or DELETE_FAILED.
2820 pub failure_message: std::string::String,
2821
2822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2823}
2824
2825impl PostureDeployment {
2826 /// Creates a new default instance.
2827 pub fn new() -> Self {
2828 std::default::Default::default()
2829 }
2830
2831 /// Sets the value of [name][crate::model::PostureDeployment::name].
2832 ///
2833 /// # Example
2834 /// ```ignore,no_run
2835 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2836 /// # let organization_id = "organization_id";
2837 /// # let location_id = "location_id";
2838 /// # let posture_deployment_id = "posture_deployment_id";
2839 /// let x = PostureDeployment::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"));
2840 /// ```
2841 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2842 self.name = v.into();
2843 self
2844 }
2845
2846 /// Sets the value of [target_resource][crate::model::PostureDeployment::target_resource].
2847 ///
2848 /// # Example
2849 /// ```ignore,no_run
2850 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2851 /// let x = PostureDeployment::new().set_target_resource("example");
2852 /// ```
2853 pub fn set_target_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2854 self.target_resource = v.into();
2855 self
2856 }
2857
2858 /// Sets the value of [state][crate::model::PostureDeployment::state].
2859 ///
2860 /// # Example
2861 /// ```ignore,no_run
2862 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2863 /// use google_cloud_securityposture_v1::model::posture_deployment::State;
2864 /// let x0 = PostureDeployment::new().set_state(State::Creating);
2865 /// let x1 = PostureDeployment::new().set_state(State::Deleting);
2866 /// let x2 = PostureDeployment::new().set_state(State::Updating);
2867 /// ```
2868 pub fn set_state<T: std::convert::Into<crate::model::posture_deployment::State>>(
2869 mut self,
2870 v: T,
2871 ) -> Self {
2872 self.state = v.into();
2873 self
2874 }
2875
2876 /// Sets the value of [posture_id][crate::model::PostureDeployment::posture_id].
2877 ///
2878 /// # Example
2879 /// ```ignore,no_run
2880 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2881 /// let x = PostureDeployment::new().set_posture_id("example");
2882 /// ```
2883 pub fn set_posture_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2884 self.posture_id = v.into();
2885 self
2886 }
2887
2888 /// Sets the value of [posture_revision_id][crate::model::PostureDeployment::posture_revision_id].
2889 ///
2890 /// # Example
2891 /// ```ignore,no_run
2892 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2893 /// let x = PostureDeployment::new().set_posture_revision_id("example");
2894 /// ```
2895 pub fn set_posture_revision_id<T: std::convert::Into<std::string::String>>(
2896 mut self,
2897 v: T,
2898 ) -> Self {
2899 self.posture_revision_id = v.into();
2900 self
2901 }
2902
2903 /// Sets the value of [create_time][crate::model::PostureDeployment::create_time].
2904 ///
2905 /// # Example
2906 /// ```ignore,no_run
2907 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2908 /// use wkt::Timestamp;
2909 /// let x = PostureDeployment::new().set_create_time(Timestamp::default()/* use setters */);
2910 /// ```
2911 pub fn set_create_time<T>(mut self, v: T) -> Self
2912 where
2913 T: std::convert::Into<wkt::Timestamp>,
2914 {
2915 self.create_time = std::option::Option::Some(v.into());
2916 self
2917 }
2918
2919 /// Sets or clears the value of [create_time][crate::model::PostureDeployment::create_time].
2920 ///
2921 /// # Example
2922 /// ```ignore,no_run
2923 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2924 /// use wkt::Timestamp;
2925 /// let x = PostureDeployment::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
2926 /// let x = PostureDeployment::new().set_or_clear_create_time(None::<Timestamp>);
2927 /// ```
2928 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
2929 where
2930 T: std::convert::Into<wkt::Timestamp>,
2931 {
2932 self.create_time = v.map(|x| x.into());
2933 self
2934 }
2935
2936 /// Sets the value of [update_time][crate::model::PostureDeployment::update_time].
2937 ///
2938 /// # Example
2939 /// ```ignore,no_run
2940 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2941 /// use wkt::Timestamp;
2942 /// let x = PostureDeployment::new().set_update_time(Timestamp::default()/* use setters */);
2943 /// ```
2944 pub fn set_update_time<T>(mut self, v: T) -> Self
2945 where
2946 T: std::convert::Into<wkt::Timestamp>,
2947 {
2948 self.update_time = std::option::Option::Some(v.into());
2949 self
2950 }
2951
2952 /// Sets or clears the value of [update_time][crate::model::PostureDeployment::update_time].
2953 ///
2954 /// # Example
2955 /// ```ignore,no_run
2956 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2957 /// use wkt::Timestamp;
2958 /// let x = PostureDeployment::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
2959 /// let x = PostureDeployment::new().set_or_clear_update_time(None::<Timestamp>);
2960 /// ```
2961 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
2962 where
2963 T: std::convert::Into<wkt::Timestamp>,
2964 {
2965 self.update_time = v.map(|x| x.into());
2966 self
2967 }
2968
2969 /// Sets the value of [description][crate::model::PostureDeployment::description].
2970 ///
2971 /// # Example
2972 /// ```ignore,no_run
2973 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2974 /// let x = PostureDeployment::new().set_description("example");
2975 /// ```
2976 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2977 self.description = v.into();
2978 self
2979 }
2980
2981 /// Sets the value of [etag][crate::model::PostureDeployment::etag].
2982 ///
2983 /// # Example
2984 /// ```ignore,no_run
2985 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2986 /// let x = PostureDeployment::new().set_etag("example");
2987 /// ```
2988 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2989 self.etag = v.into();
2990 self
2991 }
2992
2993 /// Sets the value of [annotations][crate::model::PostureDeployment::annotations].
2994 ///
2995 /// # Example
2996 /// ```ignore,no_run
2997 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
2998 /// let x = PostureDeployment::new().set_annotations([
2999 /// ("key0", "abc"),
3000 /// ("key1", "xyz"),
3001 /// ]);
3002 /// ```
3003 pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3004 where
3005 T: std::iter::IntoIterator<Item = (K, V)>,
3006 K: std::convert::Into<std::string::String>,
3007 V: std::convert::Into<std::string::String>,
3008 {
3009 use std::iter::Iterator;
3010 self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3011 self
3012 }
3013
3014 /// Sets the value of [reconciling][crate::model::PostureDeployment::reconciling].
3015 ///
3016 /// # Example
3017 /// ```ignore,no_run
3018 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3019 /// let x = PostureDeployment::new().set_reconciling(true);
3020 /// ```
3021 pub fn set_reconciling<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3022 self.reconciling = v.into();
3023 self
3024 }
3025
3026 /// Sets the value of [desired_posture_id][crate::model::PostureDeployment::desired_posture_id].
3027 ///
3028 /// # Example
3029 /// ```ignore,no_run
3030 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3031 /// let x = PostureDeployment::new().set_desired_posture_id("example");
3032 /// ```
3033 pub fn set_desired_posture_id<T: std::convert::Into<std::string::String>>(
3034 mut self,
3035 v: T,
3036 ) -> Self {
3037 self.desired_posture_id = v.into();
3038 self
3039 }
3040
3041 /// Sets the value of [desired_posture_revision_id][crate::model::PostureDeployment::desired_posture_revision_id].
3042 ///
3043 /// # Example
3044 /// ```ignore,no_run
3045 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3046 /// let x = PostureDeployment::new().set_desired_posture_revision_id("example");
3047 /// ```
3048 pub fn set_desired_posture_revision_id<T: std::convert::Into<std::string::String>>(
3049 mut self,
3050 v: T,
3051 ) -> Self {
3052 self.desired_posture_revision_id = v.into();
3053 self
3054 }
3055
3056 /// Sets the value of [failure_message][crate::model::PostureDeployment::failure_message].
3057 ///
3058 /// # Example
3059 /// ```ignore,no_run
3060 /// # use google_cloud_securityposture_v1::model::PostureDeployment;
3061 /// let x = PostureDeployment::new().set_failure_message("example");
3062 /// ```
3063 pub fn set_failure_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3064 self.failure_message = v.into();
3065 self
3066 }
3067}
3068
3069impl wkt::message::Message for PostureDeployment {
3070 fn typename() -> &'static str {
3071 "type.googleapis.com/google.cloud.securityposture.v1.PostureDeployment"
3072 }
3073}
3074
3075/// Defines additional types related to [PostureDeployment].
3076pub mod posture_deployment {
3077 #[allow(unused_imports)]
3078 use super::*;
3079
3080 /// State of a PostureDeployment.
3081 ///
3082 /// # Working with unknown values
3083 ///
3084 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3085 /// additional enum variants at any time. Adding new variants is not considered
3086 /// a breaking change. Applications should write their code in anticipation of:
3087 ///
3088 /// - New values appearing in future releases of the client library, **and**
3089 /// - New values received dynamically, without application changes.
3090 ///
3091 /// Please consult the [Working with enums] section in the user guide for some
3092 /// guidelines.
3093 ///
3094 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3095 #[derive(Clone, Debug, PartialEq)]
3096 #[non_exhaustive]
3097 pub enum State {
3098 /// Unspecified operation state.
3099 Unspecified,
3100 /// The PostureDeployment is being created.
3101 Creating,
3102 /// The PostureDeployment is being deleted.
3103 Deleting,
3104 /// The PostureDeployment state is being updated.
3105 Updating,
3106 /// The PostureDeployment state is active and in use.
3107 Active,
3108 /// The PostureDeployment creation failed.
3109 CreateFailed,
3110 /// The PostureDeployment update failed.
3111 UpdateFailed,
3112 /// The PostureDeployment deletion failed.
3113 DeleteFailed,
3114 /// If set, the enum was initialized with an unknown value.
3115 ///
3116 /// Applications can examine the value using [State::value] or
3117 /// [State::name].
3118 UnknownValue(state::UnknownValue),
3119 }
3120
3121 #[doc(hidden)]
3122 pub mod state {
3123 #[allow(unused_imports)]
3124 use super::*;
3125 #[derive(Clone, Debug, PartialEq)]
3126 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3127 }
3128
3129 impl State {
3130 /// Gets the enum value.
3131 ///
3132 /// Returns `None` if the enum contains an unknown value deserialized from
3133 /// the string representation of enums.
3134 pub fn value(&self) -> std::option::Option<i32> {
3135 match self {
3136 Self::Unspecified => std::option::Option::Some(0),
3137 Self::Creating => std::option::Option::Some(1),
3138 Self::Deleting => std::option::Option::Some(2),
3139 Self::Updating => std::option::Option::Some(3),
3140 Self::Active => std::option::Option::Some(4),
3141 Self::CreateFailed => std::option::Option::Some(5),
3142 Self::UpdateFailed => std::option::Option::Some(6),
3143 Self::DeleteFailed => std::option::Option::Some(7),
3144 Self::UnknownValue(u) => u.0.value(),
3145 }
3146 }
3147
3148 /// Gets the enum value as a string.
3149 ///
3150 /// Returns `None` if the enum contains an unknown value deserialized from
3151 /// the integer representation of enums.
3152 pub fn name(&self) -> std::option::Option<&str> {
3153 match self {
3154 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3155 Self::Creating => std::option::Option::Some("CREATING"),
3156 Self::Deleting => std::option::Option::Some("DELETING"),
3157 Self::Updating => std::option::Option::Some("UPDATING"),
3158 Self::Active => std::option::Option::Some("ACTIVE"),
3159 Self::CreateFailed => std::option::Option::Some("CREATE_FAILED"),
3160 Self::UpdateFailed => std::option::Option::Some("UPDATE_FAILED"),
3161 Self::DeleteFailed => std::option::Option::Some("DELETE_FAILED"),
3162 Self::UnknownValue(u) => u.0.name(),
3163 }
3164 }
3165 }
3166
3167 impl std::default::Default for State {
3168 fn default() -> Self {
3169 use std::convert::From;
3170 Self::from(0)
3171 }
3172 }
3173
3174 impl std::fmt::Display for State {
3175 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3176 wkt::internal::display_enum(f, self.name(), self.value())
3177 }
3178 }
3179
3180 impl std::convert::From<i32> for State {
3181 fn from(value: i32) -> Self {
3182 match value {
3183 0 => Self::Unspecified,
3184 1 => Self::Creating,
3185 2 => Self::Deleting,
3186 3 => Self::Updating,
3187 4 => Self::Active,
3188 5 => Self::CreateFailed,
3189 6 => Self::UpdateFailed,
3190 7 => Self::DeleteFailed,
3191 _ => Self::UnknownValue(state::UnknownValue(
3192 wkt::internal::UnknownEnumValue::Integer(value),
3193 )),
3194 }
3195 }
3196 }
3197
3198 impl std::convert::From<&str> for State {
3199 fn from(value: &str) -> Self {
3200 use std::string::ToString;
3201 match value {
3202 "STATE_UNSPECIFIED" => Self::Unspecified,
3203 "CREATING" => Self::Creating,
3204 "DELETING" => Self::Deleting,
3205 "UPDATING" => Self::Updating,
3206 "ACTIVE" => Self::Active,
3207 "CREATE_FAILED" => Self::CreateFailed,
3208 "UPDATE_FAILED" => Self::UpdateFailed,
3209 "DELETE_FAILED" => Self::DeleteFailed,
3210 _ => Self::UnknownValue(state::UnknownValue(
3211 wkt::internal::UnknownEnumValue::String(value.to_string()),
3212 )),
3213 }
3214 }
3215 }
3216
3217 impl serde::ser::Serialize for State {
3218 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3219 where
3220 S: serde::Serializer,
3221 {
3222 match self {
3223 Self::Unspecified => serializer.serialize_i32(0),
3224 Self::Creating => serializer.serialize_i32(1),
3225 Self::Deleting => serializer.serialize_i32(2),
3226 Self::Updating => serializer.serialize_i32(3),
3227 Self::Active => serializer.serialize_i32(4),
3228 Self::CreateFailed => serializer.serialize_i32(5),
3229 Self::UpdateFailed => serializer.serialize_i32(6),
3230 Self::DeleteFailed => serializer.serialize_i32(7),
3231 Self::UnknownValue(u) => u.0.serialize(serializer),
3232 }
3233 }
3234 }
3235
3236 impl<'de> serde::de::Deserialize<'de> for State {
3237 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3238 where
3239 D: serde::Deserializer<'de>,
3240 {
3241 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3242 ".google.cloud.securityposture.v1.PostureDeployment.State",
3243 ))
3244 }
3245 }
3246}
3247
3248/// Message for requesting list of PostureDeployments.
3249#[derive(Clone, Default, PartialEq)]
3250#[non_exhaustive]
3251pub struct ListPostureDeploymentsRequest {
3252 /// Required. Parent value for ListPostureDeploymentsRequest.
3253 pub parent: std::string::String,
3254
3255 /// Optional. Requested page size. Server may return fewer items than
3256 /// requested. If unspecified, server will pick an appropriate default.
3257 pub page_size: i32,
3258
3259 /// Optional. A token identifying a page of results the server should return.
3260 pub page_token: std::string::String,
3261
3262 /// Optional. Filter to be applied on the resource, defined by EBNF grammar
3263 /// <https://google.aip.dev/assets/misc/ebnf-filtering.txt>.
3264 pub filter: std::string::String,
3265
3266 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3267}
3268
3269impl ListPostureDeploymentsRequest {
3270 /// Creates a new default instance.
3271 pub fn new() -> Self {
3272 std::default::Default::default()
3273 }
3274
3275 /// Sets the value of [parent][crate::model::ListPostureDeploymentsRequest::parent].
3276 ///
3277 /// # Example
3278 /// ```ignore,no_run
3279 /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3280 /// # let organization_id = "organization_id";
3281 /// # let location_id = "location_id";
3282 /// let x = ListPostureDeploymentsRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
3283 /// ```
3284 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3285 self.parent = v.into();
3286 self
3287 }
3288
3289 /// Sets the value of [page_size][crate::model::ListPostureDeploymentsRequest::page_size].
3290 ///
3291 /// # Example
3292 /// ```ignore,no_run
3293 /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3294 /// let x = ListPostureDeploymentsRequest::new().set_page_size(42);
3295 /// ```
3296 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3297 self.page_size = v.into();
3298 self
3299 }
3300
3301 /// Sets the value of [page_token][crate::model::ListPostureDeploymentsRequest::page_token].
3302 ///
3303 /// # Example
3304 /// ```ignore,no_run
3305 /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3306 /// let x = ListPostureDeploymentsRequest::new().set_page_token("example");
3307 /// ```
3308 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3309 self.page_token = v.into();
3310 self
3311 }
3312
3313 /// Sets the value of [filter][crate::model::ListPostureDeploymentsRequest::filter].
3314 ///
3315 /// # Example
3316 /// ```ignore,no_run
3317 /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsRequest;
3318 /// let x = ListPostureDeploymentsRequest::new().set_filter("example");
3319 /// ```
3320 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3321 self.filter = v.into();
3322 self
3323 }
3324}
3325
3326impl wkt::message::Message for ListPostureDeploymentsRequest {
3327 fn typename() -> &'static str {
3328 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsRequest"
3329 }
3330}
3331
3332/// Message for response to listing PostureDeployments.
3333#[derive(Clone, Default, PartialEq)]
3334#[non_exhaustive]
3335pub struct ListPostureDeploymentsResponse {
3336 /// The list of PostureDeployment.
3337 pub posture_deployments: std::vec::Vec<crate::model::PostureDeployment>,
3338
3339 /// A token identifying a page of results the server should return.
3340 pub next_page_token: std::string::String,
3341
3342 /// Locations that could not be reached.
3343 pub unreachable: std::vec::Vec<std::string::String>,
3344
3345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3346}
3347
3348impl ListPostureDeploymentsResponse {
3349 /// Creates a new default instance.
3350 pub fn new() -> Self {
3351 std::default::Default::default()
3352 }
3353
3354 /// Sets the value of [posture_deployments][crate::model::ListPostureDeploymentsResponse::posture_deployments].
3355 ///
3356 /// # Example
3357 /// ```ignore,no_run
3358 /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsResponse;
3359 /// use google_cloud_securityposture_v1::model::PostureDeployment;
3360 /// let x = ListPostureDeploymentsResponse::new()
3361 /// .set_posture_deployments([
3362 /// PostureDeployment::default()/* use setters */,
3363 /// PostureDeployment::default()/* use (different) setters */,
3364 /// ]);
3365 /// ```
3366 pub fn set_posture_deployments<T, V>(mut self, v: T) -> Self
3367 where
3368 T: std::iter::IntoIterator<Item = V>,
3369 V: std::convert::Into<crate::model::PostureDeployment>,
3370 {
3371 use std::iter::Iterator;
3372 self.posture_deployments = v.into_iter().map(|i| i.into()).collect();
3373 self
3374 }
3375
3376 /// Sets the value of [next_page_token][crate::model::ListPostureDeploymentsResponse::next_page_token].
3377 ///
3378 /// # Example
3379 /// ```ignore,no_run
3380 /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsResponse;
3381 /// let x = ListPostureDeploymentsResponse::new().set_next_page_token("example");
3382 /// ```
3383 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3384 self.next_page_token = v.into();
3385 self
3386 }
3387
3388 /// Sets the value of [unreachable][crate::model::ListPostureDeploymentsResponse::unreachable].
3389 ///
3390 /// # Example
3391 /// ```ignore,no_run
3392 /// # use google_cloud_securityposture_v1::model::ListPostureDeploymentsResponse;
3393 /// let x = ListPostureDeploymentsResponse::new().set_unreachable(["a", "b", "c"]);
3394 /// ```
3395 pub fn set_unreachable<T, V>(mut self, v: T) -> Self
3396 where
3397 T: std::iter::IntoIterator<Item = V>,
3398 V: std::convert::Into<std::string::String>,
3399 {
3400 use std::iter::Iterator;
3401 self.unreachable = v.into_iter().map(|i| i.into()).collect();
3402 self
3403 }
3404}
3405
3406impl wkt::message::Message for ListPostureDeploymentsResponse {
3407 fn typename() -> &'static str {
3408 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureDeploymentsResponse"
3409 }
3410}
3411
3412#[doc(hidden)]
3413impl google_cloud_gax::paginator::internal::PageableResponse for ListPostureDeploymentsResponse {
3414 type PageItem = crate::model::PostureDeployment;
3415
3416 fn items(self) -> std::vec::Vec<Self::PageItem> {
3417 self.posture_deployments
3418 }
3419
3420 fn next_page_token(&self) -> std::string::String {
3421 use std::clone::Clone;
3422 self.next_page_token.clone()
3423 }
3424}
3425
3426/// Message for getting a PostureDeployment.
3427#[derive(Clone, Default, PartialEq)]
3428#[non_exhaustive]
3429pub struct GetPostureDeploymentRequest {
3430 /// Required. Name of the resource.
3431 pub name: std::string::String,
3432
3433 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3434}
3435
3436impl GetPostureDeploymentRequest {
3437 /// Creates a new default instance.
3438 pub fn new() -> Self {
3439 std::default::Default::default()
3440 }
3441
3442 /// Sets the value of [name][crate::model::GetPostureDeploymentRequest::name].
3443 ///
3444 /// # Example
3445 /// ```ignore,no_run
3446 /// # use google_cloud_securityposture_v1::model::GetPostureDeploymentRequest;
3447 /// # let organization_id = "organization_id";
3448 /// # let location_id = "location_id";
3449 /// # let posture_deployment_id = "posture_deployment_id";
3450 /// let x = GetPostureDeploymentRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"));
3451 /// ```
3452 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3453 self.name = v.into();
3454 self
3455 }
3456}
3457
3458impl wkt::message::Message for GetPostureDeploymentRequest {
3459 fn typename() -> &'static str {
3460 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureDeploymentRequest"
3461 }
3462}
3463
3464/// Message for creating a PostureDeployment.
3465#[derive(Clone, Default, PartialEq)]
3466#[non_exhaustive]
3467pub struct CreatePostureDeploymentRequest {
3468 /// Required. Value for parent.
3469 /// Format: organizations/{org_id}/locations/{location}
3470 pub parent: std::string::String,
3471
3472 /// Required. User provided identifier. It should be unique in scope of an
3473 /// Organization and location.
3474 pub posture_deployment_id: std::string::String,
3475
3476 /// Required. The resource being created.
3477 pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
3478
3479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3480}
3481
3482impl CreatePostureDeploymentRequest {
3483 /// Creates a new default instance.
3484 pub fn new() -> Self {
3485 std::default::Default::default()
3486 }
3487
3488 /// Sets the value of [parent][crate::model::CreatePostureDeploymentRequest::parent].
3489 ///
3490 /// # Example
3491 /// ```ignore,no_run
3492 /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3493 /// # let organization_id = "organization_id";
3494 /// # let location_id = "location_id";
3495 /// let x = CreatePostureDeploymentRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
3496 /// ```
3497 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3498 self.parent = v.into();
3499 self
3500 }
3501
3502 /// Sets the value of [posture_deployment_id][crate::model::CreatePostureDeploymentRequest::posture_deployment_id].
3503 ///
3504 /// # Example
3505 /// ```ignore,no_run
3506 /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3507 /// let x = CreatePostureDeploymentRequest::new().set_posture_deployment_id("example");
3508 /// ```
3509 pub fn set_posture_deployment_id<T: std::convert::Into<std::string::String>>(
3510 mut self,
3511 v: T,
3512 ) -> Self {
3513 self.posture_deployment_id = v.into();
3514 self
3515 }
3516
3517 /// Sets the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
3518 ///
3519 /// # Example
3520 /// ```ignore,no_run
3521 /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3522 /// use google_cloud_securityposture_v1::model::PostureDeployment;
3523 /// let x = CreatePostureDeploymentRequest::new().set_posture_deployment(PostureDeployment::default()/* use setters */);
3524 /// ```
3525 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
3526 where
3527 T: std::convert::Into<crate::model::PostureDeployment>,
3528 {
3529 self.posture_deployment = std::option::Option::Some(v.into());
3530 self
3531 }
3532
3533 /// Sets or clears the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
3534 ///
3535 /// # Example
3536 /// ```ignore,no_run
3537 /// # use google_cloud_securityposture_v1::model::CreatePostureDeploymentRequest;
3538 /// use google_cloud_securityposture_v1::model::PostureDeployment;
3539 /// let x = CreatePostureDeploymentRequest::new().set_or_clear_posture_deployment(Some(PostureDeployment::default()/* use setters */));
3540 /// let x = CreatePostureDeploymentRequest::new().set_or_clear_posture_deployment(None::<PostureDeployment>);
3541 /// ```
3542 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
3543 where
3544 T: std::convert::Into<crate::model::PostureDeployment>,
3545 {
3546 self.posture_deployment = v.map(|x| x.into());
3547 self
3548 }
3549}
3550
3551impl wkt::message::Message for CreatePostureDeploymentRequest {
3552 fn typename() -> &'static str {
3553 "type.googleapis.com/google.cloud.securityposture.v1.CreatePostureDeploymentRequest"
3554 }
3555}
3556
3557/// Message for updating a PostureDeployment.
3558#[derive(Clone, Default, PartialEq)]
3559#[non_exhaustive]
3560pub struct UpdatePostureDeploymentRequest {
3561 /// Required. Field mask is used to specify the fields to be overwritten in the
3562 /// PostureDeployment resource by the update.
3563 /// The fields specified in the update_mask are relative to the resource, not
3564 /// the full request. A field will be overwritten if it is in the mask. If the
3565 /// user does not provide a mask then all fields will be overwritten.
3566 pub update_mask: std::option::Option<wkt::FieldMask>,
3567
3568 /// Required. The resource being updated.
3569 pub posture_deployment: std::option::Option<crate::model::PostureDeployment>,
3570
3571 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3572}
3573
3574impl UpdatePostureDeploymentRequest {
3575 /// Creates a new default instance.
3576 pub fn new() -> Self {
3577 std::default::Default::default()
3578 }
3579
3580 /// Sets the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
3581 ///
3582 /// # Example
3583 /// ```ignore,no_run
3584 /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3585 /// use wkt::FieldMask;
3586 /// let x = UpdatePostureDeploymentRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3587 /// ```
3588 pub fn set_update_mask<T>(mut self, v: T) -> Self
3589 where
3590 T: std::convert::Into<wkt::FieldMask>,
3591 {
3592 self.update_mask = std::option::Option::Some(v.into());
3593 self
3594 }
3595
3596 /// Sets or clears the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
3597 ///
3598 /// # Example
3599 /// ```ignore,no_run
3600 /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3601 /// use wkt::FieldMask;
3602 /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3603 /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3604 /// ```
3605 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3606 where
3607 T: std::convert::Into<wkt::FieldMask>,
3608 {
3609 self.update_mask = v.map(|x| x.into());
3610 self
3611 }
3612
3613 /// Sets the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
3614 ///
3615 /// # Example
3616 /// ```ignore,no_run
3617 /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3618 /// use google_cloud_securityposture_v1::model::PostureDeployment;
3619 /// let x = UpdatePostureDeploymentRequest::new().set_posture_deployment(PostureDeployment::default()/* use setters */);
3620 /// ```
3621 pub fn set_posture_deployment<T>(mut self, v: T) -> Self
3622 where
3623 T: std::convert::Into<crate::model::PostureDeployment>,
3624 {
3625 self.posture_deployment = std::option::Option::Some(v.into());
3626 self
3627 }
3628
3629 /// Sets or clears the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
3630 ///
3631 /// # Example
3632 /// ```ignore,no_run
3633 /// # use google_cloud_securityposture_v1::model::UpdatePostureDeploymentRequest;
3634 /// use google_cloud_securityposture_v1::model::PostureDeployment;
3635 /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_posture_deployment(Some(PostureDeployment::default()/* use setters */));
3636 /// let x = UpdatePostureDeploymentRequest::new().set_or_clear_posture_deployment(None::<PostureDeployment>);
3637 /// ```
3638 pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
3639 where
3640 T: std::convert::Into<crate::model::PostureDeployment>,
3641 {
3642 self.posture_deployment = v.map(|x| x.into());
3643 self
3644 }
3645}
3646
3647impl wkt::message::Message for UpdatePostureDeploymentRequest {
3648 fn typename() -> &'static str {
3649 "type.googleapis.com/google.cloud.securityposture.v1.UpdatePostureDeploymentRequest"
3650 }
3651}
3652
3653/// Message for deleting a PostureDeployment.
3654#[derive(Clone, Default, PartialEq)]
3655#[non_exhaustive]
3656pub struct DeletePostureDeploymentRequest {
3657 /// Required. Name of the resource.
3658 pub name: std::string::String,
3659
3660 /// Optional. Etag value of the PostureDeployment to be deleted.
3661 pub etag: std::string::String,
3662
3663 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3664}
3665
3666impl DeletePostureDeploymentRequest {
3667 /// Creates a new default instance.
3668 pub fn new() -> Self {
3669 std::default::Default::default()
3670 }
3671
3672 /// Sets the value of [name][crate::model::DeletePostureDeploymentRequest::name].
3673 ///
3674 /// # Example
3675 /// ```ignore,no_run
3676 /// # use google_cloud_securityposture_v1::model::DeletePostureDeploymentRequest;
3677 /// # let organization_id = "organization_id";
3678 /// # let location_id = "location_id";
3679 /// # let posture_deployment_id = "posture_deployment_id";
3680 /// let x = DeletePostureDeploymentRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureDeployments/{posture_deployment_id}"));
3681 /// ```
3682 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3683 self.name = v.into();
3684 self
3685 }
3686
3687 /// Sets the value of [etag][crate::model::DeletePostureDeploymentRequest::etag].
3688 ///
3689 /// # Example
3690 /// ```ignore,no_run
3691 /// # use google_cloud_securityposture_v1::model::DeletePostureDeploymentRequest;
3692 /// let x = DeletePostureDeploymentRequest::new().set_etag("example");
3693 /// ```
3694 pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3695 self.etag = v.into();
3696 self
3697 }
3698}
3699
3700impl wkt::message::Message for DeletePostureDeploymentRequest {
3701 fn typename() -> &'static str {
3702 "type.googleapis.com/google.cloud.securityposture.v1.DeletePostureDeploymentRequest"
3703 }
3704}
3705
3706/// PostureTemplates
3707/// Message describing PostureTemplate object.
3708#[derive(Clone, Default, PartialEq)]
3709#[non_exhaustive]
3710pub struct PostureTemplate {
3711 /// Output only. Identifier. The name of the Posture template will be of the
3712 /// format
3713 /// organizations/{organization}/locations/{location}/postureTemplates/{postureTemplate}
3714 pub name: std::string::String,
3715
3716 /// Output only. The revision_id of a PostureTemplate.
3717 pub revision_id: std::string::String,
3718
3719 /// Output only. Description of the Posture template.
3720 pub description: std::string::String,
3721
3722 /// Output only. State of PostureTemplate resource.
3723 pub state: crate::model::posture_template::State,
3724
3725 /// Output only. Policy_sets to be used by the user.
3726 pub policy_sets: std::vec::Vec<crate::model::PolicySet>,
3727
3728 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3729}
3730
3731impl PostureTemplate {
3732 /// Creates a new default instance.
3733 pub fn new() -> Self {
3734 std::default::Default::default()
3735 }
3736
3737 /// Sets the value of [name][crate::model::PostureTemplate::name].
3738 ///
3739 /// # Example
3740 /// ```ignore,no_run
3741 /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3742 /// # let organization_id = "organization_id";
3743 /// # let location_id = "location_id";
3744 /// # let posture_template_id = "posture_template_id";
3745 /// let x = PostureTemplate::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureTemplates/{posture_template_id}"));
3746 /// ```
3747 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3748 self.name = v.into();
3749 self
3750 }
3751
3752 /// Sets the value of [revision_id][crate::model::PostureTemplate::revision_id].
3753 ///
3754 /// # Example
3755 /// ```ignore,no_run
3756 /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3757 /// let x = PostureTemplate::new().set_revision_id("example");
3758 /// ```
3759 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3760 self.revision_id = v.into();
3761 self
3762 }
3763
3764 /// Sets the value of [description][crate::model::PostureTemplate::description].
3765 ///
3766 /// # Example
3767 /// ```ignore,no_run
3768 /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3769 /// let x = PostureTemplate::new().set_description("example");
3770 /// ```
3771 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3772 self.description = v.into();
3773 self
3774 }
3775
3776 /// Sets the value of [state][crate::model::PostureTemplate::state].
3777 ///
3778 /// # Example
3779 /// ```ignore,no_run
3780 /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3781 /// use google_cloud_securityposture_v1::model::posture_template::State;
3782 /// let x0 = PostureTemplate::new().set_state(State::Active);
3783 /// let x1 = PostureTemplate::new().set_state(State::Deprecated);
3784 /// ```
3785 pub fn set_state<T: std::convert::Into<crate::model::posture_template::State>>(
3786 mut self,
3787 v: T,
3788 ) -> Self {
3789 self.state = v.into();
3790 self
3791 }
3792
3793 /// Sets the value of [policy_sets][crate::model::PostureTemplate::policy_sets].
3794 ///
3795 /// # Example
3796 /// ```ignore,no_run
3797 /// # use google_cloud_securityposture_v1::model::PostureTemplate;
3798 /// use google_cloud_securityposture_v1::model::PolicySet;
3799 /// let x = PostureTemplate::new()
3800 /// .set_policy_sets([
3801 /// PolicySet::default()/* use setters */,
3802 /// PolicySet::default()/* use (different) setters */,
3803 /// ]);
3804 /// ```
3805 pub fn set_policy_sets<T, V>(mut self, v: T) -> Self
3806 where
3807 T: std::iter::IntoIterator<Item = V>,
3808 V: std::convert::Into<crate::model::PolicySet>,
3809 {
3810 use std::iter::Iterator;
3811 self.policy_sets = v.into_iter().map(|i| i.into()).collect();
3812 self
3813 }
3814}
3815
3816impl wkt::message::Message for PostureTemplate {
3817 fn typename() -> &'static str {
3818 "type.googleapis.com/google.cloud.securityposture.v1.PostureTemplate"
3819 }
3820}
3821
3822/// Defines additional types related to [PostureTemplate].
3823pub mod posture_template {
3824 #[allow(unused_imports)]
3825 use super::*;
3826
3827 /// State of a PostureTemplate
3828 ///
3829 /// # Working with unknown values
3830 ///
3831 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3832 /// additional enum variants at any time. Adding new variants is not considered
3833 /// a breaking change. Applications should write their code in anticipation of:
3834 ///
3835 /// - New values appearing in future releases of the client library, **and**
3836 /// - New values received dynamically, without application changes.
3837 ///
3838 /// Please consult the [Working with enums] section in the user guide for some
3839 /// guidelines.
3840 ///
3841 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3842 #[derive(Clone, Debug, PartialEq)]
3843 #[non_exhaustive]
3844 pub enum State {
3845 /// Unspecified state
3846 Unspecified,
3847 /// If the Posture template is adhering to the latest controls and standards.
3848 Active,
3849 /// If the Posture template controls and standards are outdated and not
3850 /// recommended for use.
3851 Deprecated,
3852 /// If set, the enum was initialized with an unknown value.
3853 ///
3854 /// Applications can examine the value using [State::value] or
3855 /// [State::name].
3856 UnknownValue(state::UnknownValue),
3857 }
3858
3859 #[doc(hidden)]
3860 pub mod state {
3861 #[allow(unused_imports)]
3862 use super::*;
3863 #[derive(Clone, Debug, PartialEq)]
3864 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3865 }
3866
3867 impl State {
3868 /// Gets the enum value.
3869 ///
3870 /// Returns `None` if the enum contains an unknown value deserialized from
3871 /// the string representation of enums.
3872 pub fn value(&self) -> std::option::Option<i32> {
3873 match self {
3874 Self::Unspecified => std::option::Option::Some(0),
3875 Self::Active => std::option::Option::Some(1),
3876 Self::Deprecated => std::option::Option::Some(2),
3877 Self::UnknownValue(u) => u.0.value(),
3878 }
3879 }
3880
3881 /// Gets the enum value as a string.
3882 ///
3883 /// Returns `None` if the enum contains an unknown value deserialized from
3884 /// the integer representation of enums.
3885 pub fn name(&self) -> std::option::Option<&str> {
3886 match self {
3887 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3888 Self::Active => std::option::Option::Some("ACTIVE"),
3889 Self::Deprecated => std::option::Option::Some("DEPRECATED"),
3890 Self::UnknownValue(u) => u.0.name(),
3891 }
3892 }
3893 }
3894
3895 impl std::default::Default for State {
3896 fn default() -> Self {
3897 use std::convert::From;
3898 Self::from(0)
3899 }
3900 }
3901
3902 impl std::fmt::Display for State {
3903 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3904 wkt::internal::display_enum(f, self.name(), self.value())
3905 }
3906 }
3907
3908 impl std::convert::From<i32> for State {
3909 fn from(value: i32) -> Self {
3910 match value {
3911 0 => Self::Unspecified,
3912 1 => Self::Active,
3913 2 => Self::Deprecated,
3914 _ => Self::UnknownValue(state::UnknownValue(
3915 wkt::internal::UnknownEnumValue::Integer(value),
3916 )),
3917 }
3918 }
3919 }
3920
3921 impl std::convert::From<&str> for State {
3922 fn from(value: &str) -> Self {
3923 use std::string::ToString;
3924 match value {
3925 "STATE_UNSPECIFIED" => Self::Unspecified,
3926 "ACTIVE" => Self::Active,
3927 "DEPRECATED" => Self::Deprecated,
3928 _ => Self::UnknownValue(state::UnknownValue(
3929 wkt::internal::UnknownEnumValue::String(value.to_string()),
3930 )),
3931 }
3932 }
3933 }
3934
3935 impl serde::ser::Serialize for State {
3936 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3937 where
3938 S: serde::Serializer,
3939 {
3940 match self {
3941 Self::Unspecified => serializer.serialize_i32(0),
3942 Self::Active => serializer.serialize_i32(1),
3943 Self::Deprecated => serializer.serialize_i32(2),
3944 Self::UnknownValue(u) => u.0.serialize(serializer),
3945 }
3946 }
3947 }
3948
3949 impl<'de> serde::de::Deserialize<'de> for State {
3950 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3951 where
3952 D: serde::Deserializer<'de>,
3953 {
3954 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3955 ".google.cloud.securityposture.v1.PostureTemplate.State",
3956 ))
3957 }
3958 }
3959}
3960
3961/// Message for requesting list of Posture Templates.
3962#[derive(Clone, Default, PartialEq)]
3963#[non_exhaustive]
3964pub struct ListPostureTemplatesRequest {
3965 /// Required. Parent value for ListPostureTemplatesRequest.
3966 pub parent: std::string::String,
3967
3968 /// Optional. Requested page size. Server may return fewer items than
3969 /// requested. If unspecified, server will pick an appropriate default.
3970 pub page_size: i32,
3971
3972 /// Optional. A token identifying a page of results the server should return.
3973 pub page_token: std::string::String,
3974
3975 /// Optional. Filter to be applied on the resource, defined by EBNF grammar
3976 /// <https://google.aip.dev/assets/misc/ebnf-filtering.txt>.
3977 pub filter: std::string::String,
3978
3979 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3980}
3981
3982impl ListPostureTemplatesRequest {
3983 /// Creates a new default instance.
3984 pub fn new() -> Self {
3985 std::default::Default::default()
3986 }
3987
3988 /// Sets the value of [parent][crate::model::ListPostureTemplatesRequest::parent].
3989 ///
3990 /// # Example
3991 /// ```ignore,no_run
3992 /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
3993 /// # let organization_id = "organization_id";
3994 /// # let location_id = "location_id";
3995 /// let x = ListPostureTemplatesRequest::new().set_parent(format!("organizations/{organization_id}/locations/{location_id}"));
3996 /// ```
3997 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3998 self.parent = v.into();
3999 self
4000 }
4001
4002 /// Sets the value of [page_size][crate::model::ListPostureTemplatesRequest::page_size].
4003 ///
4004 /// # Example
4005 /// ```ignore,no_run
4006 /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
4007 /// let x = ListPostureTemplatesRequest::new().set_page_size(42);
4008 /// ```
4009 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4010 self.page_size = v.into();
4011 self
4012 }
4013
4014 /// Sets the value of [page_token][crate::model::ListPostureTemplatesRequest::page_token].
4015 ///
4016 /// # Example
4017 /// ```ignore,no_run
4018 /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
4019 /// let x = ListPostureTemplatesRequest::new().set_page_token("example");
4020 /// ```
4021 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4022 self.page_token = v.into();
4023 self
4024 }
4025
4026 /// Sets the value of [filter][crate::model::ListPostureTemplatesRequest::filter].
4027 ///
4028 /// # Example
4029 /// ```ignore,no_run
4030 /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesRequest;
4031 /// let x = ListPostureTemplatesRequest::new().set_filter("example");
4032 /// ```
4033 pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4034 self.filter = v.into();
4035 self
4036 }
4037}
4038
4039impl wkt::message::Message for ListPostureTemplatesRequest {
4040 fn typename() -> &'static str {
4041 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesRequest"
4042 }
4043}
4044
4045/// Message for response to listing PostureTemplates.
4046#[derive(Clone, Default, PartialEq)]
4047#[non_exhaustive]
4048pub struct ListPostureTemplatesResponse {
4049 /// The list of PostureTemplate.
4050 pub posture_templates: std::vec::Vec<crate::model::PostureTemplate>,
4051
4052 /// A token identifying a page of results the server should return.
4053 pub next_page_token: std::string::String,
4054
4055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4056}
4057
4058impl ListPostureTemplatesResponse {
4059 /// Creates a new default instance.
4060 pub fn new() -> Self {
4061 std::default::Default::default()
4062 }
4063
4064 /// Sets the value of [posture_templates][crate::model::ListPostureTemplatesResponse::posture_templates].
4065 ///
4066 /// # Example
4067 /// ```ignore,no_run
4068 /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesResponse;
4069 /// use google_cloud_securityposture_v1::model::PostureTemplate;
4070 /// let x = ListPostureTemplatesResponse::new()
4071 /// .set_posture_templates([
4072 /// PostureTemplate::default()/* use setters */,
4073 /// PostureTemplate::default()/* use (different) setters */,
4074 /// ]);
4075 /// ```
4076 pub fn set_posture_templates<T, V>(mut self, v: T) -> Self
4077 where
4078 T: std::iter::IntoIterator<Item = V>,
4079 V: std::convert::Into<crate::model::PostureTemplate>,
4080 {
4081 use std::iter::Iterator;
4082 self.posture_templates = v.into_iter().map(|i| i.into()).collect();
4083 self
4084 }
4085
4086 /// Sets the value of [next_page_token][crate::model::ListPostureTemplatesResponse::next_page_token].
4087 ///
4088 /// # Example
4089 /// ```ignore,no_run
4090 /// # use google_cloud_securityposture_v1::model::ListPostureTemplatesResponse;
4091 /// let x = ListPostureTemplatesResponse::new().set_next_page_token("example");
4092 /// ```
4093 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4094 self.next_page_token = v.into();
4095 self
4096 }
4097}
4098
4099impl wkt::message::Message for ListPostureTemplatesResponse {
4100 fn typename() -> &'static str {
4101 "type.googleapis.com/google.cloud.securityposture.v1.ListPostureTemplatesResponse"
4102 }
4103}
4104
4105#[doc(hidden)]
4106impl google_cloud_gax::paginator::internal::PageableResponse for ListPostureTemplatesResponse {
4107 type PageItem = crate::model::PostureTemplate;
4108
4109 fn items(self) -> std::vec::Vec<Self::PageItem> {
4110 self.posture_templates
4111 }
4112
4113 fn next_page_token(&self) -> std::string::String {
4114 use std::clone::Clone;
4115 self.next_page_token.clone()
4116 }
4117}
4118
4119/// Message for getting a Posture Template.
4120#[derive(Clone, Default, PartialEq)]
4121#[non_exhaustive]
4122pub struct GetPostureTemplateRequest {
4123 /// Required. Name of the resource.
4124 pub name: std::string::String,
4125
4126 /// Optional. Specific revision_id of a Posture Template.
4127 /// PostureTemplate revision_id which needs to be retrieved.
4128 pub revision_id: std::string::String,
4129
4130 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4131}
4132
4133impl GetPostureTemplateRequest {
4134 /// Creates a new default instance.
4135 pub fn new() -> Self {
4136 std::default::Default::default()
4137 }
4138
4139 /// Sets the value of [name][crate::model::GetPostureTemplateRequest::name].
4140 ///
4141 /// # Example
4142 /// ```ignore,no_run
4143 /// # use google_cloud_securityposture_v1::model::GetPostureTemplateRequest;
4144 /// # let organization_id = "organization_id";
4145 /// # let location_id = "location_id";
4146 /// # let posture_template_id = "posture_template_id";
4147 /// let x = GetPostureTemplateRequest::new().set_name(format!("organizations/{organization_id}/locations/{location_id}/postureTemplates/{posture_template_id}"));
4148 /// ```
4149 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4150 self.name = v.into();
4151 self
4152 }
4153
4154 /// Sets the value of [revision_id][crate::model::GetPostureTemplateRequest::revision_id].
4155 ///
4156 /// # Example
4157 /// ```ignore,no_run
4158 /// # use google_cloud_securityposture_v1::model::GetPostureTemplateRequest;
4159 /// let x = GetPostureTemplateRequest::new().set_revision_id("example");
4160 /// ```
4161 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4162 self.revision_id = v.into();
4163 self
4164 }
4165}
4166
4167impl wkt::message::Message for GetPostureTemplateRequest {
4168 fn typename() -> &'static str {
4169 "type.googleapis.com/google.cloud.securityposture.v1.GetPostureTemplateRequest"
4170 }
4171}
4172
4173/// Message for Security Health Analytics built-in detector.
4174#[derive(Clone, Default, PartialEq)]
4175#[non_exhaustive]
4176pub struct SecurityHealthAnalyticsModule {
4177 /// Required. The name of the module eg: BIGQUERY_TABLE_CMEK_DISABLED.
4178 pub module_name: std::string::String,
4179
4180 /// The state of enablement for the module at its level of the resource
4181 /// hierarchy.
4182 pub module_enablement_state: crate::model::EnablementState,
4183
4184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4185}
4186
4187impl SecurityHealthAnalyticsModule {
4188 /// Creates a new default instance.
4189 pub fn new() -> Self {
4190 std::default::Default::default()
4191 }
4192
4193 /// Sets the value of [module_name][crate::model::SecurityHealthAnalyticsModule::module_name].
4194 ///
4195 /// # Example
4196 /// ```ignore,no_run
4197 /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
4198 /// let x = SecurityHealthAnalyticsModule::new().set_module_name("example");
4199 /// ```
4200 pub fn set_module_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4201 self.module_name = v.into();
4202 self
4203 }
4204
4205 /// Sets the value of [module_enablement_state][crate::model::SecurityHealthAnalyticsModule::module_enablement_state].
4206 ///
4207 /// # Example
4208 /// ```ignore,no_run
4209 /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsModule;
4210 /// use google_cloud_securityposture_v1::model::EnablementState;
4211 /// let x0 = SecurityHealthAnalyticsModule::new().set_module_enablement_state(EnablementState::Enabled);
4212 /// let x1 = SecurityHealthAnalyticsModule::new().set_module_enablement_state(EnablementState::Disabled);
4213 /// ```
4214 pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
4215 mut self,
4216 v: T,
4217 ) -> Self {
4218 self.module_enablement_state = v.into();
4219 self
4220 }
4221}
4222
4223impl wkt::message::Message for SecurityHealthAnalyticsModule {
4224 fn typename() -> &'static str {
4225 "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsModule"
4226 }
4227}
4228
4229/// Message for SHA Custom Module
4230#[derive(Clone, Default, PartialEq)]
4231#[non_exhaustive]
4232pub struct SecurityHealthAnalyticsCustomModule {
4233 /// Output only. Immutable. The id of the custom module.
4234 /// The id is server-generated and is not user settable.
4235 /// It will be a numeric id containing 1-20 digits.
4236 pub id: std::string::String,
4237
4238 /// Optional. The display name of the Security Health Analytics custom module.
4239 /// This display name becomes the finding category for all findings that are
4240 /// returned by this custom module. The display name must be between 1 and
4241 /// 128 characters, start with a lowercase letter, and contain alphanumeric
4242 /// characters or underscores only.
4243 pub display_name: std::string::String,
4244
4245 /// Required. custom module details
4246 pub config: std::option::Option<crate::model::CustomConfig>,
4247
4248 /// The state of enablement for the module at its level of the resource
4249 /// hierarchy.
4250 pub module_enablement_state: crate::model::EnablementState,
4251
4252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4253}
4254
4255impl SecurityHealthAnalyticsCustomModule {
4256 /// Creates a new default instance.
4257 pub fn new() -> Self {
4258 std::default::Default::default()
4259 }
4260
4261 /// Sets the value of [id][crate::model::SecurityHealthAnalyticsCustomModule::id].
4262 ///
4263 /// # Example
4264 /// ```ignore,no_run
4265 /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4266 /// let x = SecurityHealthAnalyticsCustomModule::new().set_id("example");
4267 /// ```
4268 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4269 self.id = v.into();
4270 self
4271 }
4272
4273 /// Sets the value of [display_name][crate::model::SecurityHealthAnalyticsCustomModule::display_name].
4274 ///
4275 /// # Example
4276 /// ```ignore,no_run
4277 /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4278 /// let x = SecurityHealthAnalyticsCustomModule::new().set_display_name("example");
4279 /// ```
4280 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4281 self.display_name = v.into();
4282 self
4283 }
4284
4285 /// Sets the value of [config][crate::model::SecurityHealthAnalyticsCustomModule::config].
4286 ///
4287 /// # Example
4288 /// ```ignore,no_run
4289 /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4290 /// use google_cloud_securityposture_v1::model::CustomConfig;
4291 /// let x = SecurityHealthAnalyticsCustomModule::new().set_config(CustomConfig::default()/* use setters */);
4292 /// ```
4293 pub fn set_config<T>(mut self, v: T) -> Self
4294 where
4295 T: std::convert::Into<crate::model::CustomConfig>,
4296 {
4297 self.config = std::option::Option::Some(v.into());
4298 self
4299 }
4300
4301 /// Sets or clears the value of [config][crate::model::SecurityHealthAnalyticsCustomModule::config].
4302 ///
4303 /// # Example
4304 /// ```ignore,no_run
4305 /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4306 /// use google_cloud_securityposture_v1::model::CustomConfig;
4307 /// let x = SecurityHealthAnalyticsCustomModule::new().set_or_clear_config(Some(CustomConfig::default()/* use setters */));
4308 /// let x = SecurityHealthAnalyticsCustomModule::new().set_or_clear_config(None::<CustomConfig>);
4309 /// ```
4310 pub fn set_or_clear_config<T>(mut self, v: std::option::Option<T>) -> Self
4311 where
4312 T: std::convert::Into<crate::model::CustomConfig>,
4313 {
4314 self.config = v.map(|x| x.into());
4315 self
4316 }
4317
4318 /// Sets the value of [module_enablement_state][crate::model::SecurityHealthAnalyticsCustomModule::module_enablement_state].
4319 ///
4320 /// # Example
4321 /// ```ignore,no_run
4322 /// # use google_cloud_securityposture_v1::model::SecurityHealthAnalyticsCustomModule;
4323 /// use google_cloud_securityposture_v1::model::EnablementState;
4324 /// let x0 = SecurityHealthAnalyticsCustomModule::new().set_module_enablement_state(EnablementState::Enabled);
4325 /// let x1 = SecurityHealthAnalyticsCustomModule::new().set_module_enablement_state(EnablementState::Disabled);
4326 /// ```
4327 pub fn set_module_enablement_state<T: std::convert::Into<crate::model::EnablementState>>(
4328 mut self,
4329 v: T,
4330 ) -> Self {
4331 self.module_enablement_state = v.into();
4332 self
4333 }
4334}
4335
4336impl wkt::message::Message for SecurityHealthAnalyticsCustomModule {
4337 fn typename() -> &'static str {
4338 "type.googleapis.com/google.cloud.securityposture.v1.SecurityHealthAnalyticsCustomModule"
4339 }
4340}
4341
4342/// Defines the properties in a custom module configuration for Security
4343/// Health Analytics. Use the custom module configuration to create custom
4344/// detectors that generate custom findings for resources that you specify.
4345#[derive(Clone, Default, PartialEq)]
4346#[non_exhaustive]
4347pub struct CustomConfig {
4348 /// Required. The CEL expression to evaluate to produce findings. When the
4349 /// expression evaluates to true against a resource, a finding is generated.
4350 pub predicate: std::option::Option<google_cloud_type::model::Expr>,
4351
4352 /// Optional. Custom output properties.
4353 pub custom_output: std::option::Option<crate::model::custom_config::CustomOutputSpec>,
4354
4355 /// Required. The resource types that the custom module operates on. Each
4356 /// custom module can specify up to 5 resource types.
4357 pub resource_selector: std::option::Option<crate::model::custom_config::ResourceSelector>,
4358
4359 /// Required. The severity to assign to findings generated by the module.
4360 pub severity: crate::model::custom_config::Severity,
4361
4362 /// Optional. Text that describes the vulnerability or misconfiguration that
4363 /// the custom module detects. This explanation is returned with each finding
4364 /// instance to help investigators understand the detected issue. The text must
4365 /// be enclosed in quotation marks.
4366 pub description: std::string::String,
4367
4368 /// Optional. An explanation of the recommended steps that security teams can
4369 /// take to resolve the detected issue. This explanation is returned with each
4370 /// finding generated by this module in the `nextSteps` property of the finding
4371 /// JSON.
4372 pub recommendation: std::string::String,
4373
4374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4375}
4376
4377impl CustomConfig {
4378 /// Creates a new default instance.
4379 pub fn new() -> Self {
4380 std::default::Default::default()
4381 }
4382
4383 /// Sets the value of [predicate][crate::model::CustomConfig::predicate].
4384 ///
4385 /// # Example
4386 /// ```ignore,no_run
4387 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4388 /// use google_cloud_type::model::Expr;
4389 /// let x = CustomConfig::new().set_predicate(Expr::default()/* use setters */);
4390 /// ```
4391 pub fn set_predicate<T>(mut self, v: T) -> Self
4392 where
4393 T: std::convert::Into<google_cloud_type::model::Expr>,
4394 {
4395 self.predicate = std::option::Option::Some(v.into());
4396 self
4397 }
4398
4399 /// Sets or clears the value of [predicate][crate::model::CustomConfig::predicate].
4400 ///
4401 /// # Example
4402 /// ```ignore,no_run
4403 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4404 /// use google_cloud_type::model::Expr;
4405 /// let x = CustomConfig::new().set_or_clear_predicate(Some(Expr::default()/* use setters */));
4406 /// let x = CustomConfig::new().set_or_clear_predicate(None::<Expr>);
4407 /// ```
4408 pub fn set_or_clear_predicate<T>(mut self, v: std::option::Option<T>) -> Self
4409 where
4410 T: std::convert::Into<google_cloud_type::model::Expr>,
4411 {
4412 self.predicate = v.map(|x| x.into());
4413 self
4414 }
4415
4416 /// Sets the value of [custom_output][crate::model::CustomConfig::custom_output].
4417 ///
4418 /// # Example
4419 /// ```ignore,no_run
4420 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4421 /// use google_cloud_securityposture_v1::model::custom_config::CustomOutputSpec;
4422 /// let x = CustomConfig::new().set_custom_output(CustomOutputSpec::default()/* use setters */);
4423 /// ```
4424 pub fn set_custom_output<T>(mut self, v: T) -> Self
4425 where
4426 T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
4427 {
4428 self.custom_output = std::option::Option::Some(v.into());
4429 self
4430 }
4431
4432 /// Sets or clears the value of [custom_output][crate::model::CustomConfig::custom_output].
4433 ///
4434 /// # Example
4435 /// ```ignore,no_run
4436 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4437 /// use google_cloud_securityposture_v1::model::custom_config::CustomOutputSpec;
4438 /// let x = CustomConfig::new().set_or_clear_custom_output(Some(CustomOutputSpec::default()/* use setters */));
4439 /// let x = CustomConfig::new().set_or_clear_custom_output(None::<CustomOutputSpec>);
4440 /// ```
4441 pub fn set_or_clear_custom_output<T>(mut self, v: std::option::Option<T>) -> Self
4442 where
4443 T: std::convert::Into<crate::model::custom_config::CustomOutputSpec>,
4444 {
4445 self.custom_output = v.map(|x| x.into());
4446 self
4447 }
4448
4449 /// Sets the value of [resource_selector][crate::model::CustomConfig::resource_selector].
4450 ///
4451 /// # Example
4452 /// ```ignore,no_run
4453 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4454 /// use google_cloud_securityposture_v1::model::custom_config::ResourceSelector;
4455 /// let x = CustomConfig::new().set_resource_selector(ResourceSelector::default()/* use setters */);
4456 /// ```
4457 pub fn set_resource_selector<T>(mut self, v: T) -> Self
4458 where
4459 T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
4460 {
4461 self.resource_selector = std::option::Option::Some(v.into());
4462 self
4463 }
4464
4465 /// Sets or clears the value of [resource_selector][crate::model::CustomConfig::resource_selector].
4466 ///
4467 /// # Example
4468 /// ```ignore,no_run
4469 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4470 /// use google_cloud_securityposture_v1::model::custom_config::ResourceSelector;
4471 /// let x = CustomConfig::new().set_or_clear_resource_selector(Some(ResourceSelector::default()/* use setters */));
4472 /// let x = CustomConfig::new().set_or_clear_resource_selector(None::<ResourceSelector>);
4473 /// ```
4474 pub fn set_or_clear_resource_selector<T>(mut self, v: std::option::Option<T>) -> Self
4475 where
4476 T: std::convert::Into<crate::model::custom_config::ResourceSelector>,
4477 {
4478 self.resource_selector = v.map(|x| x.into());
4479 self
4480 }
4481
4482 /// Sets the value of [severity][crate::model::CustomConfig::severity].
4483 ///
4484 /// # Example
4485 /// ```ignore,no_run
4486 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4487 /// use google_cloud_securityposture_v1::model::custom_config::Severity;
4488 /// let x0 = CustomConfig::new().set_severity(Severity::Critical);
4489 /// let x1 = CustomConfig::new().set_severity(Severity::High);
4490 /// let x2 = CustomConfig::new().set_severity(Severity::Medium);
4491 /// ```
4492 pub fn set_severity<T: std::convert::Into<crate::model::custom_config::Severity>>(
4493 mut self,
4494 v: T,
4495 ) -> Self {
4496 self.severity = v.into();
4497 self
4498 }
4499
4500 /// Sets the value of [description][crate::model::CustomConfig::description].
4501 ///
4502 /// # Example
4503 /// ```ignore,no_run
4504 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4505 /// let x = CustomConfig::new().set_description("example");
4506 /// ```
4507 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4508 self.description = v.into();
4509 self
4510 }
4511
4512 /// Sets the value of [recommendation][crate::model::CustomConfig::recommendation].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_securityposture_v1::model::CustomConfig;
4517 /// let x = CustomConfig::new().set_recommendation("example");
4518 /// ```
4519 pub fn set_recommendation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4520 self.recommendation = v.into();
4521 self
4522 }
4523}
4524
4525impl wkt::message::Message for CustomConfig {
4526 fn typename() -> &'static str {
4527 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig"
4528 }
4529}
4530
4531/// Defines additional types related to [CustomConfig].
4532pub mod custom_config {
4533 #[allow(unused_imports)]
4534 use super::*;
4535
4536 /// A set of optional name-value pairs that define custom source properties to
4537 /// return with each finding that is generated by the custom module. The custom
4538 /// source properties that are defined here are included in the finding JSON
4539 /// under `sourceProperties`.
4540 #[derive(Clone, Default, PartialEq)]
4541 #[non_exhaustive]
4542 pub struct CustomOutputSpec {
4543 /// Optional. A list of custom output properties to add to the finding.
4544 pub properties: std::vec::Vec<crate::model::custom_config::custom_output_spec::Property>,
4545
4546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4547 }
4548
4549 impl CustomOutputSpec {
4550 /// Creates a new default instance.
4551 pub fn new() -> Self {
4552 std::default::Default::default()
4553 }
4554
4555 /// Sets the value of [properties][crate::model::custom_config::CustomOutputSpec::properties].
4556 ///
4557 /// # Example
4558 /// ```ignore,no_run
4559 /// # use google_cloud_securityposture_v1::model::custom_config::CustomOutputSpec;
4560 /// use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4561 /// let x = CustomOutputSpec::new()
4562 /// .set_properties([
4563 /// Property::default()/* use setters */,
4564 /// Property::default()/* use (different) setters */,
4565 /// ]);
4566 /// ```
4567 pub fn set_properties<T, V>(mut self, v: T) -> Self
4568 where
4569 T: std::iter::IntoIterator<Item = V>,
4570 V: std::convert::Into<crate::model::custom_config::custom_output_spec::Property>,
4571 {
4572 use std::iter::Iterator;
4573 self.properties = v.into_iter().map(|i| i.into()).collect();
4574 self
4575 }
4576 }
4577
4578 impl wkt::message::Message for CustomOutputSpec {
4579 fn typename() -> &'static str {
4580 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec"
4581 }
4582 }
4583
4584 /// Defines additional types related to [CustomOutputSpec].
4585 pub mod custom_output_spec {
4586 #[allow(unused_imports)]
4587 use super::*;
4588
4589 /// An individual name-value pair that defines a custom source property.
4590 #[derive(Clone, Default, PartialEq)]
4591 #[non_exhaustive]
4592 pub struct Property {
4593 /// Required. Name of the property for the custom output.
4594 pub name: std::string::String,
4595
4596 /// Optional. The CEL expression for the custom output. A resource property
4597 /// can be specified to return the value of the property or a text string
4598 /// enclosed in quotation marks.
4599 pub value_expression: std::option::Option<google_cloud_type::model::Expr>,
4600
4601 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4602 }
4603
4604 impl Property {
4605 /// Creates a new default instance.
4606 pub fn new() -> Self {
4607 std::default::Default::default()
4608 }
4609
4610 /// Sets the value of [name][crate::model::custom_config::custom_output_spec::Property::name].
4611 ///
4612 /// # Example
4613 /// ```ignore,no_run
4614 /// # use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4615 /// let x = Property::new().set_name("example");
4616 /// ```
4617 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4618 self.name = v.into();
4619 self
4620 }
4621
4622 /// Sets the value of [value_expression][crate::model::custom_config::custom_output_spec::Property::value_expression].
4623 ///
4624 /// # Example
4625 /// ```ignore,no_run
4626 /// # use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4627 /// use google_cloud_type::model::Expr;
4628 /// let x = Property::new().set_value_expression(Expr::default()/* use setters */);
4629 /// ```
4630 pub fn set_value_expression<T>(mut self, v: T) -> Self
4631 where
4632 T: std::convert::Into<google_cloud_type::model::Expr>,
4633 {
4634 self.value_expression = std::option::Option::Some(v.into());
4635 self
4636 }
4637
4638 /// Sets or clears the value of [value_expression][crate::model::custom_config::custom_output_spec::Property::value_expression].
4639 ///
4640 /// # Example
4641 /// ```ignore,no_run
4642 /// # use google_cloud_securityposture_v1::model::custom_config::custom_output_spec::Property;
4643 /// use google_cloud_type::model::Expr;
4644 /// let x = Property::new().set_or_clear_value_expression(Some(Expr::default()/* use setters */));
4645 /// let x = Property::new().set_or_clear_value_expression(None::<Expr>);
4646 /// ```
4647 pub fn set_or_clear_value_expression<T>(mut self, v: std::option::Option<T>) -> Self
4648 where
4649 T: std::convert::Into<google_cloud_type::model::Expr>,
4650 {
4651 self.value_expression = v.map(|x| x.into());
4652 self
4653 }
4654 }
4655
4656 impl wkt::message::Message for Property {
4657 fn typename() -> &'static str {
4658 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.CustomOutputSpec.Property"
4659 }
4660 }
4661 }
4662
4663 /// Resource for selecting resource type.
4664 #[derive(Clone, Default, PartialEq)]
4665 #[non_exhaustive]
4666 pub struct ResourceSelector {
4667 /// Required. The resource types to run the detector on.
4668 pub resource_types: std::vec::Vec<std::string::String>,
4669
4670 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4671 }
4672
4673 impl ResourceSelector {
4674 /// Creates a new default instance.
4675 pub fn new() -> Self {
4676 std::default::Default::default()
4677 }
4678
4679 /// Sets the value of [resource_types][crate::model::custom_config::ResourceSelector::resource_types].
4680 ///
4681 /// # Example
4682 /// ```ignore,no_run
4683 /// # use google_cloud_securityposture_v1::model::custom_config::ResourceSelector;
4684 /// let x = ResourceSelector::new().set_resource_types(["a", "b", "c"]);
4685 /// ```
4686 pub fn set_resource_types<T, V>(mut self, v: T) -> Self
4687 where
4688 T: std::iter::IntoIterator<Item = V>,
4689 V: std::convert::Into<std::string::String>,
4690 {
4691 use std::iter::Iterator;
4692 self.resource_types = v.into_iter().map(|i| i.into()).collect();
4693 self
4694 }
4695 }
4696
4697 impl wkt::message::Message for ResourceSelector {
4698 fn typename() -> &'static str {
4699 "type.googleapis.com/google.cloud.securityposture.v1.CustomConfig.ResourceSelector"
4700 }
4701 }
4702
4703 /// Defines the valid value options for the severity of a finding.
4704 ///
4705 /// # Working with unknown values
4706 ///
4707 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4708 /// additional enum variants at any time. Adding new variants is not considered
4709 /// a breaking change. Applications should write their code in anticipation of:
4710 ///
4711 /// - New values appearing in future releases of the client library, **and**
4712 /// - New values received dynamically, without application changes.
4713 ///
4714 /// Please consult the [Working with enums] section in the user guide for some
4715 /// guidelines.
4716 ///
4717 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4718 #[derive(Clone, Debug, PartialEq)]
4719 #[non_exhaustive]
4720 pub enum Severity {
4721 /// Unspecified severity.
4722 Unspecified,
4723 /// Critical severity.
4724 Critical,
4725 /// High severity.
4726 High,
4727 /// Medium severity.
4728 Medium,
4729 /// Low severity.
4730 Low,
4731 /// If set, the enum was initialized with an unknown value.
4732 ///
4733 /// Applications can examine the value using [Severity::value] or
4734 /// [Severity::name].
4735 UnknownValue(severity::UnknownValue),
4736 }
4737
4738 #[doc(hidden)]
4739 pub mod severity {
4740 #[allow(unused_imports)]
4741 use super::*;
4742 #[derive(Clone, Debug, PartialEq)]
4743 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4744 }
4745
4746 impl Severity {
4747 /// Gets the enum value.
4748 ///
4749 /// Returns `None` if the enum contains an unknown value deserialized from
4750 /// the string representation of enums.
4751 pub fn value(&self) -> std::option::Option<i32> {
4752 match self {
4753 Self::Unspecified => std::option::Option::Some(0),
4754 Self::Critical => std::option::Option::Some(1),
4755 Self::High => std::option::Option::Some(2),
4756 Self::Medium => std::option::Option::Some(3),
4757 Self::Low => std::option::Option::Some(4),
4758 Self::UnknownValue(u) => u.0.value(),
4759 }
4760 }
4761
4762 /// Gets the enum value as a string.
4763 ///
4764 /// Returns `None` if the enum contains an unknown value deserialized from
4765 /// the integer representation of enums.
4766 pub fn name(&self) -> std::option::Option<&str> {
4767 match self {
4768 Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
4769 Self::Critical => std::option::Option::Some("CRITICAL"),
4770 Self::High => std::option::Option::Some("HIGH"),
4771 Self::Medium => std::option::Option::Some("MEDIUM"),
4772 Self::Low => std::option::Option::Some("LOW"),
4773 Self::UnknownValue(u) => u.0.name(),
4774 }
4775 }
4776 }
4777
4778 impl std::default::Default for Severity {
4779 fn default() -> Self {
4780 use std::convert::From;
4781 Self::from(0)
4782 }
4783 }
4784
4785 impl std::fmt::Display for Severity {
4786 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4787 wkt::internal::display_enum(f, self.name(), self.value())
4788 }
4789 }
4790
4791 impl std::convert::From<i32> for Severity {
4792 fn from(value: i32) -> Self {
4793 match value {
4794 0 => Self::Unspecified,
4795 1 => Self::Critical,
4796 2 => Self::High,
4797 3 => Self::Medium,
4798 4 => Self::Low,
4799 _ => Self::UnknownValue(severity::UnknownValue(
4800 wkt::internal::UnknownEnumValue::Integer(value),
4801 )),
4802 }
4803 }
4804 }
4805
4806 impl std::convert::From<&str> for Severity {
4807 fn from(value: &str) -> Self {
4808 use std::string::ToString;
4809 match value {
4810 "SEVERITY_UNSPECIFIED" => Self::Unspecified,
4811 "CRITICAL" => Self::Critical,
4812 "HIGH" => Self::High,
4813 "MEDIUM" => Self::Medium,
4814 "LOW" => Self::Low,
4815 _ => Self::UnknownValue(severity::UnknownValue(
4816 wkt::internal::UnknownEnumValue::String(value.to_string()),
4817 )),
4818 }
4819 }
4820 }
4821
4822 impl serde::ser::Serialize for Severity {
4823 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4824 where
4825 S: serde::Serializer,
4826 {
4827 match self {
4828 Self::Unspecified => serializer.serialize_i32(0),
4829 Self::Critical => serializer.serialize_i32(1),
4830 Self::High => serializer.serialize_i32(2),
4831 Self::Medium => serializer.serialize_i32(3),
4832 Self::Low => serializer.serialize_i32(4),
4833 Self::UnknownValue(u) => u.0.serialize(serializer),
4834 }
4835 }
4836 }
4837
4838 impl<'de> serde::de::Deserialize<'de> for Severity {
4839 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4840 where
4841 D: serde::Deserializer<'de>,
4842 {
4843 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
4844 ".google.cloud.securityposture.v1.CustomConfig.Severity",
4845 ))
4846 }
4847 }
4848}
4849
4850/// Possible enablement states of a service or module.
4851///
4852/// # Working with unknown values
4853///
4854/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4855/// additional enum variants at any time. Adding new variants is not considered
4856/// a breaking change. Applications should write their code in anticipation of:
4857///
4858/// - New values appearing in future releases of the client library, **and**
4859/// - New values received dynamically, without application changes.
4860///
4861/// Please consult the [Working with enums] section in the user guide for some
4862/// guidelines.
4863///
4864/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4865#[derive(Clone, Debug, PartialEq)]
4866#[non_exhaustive]
4867pub enum EnablementState {
4868 /// Default value. This value is unused.
4869 Unspecified,
4870 /// State is enabled.
4871 Enabled,
4872 /// State is disabled.
4873 Disabled,
4874 /// If set, the enum was initialized with an unknown value.
4875 ///
4876 /// Applications can examine the value using [EnablementState::value] or
4877 /// [EnablementState::name].
4878 UnknownValue(enablement_state::UnknownValue),
4879}
4880
4881#[doc(hidden)]
4882pub mod enablement_state {
4883 #[allow(unused_imports)]
4884 use super::*;
4885 #[derive(Clone, Debug, PartialEq)]
4886 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4887}
4888
4889impl EnablementState {
4890 /// Gets the enum value.
4891 ///
4892 /// Returns `None` if the enum contains an unknown value deserialized from
4893 /// the string representation of enums.
4894 pub fn value(&self) -> std::option::Option<i32> {
4895 match self {
4896 Self::Unspecified => std::option::Option::Some(0),
4897 Self::Enabled => std::option::Option::Some(1),
4898 Self::Disabled => std::option::Option::Some(2),
4899 Self::UnknownValue(u) => u.0.value(),
4900 }
4901 }
4902
4903 /// Gets the enum value as a string.
4904 ///
4905 /// Returns `None` if the enum contains an unknown value deserialized from
4906 /// the integer representation of enums.
4907 pub fn name(&self) -> std::option::Option<&str> {
4908 match self {
4909 Self::Unspecified => std::option::Option::Some("ENABLEMENT_STATE_UNSPECIFIED"),
4910 Self::Enabled => std::option::Option::Some("ENABLED"),
4911 Self::Disabled => std::option::Option::Some("DISABLED"),
4912 Self::UnknownValue(u) => u.0.name(),
4913 }
4914 }
4915}
4916
4917impl std::default::Default for EnablementState {
4918 fn default() -> Self {
4919 use std::convert::From;
4920 Self::from(0)
4921 }
4922}
4923
4924impl std::fmt::Display for EnablementState {
4925 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4926 wkt::internal::display_enum(f, self.name(), self.value())
4927 }
4928}
4929
4930impl std::convert::From<i32> for EnablementState {
4931 fn from(value: i32) -> Self {
4932 match value {
4933 0 => Self::Unspecified,
4934 1 => Self::Enabled,
4935 2 => Self::Disabled,
4936 _ => Self::UnknownValue(enablement_state::UnknownValue(
4937 wkt::internal::UnknownEnumValue::Integer(value),
4938 )),
4939 }
4940 }
4941}
4942
4943impl std::convert::From<&str> for EnablementState {
4944 fn from(value: &str) -> Self {
4945 use std::string::ToString;
4946 match value {
4947 "ENABLEMENT_STATE_UNSPECIFIED" => Self::Unspecified,
4948 "ENABLED" => Self::Enabled,
4949 "DISABLED" => Self::Disabled,
4950 _ => Self::UnknownValue(enablement_state::UnknownValue(
4951 wkt::internal::UnknownEnumValue::String(value.to_string()),
4952 )),
4953 }
4954 }
4955}
4956
4957impl serde::ser::Serialize for EnablementState {
4958 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4959 where
4960 S: serde::Serializer,
4961 {
4962 match self {
4963 Self::Unspecified => serializer.serialize_i32(0),
4964 Self::Enabled => serializer.serialize_i32(1),
4965 Self::Disabled => serializer.serialize_i32(2),
4966 Self::UnknownValue(u) => u.0.serialize(serializer),
4967 }
4968 }
4969}
4970
4971impl<'de> serde::de::Deserialize<'de> for EnablementState {
4972 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4973 where
4974 D: serde::Deserializer<'de>,
4975 {
4976 deserializer.deserialize_any(wkt::internal::EnumVisitor::<EnablementState>::new(
4977 ".google.cloud.securityposture.v1.EnablementState",
4978 ))
4979 }
4980}