Organization Policy v2 API - Class CustomConstraint (2.3.0)

public sealed class CustomConstraint : IMessage<CustomConstraint>, IEquatable<CustomConstraint>, IDeepCloneable<CustomConstraint>, IBufferMessage, IMessage

Reference documentation and code samples for the Organization Policy v2 API class CustomConstraint.

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.

Inheritance

object > CustomConstraint

Namespace

Google.Cloud.OrgPolicy.V2

Assembly

Google.Cloud.OrgPolicy.V2.dll

Constructors

CustomConstraint()

public CustomConstraint()

CustomConstraint(CustomConstraint)

public CustomConstraint(CustomConstraint other)
Parameter
NameDescription
otherCustomConstraint

Properties

ActionType

public CustomConstraint.Types.ActionType ActionType { get; set; }

Allow or deny type.

Property Value
TypeDescription
CustomConstraintTypesActionType

Condition

public string Condition { get; set; }

Org 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.

Property Value
TypeDescription
string

CustomConstraintName

public CustomConstraintName CustomConstraintName { get; set; }

CustomConstraintName-typed view over the Name resource name property.

Property Value
TypeDescription
CustomConstraintName

Description

public string Description { get; set; }

Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

Property Value
TypeDescription
string

DisplayName

public string DisplayName { get; set; }

One line display name for the UI. The max length of the display_name is 200 characters.

Property Value
TypeDescription
string

MethodTypes

public RepeatedField<CustomConstraint.Types.MethodType> MethodTypes { get; }

All the operations being applied for this constraint.

Property Value
TypeDescription
RepeatedFieldCustomConstraintTypesMethodType

Name

public string Name { get; set; }

Immutable. 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.

Property Value
TypeDescription
string

ResourceTypes

public RepeatedField<string> ResourceTypes { get; }

Immutable. The resource instance type on which this policy applies. Format will be of the form : <canonical service name>/<type> Example:

  • compute.googleapis.com/Instance.
Property Value
TypeDescription
RepeatedFieldstring

UpdateTime

public Timestamp UpdateTime { get; set; }

Output only. The last time this custom constraint was updated. This represents the last time that the CreateCustomConstraint or UpdateCustomConstraint RPC was called

Property Value
TypeDescription
Timestamp