#[non_exhaustive]pub struct CustomConstraintDefinition {
pub resource_types: Vec<String>,
pub method_types: Vec<MethodType>,
pub condition: String,
pub action_type: ActionType,
pub parameters: HashMap<String, Parameter>,
/* private fields */
}Expand description
Custom constraint definition. Defines this as a managed constraint.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.resource_types: Vec<String>The resource instance type on which this policy applies. Format will be
of the form : <service name>/<type> Example:
compute.googleapis.com/Instance.
method_types: Vec<MethodType>All the operations being applied for this constraint.
condition: StringOrg policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+") or,
resource.management.auto_upgrade == true
The max length of the condition is 1000 characters.
action_type: ActionTypeAllow or deny type.
parameters: HashMap<String, Parameter>Stores the structure of
Parameters
used by the constraint condition. The key of map represents the name of
the parameter.
Implementations§
Source§impl CustomConstraintDefinition
impl CustomConstraintDefinition
Sourcepub fn set_resource_types<T, V>(self, v: T) -> Self
pub fn set_resource_types<T, V>(self, v: T) -> Self
Sets the value of resource_types.
§Example
ⓘ
let x = CustomConstraintDefinition::new().set_resource_types(["a", "b", "c"]);Sourcepub fn set_method_types<T, V>(self, v: T) -> Self
pub fn set_method_types<T, V>(self, v: T) -> Self
Sets the value of method_types.
§Example
ⓘ
use google_cloud_orgpolicy_v2::model::constraint::custom_constraint_definition::MethodType;
let x = CustomConstraintDefinition::new().set_method_types([
MethodType::Create,
MethodType::Update,
MethodType::Delete,
]);Sourcepub fn set_condition<T: Into<String>>(self, v: T) -> Self
pub fn set_condition<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_action_type<T: Into<ActionType>>(self, v: T) -> Self
pub fn set_action_type<T: Into<ActionType>>(self, v: T) -> Self
Sets the value of action_type.
§Example
ⓘ
use google_cloud_orgpolicy_v2::model::constraint::custom_constraint_definition::ActionType;
let x0 = CustomConstraintDefinition::new().set_action_type(ActionType::Allow);
let x1 = CustomConstraintDefinition::new().set_action_type(ActionType::Deny);Sourcepub fn set_parameters<T, K, V>(self, v: T) -> Self
pub fn set_parameters<T, K, V>(self, v: T) -> Self
Sets the value of parameters.
§Example
ⓘ
use google_cloud_orgpolicy_v2::model::constraint::custom_constraint_definition::Parameter;
let x = CustomConstraintDefinition::new().set_parameters([
("key0", Parameter::default()/* use setters */),
("key1", Parameter::default()/* use (different) setters */),
]);Trait Implementations§
Source§impl Clone for CustomConstraintDefinition
impl Clone for CustomConstraintDefinition
Source§fn clone(&self) -> CustomConstraintDefinition
fn clone(&self) -> CustomConstraintDefinition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CustomConstraintDefinition
impl Debug for CustomConstraintDefinition
Source§impl Default for CustomConstraintDefinition
impl Default for CustomConstraintDefinition
Source§fn default() -> CustomConstraintDefinition
fn default() -> CustomConstraintDefinition
Returns the “default value” for a type. Read more
Source§impl Message for CustomConstraintDefinition
impl Message for CustomConstraintDefinition
Source§impl PartialEq for CustomConstraintDefinition
impl PartialEq for CustomConstraintDefinition
Source§fn eq(&self, other: &CustomConstraintDefinition) -> bool
fn eq(&self, other: &CustomConstraintDefinition) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CustomConstraintDefinition
Auto Trait Implementations§
impl Freeze for CustomConstraintDefinition
impl RefUnwindSafe for CustomConstraintDefinition
impl Send for CustomConstraintDefinition
impl Sync for CustomConstraintDefinition
impl Unpin for CustomConstraintDefinition
impl UnsafeUnpin for CustomConstraintDefinition
impl UnwindSafe for CustomConstraintDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more