#[non_exhaustive]pub struct CustomConstraint {
pub name: String,
pub resource_types: Vec<String>,
pub method_types: Vec<MethodType>,
pub condition: String,
pub action_type: ActionType,
pub display_name: String,
pub description: String,
/* private fields */
}Expand description
The definition of a custom constraint.
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.name: StringName of the constraint. This is unique within the organization. Format of the name should be
organizations/{organization_id}/customConstraints/{custom_constraint_id}
Example : “organizations/123/customConstraints/custom.createOnlyE2TypeVms”
resource_types: Vec<String>The Resource Instance type on which this policy applies to. Format will be of the form : “<canonical service name>/<type>” Example:
compute.googleapis.com/Instance.
method_types: Vec<MethodType>All the operations being applied for this constraint.
condition: StringOrganization Policy condition/expression. For example:
resource.instanceName.matches("[production|test]_.*_(\d)+")' or,
resource.management.auto_upgrade == true
action_type: ActionTypeAllow or deny type.
display_name: StringOne line display name for the UI.
description: StringDetailed information about this custom policy constraint.
Implementations§
Source§impl CustomConstraint
impl CustomConstraint
pub fn new() -> Self
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 = CustomConstraint::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_asset_v1::model::analyzer_org_policy_constraint::custom_constraint::MethodType;
let x = CustomConstraint::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_asset_v1::model::analyzer_org_policy_constraint::custom_constraint::ActionType;
let x0 = CustomConstraint::new().set_action_type(ActionType::Allow);
let x1 = CustomConstraint::new().set_action_type(ActionType::Deny);Sourcepub fn set_display_name<T: Into<String>>(self, v: T) -> Self
pub fn set_display_name<T: Into<String>>(self, v: T) -> Self
Sets the value of display_name.
§Example
let x = CustomConstraint::new().set_display_name("example");Sourcepub fn set_description<T: Into<String>>(self, v: T) -> Self
pub fn set_description<T: Into<String>>(self, v: T) -> Self
Sets the value of description.
§Example
let x = CustomConstraint::new().set_description("example");Trait Implementations§
Source§impl Clone for CustomConstraint
impl Clone for CustomConstraint
Source§fn clone(&self) -> CustomConstraint
fn clone(&self) -> CustomConstraint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more