<?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\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * 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 string[] $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 RepeatedField<string>
     */
    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 string[] $var
     * @return $this
     */
    public function setValues($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->values = $arr;

        return $this;
    }

}

