# Policy Simulator V1 API - Class Google::Cloud::OrgPolicy::V2::CustomConstraint (v1.9.0)

1.9.0 (latest) 1.8.1 1.7.0 1.6.1 1.5.0 1.4.0 1.3.0 1.2.1 1.1.0 1.0.1 0.4.0 0.3.2 0.2.0 0.1.1 Reference documentation and code samples for the Policy Simulator V1 API class Google::Cloud::OrgPolicy::V2::CustomConstraint.

A custom constraint defined by customers which can *only* be applied to the
given resource types and organization.


<br />

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

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #action_type

    def action_type() -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint::ActionType

**Returns**

- ([::Google::Cloud::OrgPolicy::V2::CustomConstraint::ActionType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-OrgPolicy-V2-CustomConstraint-ActionType)) --- Allow or deny type.

### #action_type=

    def action_type=(value) -> ::Google::Cloud::OrgPolicy::V2::CustomConstraint::ActionType

**Parameter**

- **value** ([::Google::Cloud::OrgPolicy::V2::CustomConstraint::ActionType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-OrgPolicy-V2-CustomConstraint-ActionType)) --- Allow or deny type.
**Returns**

- ([::Google::Cloud::OrgPolicy::V2::CustomConstraint::ActionType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-OrgPolicy-V2-CustomConstraint-ActionType)) --- Allow or deny type.

### #condition

    def condition() -> ::String

**Returns**

- (::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.

### #condition=

    def condition=(value) -> ::String

**Parameter**

- **value** (::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.
**Returns**

- (::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.

### #description

    def description() -> ::String

**Returns**

- (::String) --- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

### #description=

    def description=(value) -> ::String

**Parameter**

- **value** (::String) --- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.
**Returns**

- (::String) --- Detailed information about this custom policy constraint. The max length of the description is 2000 characters.

### #display_name

    def display_name() -> ::String

**Returns**

- (::String) --- One line display name for the UI. The max length of the display_name is 200 characters.

### #display_name=

    def display_name=(value) -> ::String

**Parameter**

- **value** (::String) --- One line display name for the UI. The max length of the display_name is 200 characters.
**Returns**

- (::String) --- One line display name for the UI. The max length of the display_name is 200 characters.

### #method_types

    def method_types() -> ::Array<::Google::Cloud::OrgPolicy::V2::CustomConstraint::MethodType>

**Returns**

- (::Array\<[::Google::Cloud::OrgPolicy::V2::CustomConstraint::MethodType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-OrgPolicy-V2-CustomConstraint-MethodType)\>) --- All the operations being applied for this constraint.

### #method_types=

    def method_types=(value) -> ::Array<::Google::Cloud::OrgPolicy::V2::CustomConstraint::MethodType>

**Parameter**

- **value** (::Array\<[::Google::Cloud::OrgPolicy::V2::CustomConstraint::MethodType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-OrgPolicy-V2-CustomConstraint-MethodType)\>) --- All the operations being applied for this constraint.
**Returns**

- (::Array\<[::Google::Cloud::OrgPolicy::V2::CustomConstraint::MethodType](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Cloud-OrgPolicy-V2-CustomConstraint-MethodType)\>) --- All the operations being applied for this constraint.

### #name

    def name() -> ::String

**Returns**

- (::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.

### #name=

    def name=(value) -> ::String

**Parameter**

- **value** (::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.
**Returns**

- (::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.

### #resource_types

    def resource_types() -> ::Array<::String>

**Returns**

- (::Array\<::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`.

### #resource_types=

    def resource_types=(value) -> ::Array<::String>

**Parameter**

- **value** (::Array\<::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`.
**Returns**

- (::Array\<::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`.

### #update_time

    def update_time() -> ::Google::Protobuf::Timestamp

**Returns**

- ([::Google::Protobuf::Timestamp](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-policy_simulator-v1/latest/Google-Protobuf-Timestamp)) --- Output only. The last time this custom constraint was updated. This represents the last time that the `CreateCustomConstraint` or `UpdateCustomConstraint` methods were called.