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

namespace Google\Cloud\Container\V1\SoleTenantConfig;

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

/**
 * Specifies the NodeAffinity key, values, and affinity operator according to
 * [shared sole tenant node group
 * affinities](https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes#node_affinity_and_anti-affinity).
 *
 * Generated from protobuf message <code>google.container.v1.SoleTenantConfig.NodeAffinity</code>
 */
class NodeAffinity extends \Google\Protobuf\Internal\Message
{
    /**
     * Key for NodeAffinity.
     *
     * Generated from protobuf field <code>string key = 1;</code>
     */
    private $key = '';
    /**
     * Operator for NodeAffinity.
     *
     * Generated from protobuf field <code>.google.container.v1.SoleTenantConfig.NodeAffinity.Operator operator = 2;</code>
     */
    private $operator = 0;
    /**
     * Values for NodeAffinity.
     *
     * Generated from protobuf field <code>repeated string values = 3;</code>
     */
    private $values;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $key
     *           Key for NodeAffinity.
     *     @type int $operator
     *           Operator for NodeAffinity.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $values
     *           Values for NodeAffinity.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Container\V1\ClusterService::initOnce();
        parent::__construct($data);
    }

    /**
     * Key for NodeAffinity.
     *
     * Generated from protobuf field <code>string key = 1;</code>
     * @return string
     */
    public function getKey()
    {
        return $this->key;
    }

    /**
     * Key for NodeAffinity.
     *
     * Generated from protobuf field <code>string key = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setKey($var)
    {
        GPBUtil::checkString($var, True);
        $this->key = $var;

        return $this;
    }

    /**
     * Operator for NodeAffinity.
     *
     * Generated from protobuf field <code>.google.container.v1.SoleTenantConfig.NodeAffinity.Operator operator = 2;</code>
     * @return int
     */
    public function getOperator()
    {
        return $this->operator;
    }

    /**
     * Operator for NodeAffinity.
     *
     * Generated from protobuf field <code>.google.container.v1.SoleTenantConfig.NodeAffinity.Operator operator = 2;</code>
     * @param int $var
     * @return $this
     */
    public function setOperator($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Container\V1\SoleTenantConfig\NodeAffinity\Operator::class);
        $this->operator = $var;

        return $this;
    }

    /**
     * Values for NodeAffinity.
     *
     * Generated from protobuf field <code>repeated string values = 3;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getValues()
    {
        return $this->values;
    }

    /**
     * Values for NodeAffinity.
     *
     * Generated from protobuf field <code>repeated string values = 3;</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;
    }

}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(NodeAffinity::class, \Google\Cloud\Container\V1\SoleTenantConfig_NodeAffinity::class);

