<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/asset/v1/asset_service.proto

namespace Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The definition of a custom constraint.
 *
 * Generated from protobuf message <code>google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint</code>
 */
class CustomConstraint extends \Google\Protobuf\Internal\Message
{
    /**
     * 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"
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * 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`.
     *
     * Generated from protobuf field <code>repeated string resource_types = 2;</code>
     */
    private $resource_types;
    /**
     * All the operations being applied for this constraint.
     *
     * Generated from protobuf field <code>repeated .google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.MethodType method_types = 3;</code>
     */
    private $method_types;
    /**
     * Organization Policy condition/expression. For example:
     * `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or,
     * `resource.management.auto_upgrade == true`
     *
     * Generated from protobuf field <code>string condition = 4;</code>
     */
    private $condition = '';
    /**
     * Allow or deny type.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.ActionType action_type = 5;</code>
     */
    private $action_type = 0;
    /**
     * One line display name for the UI.
     *
     * Generated from protobuf field <code>string display_name = 6;</code>
     */
    private $display_name = '';
    /**
     * Detailed information about this custom policy constraint.
     *
     * Generated from protobuf field <code>string description = 7;</code>
     */
    private $description = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           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"
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $resource_types
     *           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`.
     *     @type array<int>|\Google\Protobuf\Internal\RepeatedField $method_types
     *           All the operations being applied for this constraint.
     *     @type string $condition
     *           Organization Policy condition/expression. For example:
     *           `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or,
     *           `resource.management.auto_upgrade == true`
     *     @type int $action_type
     *           Allow or deny type.
     *     @type string $display_name
     *           One line display name for the UI.
     *     @type string $description
     *           Detailed information about this custom policy constraint.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Asset\V1\AssetService::initOnce();
        parent::__construct($data);
    }

    /**
     * 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"
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * 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"
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * 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`.
     *
     * Generated from protobuf field <code>repeated string resource_types = 2;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getResourceTypes()
    {
        return $this->resource_types;
    }

    /**
     * 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`.
     *
     * Generated from protobuf field <code>repeated string resource_types = 2;</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setResourceTypes($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->resource_types = $arr;

        return $this;
    }

    /**
     * All the operations being applied for this constraint.
     *
     * Generated from protobuf field <code>repeated .google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.MethodType method_types = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getMethodTypes()
    {
        return $this->method_types;
    }

    /**
     * All the operations being applied for this constraint.
     *
     * Generated from protobuf field <code>repeated .google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.MethodType method_types = 3;</code>
     * @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setMethodTypes($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\CustomConstraint\MethodType::class);
        $this->method_types = $arr;

        return $this;
    }

    /**
     * Organization Policy condition/expression. For example:
     * `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or,
     * `resource.management.auto_upgrade == true`
     *
     * Generated from protobuf field <code>string condition = 4;</code>
     * @return string
     */
    public function getCondition()
    {
        return $this->condition;
    }

    /**
     * Organization Policy condition/expression. For example:
     * `resource.instanceName.matches("[production|test]_.*_(\d)+")'` or,
     * `resource.management.auto_upgrade == true`
     *
     * Generated from protobuf field <code>string condition = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setCondition($var)
    {
        GPBUtil::checkString($var, True);
        $this->condition = $var;

        return $this;
    }

    /**
     * Allow or deny type.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.ActionType action_type = 5;</code>
     * @return int
     */
    public function getActionType()
    {
        return $this->action_type;
    }

    /**
     * Allow or deny type.
     *
     * Generated from protobuf field <code>.google.cloud.asset.v1.AnalyzerOrgPolicyConstraint.CustomConstraint.ActionType action_type = 5;</code>
     * @param int $var
     * @return $this
     */
    public function setActionType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint\CustomConstraint\ActionType::class);
        $this->action_type = $var;

        return $this;
    }

    /**
     * One line display name for the UI.
     *
     * Generated from protobuf field <code>string display_name = 6;</code>
     * @return string
     */
    public function getDisplayName()
    {
        return $this->display_name;
    }

    /**
     * One line display name for the UI.
     *
     * Generated from protobuf field <code>string display_name = 6;</code>
     * @param string $var
     * @return $this
     */
    public function setDisplayName($var)
    {
        GPBUtil::checkString($var, True);
        $this->display_name = $var;

        return $this;
    }

    /**
     * Detailed information about this custom policy constraint.
     *
     * Generated from protobuf field <code>string description = 7;</code>
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Detailed information about this custom policy constraint.
     *
     * Generated from protobuf field <code>string description = 7;</code>
     * @param string $var
     * @return $this
     */
    public function setDescription($var)
    {
        GPBUtil::checkString($var, True);
        $this->description = $var;

        return $this;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(CustomConstraint::class, \Google\Cloud\Asset\V1\AnalyzerOrgPolicyConstraint_CustomConstraint::class);

