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

/**
 * Configuration for location policy among multiple possible locations (e.g. preferences for zone selection among zones in a single region).
 *
 * Generated from protobuf message <code>google.cloud.compute.v1.LocationPolicy</code>
 */
class LocationPolicy extends \Google\Protobuf\Internal\Message
{
    /**
     * Location configurations mapped by location name. Currently only zone names are supported and must be represented as valid internal URLs, such as zones/us-central1-a.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.compute.v1.LocationPolicyLocation> locations = 413423454;</code>
     */
    private $locations;
    /**
     * Strategy for distributing VMs across zones in a region.
     * Check the TargetShape enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string target_shape = 338621299;</code>
     */
    protected $target_shape = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array|\Google\Protobuf\Internal\MapField $locations
     *           Location configurations mapped by location name. Currently only zone names are supported and must be represented as valid internal URLs, such as zones/us-central1-a.
     *     @type string $target_shape
     *           Strategy for distributing VMs across zones in a region.
     *           Check the TargetShape enum for the list of possible values.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce();
        parent::__construct($data);
    }

    /**
     * Location configurations mapped by location name. Currently only zone names are supported and must be represented as valid internal URLs, such as zones/us-central1-a.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.compute.v1.LocationPolicyLocation> locations = 413423454;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getLocations()
    {
        return $this->locations;
    }

    /**
     * Location configurations mapped by location name. Currently only zone names are supported and must be represented as valid internal URLs, such as zones/us-central1-a.
     *
     * Generated from protobuf field <code>map<string, .google.cloud.compute.v1.LocationPolicyLocation> locations = 413423454;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setLocations($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Compute\V1\LocationPolicyLocation::class);
        $this->locations = $arr;

        return $this;
    }

    /**
     * Strategy for distributing VMs across zones in a region.
     * Check the TargetShape enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string target_shape = 338621299;</code>
     * @return string
     */
    public function getTargetShape()
    {
        return isset($this->target_shape) ? $this->target_shape : '';
    }

    public function hasTargetShape()
    {
        return isset($this->target_shape);
    }

    public function clearTargetShape()
    {
        unset($this->target_shape);
    }

    /**
     * Strategy for distributing VMs across zones in a region.
     * Check the TargetShape enum for the list of possible values.
     *
     * Generated from protobuf field <code>optional string target_shape = 338621299;</code>
     * @param string $var
     * @return $this
     */
    public function setTargetShape($var)
    {
        GPBUtil::checkString($var, True);
        $this->target_shape = $var;

        return $this;
    }

}

