<?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>string key = 106079;</code>
     */
    private $key = null;
    /**
     * Defines the operation of node selection. Valid operators are IN for affinity and NOT_IN for anti-affinity.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SchedulingNodeAffinity.Operator operator = 36317348;</code>
     */
    private $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 int $operator
     *           Defines the operation of node selection. Valid operators are IN for affinity and NOT_IN for anti-affinity.
     *     @type 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>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>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 are IN for affinity and NOT_IN for anti-affinity.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SchedulingNodeAffinity.Operator operator = 36317348;</code>
     * @return int
     */
    public function getOperator()
    {
        return isset($this->operator) ? $this->operator : 0;
    }

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

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

    /**
     * Defines the operation of node selection. Valid operators are IN for affinity and NOT_IN for anti-affinity.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.SchedulingNodeAffinity.Operator operator = 36317348;</code>
     * @param int $var
     * @return $this
     */
    public function setOperator($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\SchedulingNodeAffinity\Operator::class);
        $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 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;
    }

}

