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

namespace Google\Cloud\Batch\V1;

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

/**
 * A Job's resource allocation policy describes when, where, and how compute
 * resources should be allocated for the Job.
 *
 * Generated from protobuf message <code>google.cloud.batch.v1.AllocationPolicy</code>
 */
class AllocationPolicy extends \Google\Protobuf\Internal\Message
{
    /**
     * Location where compute resources should be allocated for the Job.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.AllocationPolicy.LocationPolicy location = 1;</code>
     */
    private $location = null;
    /**
     * Describe instances that can be created by this AllocationPolicy.
     * Only instances[0] is supported now.
     *
     * Generated from protobuf field <code>repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;</code>
     */
    private $instances;
    /**
     * Service account that VMs will run as.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.ServiceAccount service_account = 9;</code>
     */
    private $service_account = null;
    /**
     * Labels applied to all VM instances and other resources
     * created by AllocationPolicy.
     * Labels could be user provided or system generated.
     * You can assign up to 64 labels. [Google Compute Engine label
     * restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
     * apply.
     * Label names that start with "goog-" or "google-" are reserved.
     *
     * Generated from protobuf field <code>map<string, string> labels = 6;</code>
     */
    private $labels;
    /**
     * The network policy.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.AllocationPolicy.NetworkPolicy network = 7;</code>
     */
    private $network = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\Batch\V1\AllocationPolicy\LocationPolicy $location
     *           Location where compute resources should be allocated for the Job.
     *     @type array<\Google\Cloud\Batch\V1\AllocationPolicy\InstancePolicyOrTemplate>|\Google\Protobuf\Internal\RepeatedField $instances
     *           Describe instances that can be created by this AllocationPolicy.
     *           Only instances[0] is supported now.
     *     @type \Google\Cloud\Batch\V1\ServiceAccount $service_account
     *           Service account that VMs will run as.
     *     @type array|\Google\Protobuf\Internal\MapField $labels
     *           Labels applied to all VM instances and other resources
     *           created by AllocationPolicy.
     *           Labels could be user provided or system generated.
     *           You can assign up to 64 labels. [Google Compute Engine label
     *           restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
     *           apply.
     *           Label names that start with "goog-" or "google-" are reserved.
     *     @type \Google\Cloud\Batch\V1\AllocationPolicy\NetworkPolicy $network
     *           The network policy.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Batch\V1\Job::initOnce();
        parent::__construct($data);
    }

    /**
     * Location where compute resources should be allocated for the Job.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.AllocationPolicy.LocationPolicy location = 1;</code>
     * @return \Google\Cloud\Batch\V1\AllocationPolicy\LocationPolicy|null
     */
    public function getLocation()
    {
        return $this->location;
    }

    public function hasLocation()
    {
        return isset($this->location);
    }

    public function clearLocation()
    {
        unset($this->location);
    }

    /**
     * Location where compute resources should be allocated for the Job.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.AllocationPolicy.LocationPolicy location = 1;</code>
     * @param \Google\Cloud\Batch\V1\AllocationPolicy\LocationPolicy $var
     * @return $this
     */
    public function setLocation($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Batch\V1\AllocationPolicy\LocationPolicy::class);
        $this->location = $var;

        return $this;
    }

    /**
     * Describe instances that can be created by this AllocationPolicy.
     * Only instances[0] is supported now.
     *
     * Generated from protobuf field <code>repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getInstances()
    {
        return $this->instances;
    }

    /**
     * Describe instances that can be created by this AllocationPolicy.
     * Only instances[0] is supported now.
     *
     * Generated from protobuf field <code>repeated .google.cloud.batch.v1.AllocationPolicy.InstancePolicyOrTemplate instances = 8;</code>
     * @param array<\Google\Cloud\Batch\V1\AllocationPolicy\InstancePolicyOrTemplate>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setInstances($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Batch\V1\AllocationPolicy\InstancePolicyOrTemplate::class);
        $this->instances = $arr;

        return $this;
    }

    /**
     * Service account that VMs will run as.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.ServiceAccount service_account = 9;</code>
     * @return \Google\Cloud\Batch\V1\ServiceAccount|null
     */
    public function getServiceAccount()
    {
        return $this->service_account;
    }

    public function hasServiceAccount()
    {
        return isset($this->service_account);
    }

    public function clearServiceAccount()
    {
        unset($this->service_account);
    }

    /**
     * Service account that VMs will run as.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.ServiceAccount service_account = 9;</code>
     * @param \Google\Cloud\Batch\V1\ServiceAccount $var
     * @return $this
     */
    public function setServiceAccount($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Batch\V1\ServiceAccount::class);
        $this->service_account = $var;

        return $this;
    }

    /**
     * Labels applied to all VM instances and other resources
     * created by AllocationPolicy.
     * Labels could be user provided or system generated.
     * You can assign up to 64 labels. [Google Compute Engine label
     * restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
     * apply.
     * Label names that start with "goog-" or "google-" are reserved.
     *
     * Generated from protobuf field <code>map<string, string> labels = 6;</code>
     * @return \Google\Protobuf\Internal\MapField
     */
    public function getLabels()
    {
        return $this->labels;
    }

    /**
     * Labels applied to all VM instances and other resources
     * created by AllocationPolicy.
     * Labels could be user provided or system generated.
     * You can assign up to 64 labels. [Google Compute Engine label
     * restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions)
     * apply.
     * Label names that start with "goog-" or "google-" are reserved.
     *
     * Generated from protobuf field <code>map<string, string> labels = 6;</code>
     * @param array|\Google\Protobuf\Internal\MapField $var
     * @return $this
     */
    public function setLabels($var)
    {
        $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING);
        $this->labels = $arr;

        return $this;
    }

    /**
     * The network policy.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.AllocationPolicy.NetworkPolicy network = 7;</code>
     * @return \Google\Cloud\Batch\V1\AllocationPolicy\NetworkPolicy|null
     */
    public function getNetwork()
    {
        return $this->network;
    }

    public function hasNetwork()
    {
        return isset($this->network);
    }

    public function clearNetwork()
    {
        unset($this->network);
    }

    /**
     * The network policy.
     *
     * Generated from protobuf field <code>.google.cloud.batch.v1.AllocationPolicy.NetworkPolicy network = 7;</code>
     * @param \Google\Cloud\Batch\V1\AllocationPolicy\NetworkPolicy $var
     * @return $this
     */
    public function setNetwork($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Batch\V1\AllocationPolicy\NetworkPolicy::class);
        $this->network = $var;

        return $this;
    }

}

