<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/run/v2/k8s.min.proto

namespace Google\Cloud\Run\V2;

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

/**
 * Volume represents a named volume in a container.
 *
 * Generated from protobuf message <code>google.cloud.run.v2.Volume</code>
 */
class Volume extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Volume's name.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $name = '';
    protected $volume_type;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Required. Volume's name.
     *     @type \Google\Cloud\Run\V2\SecretVolumeSource $secret
     *           Secret represents a secret that should populate this volume.
     *           More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
     *     @type \Google\Cloud\Run\V2\CloudSqlInstance $cloud_sql_instance
     *           For Cloud SQL volumes, contains the specific instances that should be
     *           mounted. Visit https://cloud.google.com/sql/docs/mysql/connect-run for
     *           more information on how to connect Cloud SQL and Cloud Run.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Run\V2\K8SMin::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Volume's name.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. Volume's name.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Secret represents a secret that should populate this volume.
     * More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.SecretVolumeSource secret = 2;</code>
     * @return \Google\Cloud\Run\V2\SecretVolumeSource|null
     */
    public function getSecret()
    {
        return $this->readOneof(2);
    }

    public function hasSecret()
    {
        return $this->hasOneof(2);
    }

    /**
     * Secret represents a secret that should populate this volume.
     * More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.SecretVolumeSource secret = 2;</code>
     * @param \Google\Cloud\Run\V2\SecretVolumeSource $var
     * @return $this
     */
    public function setSecret($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Run\V2\SecretVolumeSource::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * For Cloud SQL volumes, contains the specific instances that should be
     * mounted. Visit https://cloud.google.com/sql/docs/mysql/connect-run for
     * more information on how to connect Cloud SQL and Cloud Run.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.CloudSqlInstance cloud_sql_instance = 3;</code>
     * @return \Google\Cloud\Run\V2\CloudSqlInstance|null
     */
    public function getCloudSqlInstance()
    {
        return $this->readOneof(3);
    }

    public function hasCloudSqlInstance()
    {
        return $this->hasOneof(3);
    }

    /**
     * For Cloud SQL volumes, contains the specific instances that should be
     * mounted. Visit https://cloud.google.com/sql/docs/mysql/connect-run for
     * more information on how to connect Cloud SQL and Cloud Run.
     *
     * Generated from protobuf field <code>.google.cloud.run.v2.CloudSqlInstance cloud_sql_instance = 3;</code>
     * @param \Google\Cloud\Run\V2\CloudSqlInstance $var
     * @return $this
     */
    public function setCloudSqlInstance($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Run\V2\CloudSqlInstance::class);
        $this->writeOneof(3, $var);

        return $this;
    }

    /**
     * @return string
     */
    public function getVolumeType()
    {
        return $this->whichOneof("volume_type");
    }

}

