#[non_exhaustive]pub struct PolicyRule {
pub condition: Option<Expr>,
pub kind: Option<Kind>,
/* private fields */
}Expand description
A rule used to express this policy.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.condition: Option<Expr>A condition which determines whether this rule is used
in the evaluation of the policy. When set, the expression field in
the `Expr’ must include from 1 to 10 subexpressions, joined by the “||”
or “&&” operators. Each subexpression must be of the form
“resource.matchTag(’<ORG_ID>/tag_key_short_name,
‘tag_value_short_name’)” or “resource.matchTagId(‘tagKeys/key_id’,
‘tagValues/value_id’)” where key_name and value_name are the resource
names for Label Keys and Values. These names are available from the Tag
Manager Service. An example expression is:
“resource.matchTag(’123456789/environment,
‘prod’)” or “resource.matchTagId(‘tagKeys/123’,
‘tagValues/456’)”.
kind: Option<Kind>Implementations§
Source§impl PolicyRule
impl PolicyRule
pub fn new() -> Self
Sourcepub fn set_condition<T>(self, v: T) -> Self
pub fn set_condition<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_condition<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_condition<T>(self, v: Option<T>) -> Self
Sourcepub fn values(&self) -> Option<&Box<StringValues>>
pub fn values(&self) -> Option<&Box<StringValues>>
The value of kind
if it holds a Values, None if the field is not set or
holds a different branch.
Sourcepub fn set_values<T: Into<Box<StringValues>>>(self, v: T) -> Self
pub fn set_values<T: Into<Box<StringValues>>>(self, v: T) -> Self
Sets the value of kind
to hold a Values.
Note that all the setters affecting kind are
mutually exclusive.
§Example
use google_cloud_securityposture_v1::model::policy_rule::StringValues;
let x = PolicyRule::new().set_values(StringValues::default()/* use setters */);
assert!(x.values().is_some());
assert!(x.allow_all().is_none());
assert!(x.deny_all().is_none());
assert!(x.enforce().is_none());Sourcepub fn allow_all(&self) -> Option<&bool>
pub fn allow_all(&self) -> Option<&bool>
The value of kind
if it holds a AllowAll, None if the field is not set or
holds a different branch.
Sourcepub fn set_allow_all<T: Into<bool>>(self, v: T) -> Self
pub fn set_allow_all<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn deny_all(&self) -> Option<&bool>
pub fn deny_all(&self) -> Option<&bool>
The value of kind
if it holds a DenyAll, None if the field is not set or
holds a different branch.
Sourcepub fn set_deny_all<T: Into<bool>>(self, v: T) -> Self
pub fn set_deny_all<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn enforce(&self) -> Option<&bool>
pub fn enforce(&self) -> Option<&bool>
The value of kind
if it holds a Enforce, None if the field is not set or
holds a different branch.
Sourcepub fn set_enforce<T: Into<bool>>(self, v: T) -> Self
pub fn set_enforce<T: Into<bool>>(self, v: T) -> Self
Trait Implementations§
Source§impl Clone for PolicyRule
impl Clone for PolicyRule
Source§fn clone(&self) -> PolicyRule
fn clone(&self) -> PolicyRule
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more