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