<?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;

/**
 * Specifies the reservations that this instance can consume from.
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.ReservationAffinity</code>
 */
class ReservationAffinity extends \Google\Protobuf\Internal\Message
{
    /**
     * Specifies the type of reservation from which this instance can consume resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION. See  Consuming reserved instances for examples.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ReservationAffinity.ConsumeReservationType consume_reservation_type = 300736944;</code>
     */
    private $consume_reservation_type = null;
    /**
     * Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name as the key and specify the name of your reservation as its value.
     *
     * Generated from protobuf field <code>string key = 106079;</code>
     */
    private $key = null;
    /**
     * Corresponds to the label values of a reservation 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 int $consume_reservation_type
     *           Specifies the type of reservation from which this instance can consume resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION. See  Consuming reserved instances for examples.
     *     @type string $key
     *           Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name as the key and specify the name of your reservation as its value.
     *     @type string[]|\Google\Protobuf\Internal\RepeatedField $values
     *           Corresponds to the label values of a reservation resource.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * Specifies the type of reservation from which this instance can consume resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION. See  Consuming reserved instances for examples.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ReservationAffinity.ConsumeReservationType consume_reservation_type = 300736944;</code>
     * @return int
     */
    public function getConsumeReservationType()
    {
        return isset($this->consume_reservation_type) ? $this->consume_reservation_type : 0;
    }

    public function hasConsumeReservationType()
    {
        return isset($this->consume_reservation_type);
    }

    public function clearConsumeReservationType()
    {
        unset($this->consume_reservation_type);
    }

    /**
     * Specifies the type of reservation from which this instance can consume resources: ANY_RESERVATION (default), SPECIFIC_RESERVATION, or NO_RESERVATION. See  Consuming reserved instances for examples.
     *
     * Generated from protobuf field <code>.google.cloud.compute.v1.ReservationAffinity.ConsumeReservationType consume_reservation_type = 300736944;</code>
     * @param int $var
     * @return $this
     */
    public function setConsumeReservationType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\Compute\V1\ReservationAffinity\ConsumeReservationType::class);
        $this->consume_reservation_type = $var;

        return $this;
    }

    /**
     * Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name as the key and specify the name of your reservation as its value.
     *
     * 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 a reservation resource. To target a SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name as the key and specify the name of your reservation as its value.
     *
     * 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;
    }

    /**
     * Corresponds to the label values of a reservation 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 a reservation 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;
    }

}

