<?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.
     * Check the ConsumeReservationType enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string 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>optional string key = 106079;</code>
     */
    private $key = null;
    /**
     * Corresponds to the label values of a reservation resource. This can be either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name" to target a shared reservation in the same zone but in a different project.
     *
     * 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 $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.
     *           Check the ConsumeReservationType enum for the list of possible values.
     *     @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 array<string>|\Google\Protobuf\Internal\RepeatedField $values
     *           Corresponds to the label values of a reservation resource. This can be either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name" to target a shared reservation in the same zone but in a different project.
     * }
     */
    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.
     * Check the ConsumeReservationType enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string consume_reservation_type = 300736944;</code>
     * @return string
     */
    public function getConsumeReservationType()
    {
        return isset($this->consume_reservation_type) ? $this->consume_reservation_type : '';
    }

    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.
     * Check the ConsumeReservationType enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string consume_reservation_type = 300736944;</code>
     * @param string $var
     * @return $this
     */
    public function setConsumeReservationType($var)
    {
        GPBUtil::checkString($var, True);
        $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>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 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>optional 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. This can be either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name" to target a shared reservation in the same zone but in a different project.
     *
     * 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. This can be either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name" to target a shared reservation in the same zone but in a different project.
     *
     * 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;
    }

}

