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

namespace Google\Cloud\Compute\V1;

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

/**
 * Node Affinity: the configuration of desired nodes onto which this Instance
 *  could be scheduled.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.SchedulingNodeAffinity</code>
 */
class SchedulingNodeAffinity extends \Google\Protobuf\Internal\Message
{
    /**
     * Corresponds to the label key of Node resource.
     *
     * Generated from protobuf field <code>optional string key = 106079;</code>
     */
    protected $key = null;
    /**
     * Defines the operation of node selection. Valid operators areIN for affinity and NOT_IN for anti-affinity.
     * Check the Operator enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string operator = 36317348;</code>
     */
    protected $operator = null;
    /**
     * Corresponds to the label values of Node resource.
     *
     * Generated from protobuf field <code>repeated string values = 249928994;</code>
     */
    private $values;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $key
     *           Corresponds to the label key of Node resource.
     *     @type string $operator
     *           Defines the operation of node selection. Valid operators areIN for affinity and NOT_IN for anti-affinity.
     *           Check the Operator enum for the list of possible values.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $values
     *           Corresponds to the label values of Node resource.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * Corresponds to the label key of Node resource.
     *
     * Generated from protobuf field <code>optional string key = 106079;</code>
     * @return string
     */
    public function getKey()
    {
        return isset($this->key) ? $this->key : '';
    }

    public function hasKey()
    {
        return isset($this->key);
    }

    public function clearKey()
    {
        unset($this->key);
    }

    /**
     * Corresponds to the label key of Node resource.
     *
     * Generated from protobuf field <code>optional string key = 106079;</code>
     * @param string $var
     * @return $this
     */
    public function setKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->key = $var;

        return $this;
    }

    /**
     * Defines the operation of node selection. Valid operators areIN for affinity and NOT_IN for anti-affinity.
     * Check the Operator enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string operator = 36317348;</code>
     * @return string
     */
    public function getOperator()
    {
        return isset($this->operator) ? $this->operator : '';
    }

    public function hasOperator()
    {
        return isset($this->operator);
    }

    public function clearOperator()
    {
        unset($this->operator);
    }

    /**
     * Defines the operation of node selection. Valid operators areIN for affinity and NOT_IN for anti-affinity.
     * Check the Operator enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string operator = 36317348;</code>
     * @param string $var
     * @return $this
     */
    public function setOperator($var)
    {
        GPBUtil::checkString($var, True);
        $this->operator = $var;

        return $this;
    }

    /**
     * Corresponds to the label values of Node resource.
     *
     * Generated from protobuf field <code>repeated string values = 249928994;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getValues()
    {
        return $this->values;
    }

    /**
     * Corresponds to the label values of Node resource.
     *
     * Generated from protobuf field <code>repeated string values = 249928994;</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->values = $arr;

        return $this;
    }

}

