NAME

Google::Cloud::Orgpolicy::V2::Constraint - Compiled Protocol Buffers messages for google/cloud/orgpolicy/v2/constraint.proto

SYNOPSIS

use Google::Cloud::Orgpolicy::V2::Constraint;

my $msg = Google::Cloud::Orgpolicy::V2::Constraint::Constraint->new({
    name => $name,
    display_name => $display_name,
    description => $description,
    constraint_default => $constraint_default,
});

# Read or update a field
my $val = $msg->name();

# Binary wire-format roundtrip
my $bytes   = $msg->serialize();
my $decoded = Google::Cloud::Orgpolicy::V2::Constraint::Constraint->parse($bytes);

# Canonical ProtoJSON
my $json = $msg->to_json();

DESCRIPTION

Auto-generated Protobuf message classes compiled from google/cloud/orgpolicy/v2/constraint.proto. All message classes inherit from Protobuf::Message and support new(), serialize(), parse(), to_json(), from_json(), to_text(), and to_perl().

MESSAGES

Google::Cloud::Orgpolicy::V2::Constraint::Constraint

A constraint describes a way to restrict resource's configuration. For example, you could enforce a constraint that controls which Google Cloud services can be activated across an organization, or whether a Compute Engine instance can have serial port connections established. Constraints can be configured by the organization policy administrator to fit the needs of the organization by setting a policy that includes constraints at different locations in the organization's resource hierarchy. Policies are inherited down the resource hierarchy from higher levels, but can also be overridden. For details about the inheritance rules, see [`Policy`][google.cloud.orgpolicy.v2.Policy].

Constraints have a default behavior determined by the `constraint_default` field, which is the enforcement behavior that is used in the absence of a policy being defined or inherited for the resource in question.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    Immutable. The resource name of the constraint. Must be in one of the following forms:

    * `projects/{project_number}/constraints/{constraint_name}` * `folders/{folder_id}/constraints/{constraint_name}` * `organizations/{organization_id}/constraints/{constraint_name}`

    For example, "/projects/123/constraints/compute.disableSerialPortAccess".

  • $msg->display_name() / $msg->display_name($value)

    Type: String

    The human readable name.

    Mutable.

  • $msg->description() / $msg->description($value)

    Type: String

    Detailed description of what this constraint controls as well as how and where it is enforced.

    Mutable.

  • $msg->constraint_default() / $msg->constraint_default($value)

    Type: Enum (Google::Cloud::Orgpolicy::V2::Constraint::ConstraintDefault)

    The evaluation behavior of this constraint in the absence of a policy.

  • $msg->list_constraint() / $msg->list_constraint($value)

    Type: Message (Google::Cloud::Orgpolicy::V2::Constraint::Constraint::ListConstraint)

    Defines this constraint as being a list constraint.

  • $msg->boolean_constraint() / $msg->boolean_constraint($value)

    Type: Message (Google::Cloud::Orgpolicy::V2::Constraint::Constraint::BooleanConstraint)

    Defines this constraint as being a boolean constraint.

  • $msg->supports_dry_run() / $msg->supports_dry_run($value)

    Type: Bool

    Shows if dry run is supported for this constraint or not.

  • $msg->equivalent_constraint() / $msg->equivalent_constraint($value)

    Type: String

    Managed constraint and canned constraint sometimes can have equivalents. This field is used to store the equivalent constraint name.

  • $msg->supports_simulation() / $msg->supports_simulation($value)

    Type: Bool

    Shows if simulation is supported for this constraint or not.

Enum: Constraint::ConstraintDefault

  • CONSTRAINT_DEFAULT_UNSPECIFIED => 0

  • ALLOW => 1

  • DENY => 2

Google::Cloud::Orgpolicy::V2::Constraint::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*.

Inherits from Protobuf::Message.

Accessors

  • $msg->name() / $msg->name($value)

    Type: String

    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.

  • $msg->resource_types() / $msg->resource_types($value)

    Type: 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`.
  • $msg->method_types() / $msg->method_types($value)

    Type: Enum (Google::Cloud::Orgpolicy::V2::CustomConstraint::MethodType)

    All the operations being applied for this constraint.

  • $msg->condition() / $msg->condition($value)

    Type: String

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

  • $msg->action_type() / $msg->action_type($value)

    Type: Enum (Google::Cloud::Orgpolicy::V2::CustomConstraint::ActionType)

    Allow or deny type.

  • $msg->display_name() / $msg->display_name($value)

    Type: String

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

  • $msg->description() / $msg->description($value)

    Type: String

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

  • $msg->update_time() / $msg->update_time($value)

    Type: Message (Google::Protobuf::Timestamp::Timestamp)

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

Enum: CustomConstraint::MethodType

  • METHOD_TYPE_UNSPECIFIED => 0

  • CREATE => 1

  • UPDATE => 2

  • DELETE => 3

  • REMOVE_GRANT => 4

  • GOVERN_TAGS => 5

Enum: CustomConstraint::ActionType

  • ACTION_TYPE_UNSPECIFIED => 0

  • ALLOW => 1

  • DENY => 2

SEE ALSO

Protobuf, Protobuf::Message, Google::Cloud::Orgpolicy::V2::Constraint::Types, https://protobuf.dev/

LICENSE AND COPYRIGHT

Copyright (C) 2026 Google LLC

This program is released under the Apache 2.0 license.