#[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,
pub update_time: Option<Timestamp>,
/* private fields */
}Expand description
A custom constraint defined by customers which can only be applied to the given resource types and organization.
By creating a custom constraint, customers can apply policies of this custom constraint. Creating a custom constraint itself does NOT apply any policy enforcement.
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: StringImmutable. Name 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
The max length is 70 characters and the minimum length is 1. Note that the
prefix organizations/{organization_id}/customConstraints/ is not counted.
resource_types: Vec<String>Immutable. 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: StringA Common Expression Language (CEL) condition which is used in the
evaluation of the constraint. 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.
display_name: StringOne line display name for the UI. The max length of the display_name is 200 characters.
description: StringDetailed information about this custom policy constraint. The max length of the description is 2000 characters.
update_time: Option<Timestamp>Output only. The last time this custom constraint was updated. This
represents the last time that the CreateCustomConstraint or
UpdateCustomConstraint methods were called.
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.
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.
Sourcepub fn set_condition<T: Into<String>>(self, v: T) -> Self
pub fn set_condition<T: Into<String>>(self, v: T) -> Self
Sets the value of condition.
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.
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.
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.
Sourcepub fn set_update_time<T>(self, v: T) -> Self
pub fn set_update_time<T>(self, v: T) -> Self
Sets the value of update_time.
Sourcepub fn set_or_clear_update_time<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_update_time<T>(self, v: Option<T>) -> Self
Sets or clears the value of update_time.
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