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