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

namespace Google\Cloud\AlloyDb\V1;

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

/**
 * Export cluster request.
 *
 * Generated from protobuf message <code>google.cloud.alloydb.v1.ExportClusterRequest</code>
 */
class ExportClusterRequest extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The resource name of the cluster.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     */
    protected $name = '';
    /**
     * Required. Name of the database where the export command will be executed.
     * Note - Value provided should be the same as expected from
     * `SELECT current_database();` and NOT as a resource reference.
     *
     * Generated from protobuf field <code>string database = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $database = '';
    protected $destination;
    protected $export_options;

    /**
     * @param string                                                         $name             Required. The resource name of the cluster. Please see
     *                                                                                         {@see AlloyDBAdminClient::clusterName()} for help formatting this field.
     * @param \Google\Cloud\AlloyDb\V1\GcsDestination                        $gcsDestination   Required. Option to export data to cloud storage.
     * @param string                                                         $database         Required. Name of the database where the export command will be executed.
     *                                                                                         Note - Value provided should be the same as expected from
     *                                                                                         `SELECT current_database();` and NOT as a resource reference.
     * @param \Google\Cloud\AlloyDb\V1\ExportClusterRequest\CsvExportOptions $csvExportOptions Options for exporting data in CSV format. Required field to be set for
     *                                                                                         CSV file type.
     * @param \Google\Cloud\AlloyDb\V1\ExportClusterRequest\SqlExportOptions $sqlExportOptions Options for exporting data in SQL format. Required field to be set for
     *                                                                                         SQL file type.
     *
     * @return \Google\Cloud\AlloyDb\V1\ExportClusterRequest
     *
     * @experimental
     */
    public static function build(string $name, \Google\Cloud\AlloyDb\V1\GcsDestination $gcsDestination, string $database, \Google\Cloud\AlloyDb\V1\ExportClusterRequest\CsvExportOptions $csvExportOptions, \Google\Cloud\AlloyDb\V1\ExportClusterRequest\SqlExportOptions $sqlExportOptions): self
    {
        return (new self())
            ->setName($name)
            ->setGcsDestination($gcsDestination)
            ->setDatabase($database)
            ->setCsvExportOptions($csvExportOptions)
            ->setSqlExportOptions($sqlExportOptions);
    }

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\AlloyDb\V1\GcsDestination $gcs_destination
     *           Required. Option to export data to cloud storage.
     *     @type \Google\Cloud\AlloyDb\V1\ExportClusterRequest\CsvExportOptions $csv_export_options
     *           Options for exporting data in CSV format. Required field to be set for
     *           CSV file type.
     *     @type \Google\Cloud\AlloyDb\V1\ExportClusterRequest\SqlExportOptions $sql_export_options
     *           Options for exporting data in SQL format. Required field to be set for
     *           SQL file type.
     *     @type string $name
     *           Required. The resource name of the cluster.
     *     @type string $database
     *           Required. Name of the database where the export command will be executed.
     *           Note - Value provided should be the same as expected from
     *           `SELECT current_database();` and NOT as a resource reference.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Alloydb\V1\Service::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. Option to export data to cloud storage.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1.GcsDestination gcs_destination = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\AlloyDb\V1\GcsDestination|null
     */
    public function getGcsDestination()
    {
        return $this->readOneof(2);
    }

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

    /**
     * Required. Option to export data to cloud storage.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1.GcsDestination gcs_destination = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\AlloyDb\V1\GcsDestination $var
     * @return $this
     */
    public function setGcsDestination($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\GcsDestination::class);
        $this->writeOneof(2, $var);

        return $this;
    }

    /**
     * Options for exporting data in CSV format. Required field to be set for
     * CSV file type.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1.ExportClusterRequest.CsvExportOptions csv_export_options = 4;</code>
     * @return \Google\Cloud\AlloyDb\V1\ExportClusterRequest\CsvExportOptions|null
     */
    public function getCsvExportOptions()
    {
        return $this->readOneof(4);
    }

    public function hasCsvExportOptions()
    {
        return $this->hasOneof(4);
    }

    /**
     * Options for exporting data in CSV format. Required field to be set for
     * CSV file type.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1.ExportClusterRequest.CsvExportOptions csv_export_options = 4;</code>
     * @param \Google\Cloud\AlloyDb\V1\ExportClusterRequest\CsvExportOptions $var
     * @return $this
     */
    public function setCsvExportOptions($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\ExportClusterRequest\CsvExportOptions::class);
        $this->writeOneof(4, $var);

        return $this;
    }

    /**
     * Options for exporting data in SQL format. Required field to be set for
     * SQL file type.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1.ExportClusterRequest.SqlExportOptions sql_export_options = 5;</code>
     * @return \Google\Cloud\AlloyDb\V1\ExportClusterRequest\SqlExportOptions|null
     */
    public function getSqlExportOptions()
    {
        return $this->readOneof(5);
    }

    public function hasSqlExportOptions()
    {
        return $this->hasOneof(5);
    }

    /**
     * Options for exporting data in SQL format. Required field to be set for
     * SQL file type.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1.ExportClusterRequest.SqlExportOptions sql_export_options = 5;</code>
     * @param \Google\Cloud\AlloyDb\V1\ExportClusterRequest\SqlExportOptions $var
     * @return $this
     */
    public function setSqlExportOptions($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\AlloyDb\V1\ExportClusterRequest\SqlExportOptions::class);
        $this->writeOneof(5, $var);

        return $this;
    }

    /**
     * Required. The resource name of the cluster.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Required. The resource name of the cluster.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Required. Name of the database where the export command will be executed.
     * Note - Value provided should be the same as expected from
     * `SELECT current_database();` and NOT as a resource reference.
     *
     * Generated from protobuf field <code>string database = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getDatabase()
    {
        return $this->database;
    }

    /**
     * Required. Name of the database where the export command will be executed.
     * Note - Value provided should be the same as expected from
     * `SELECT current_database();` and NOT as a resource reference.
     *
     * Generated from protobuf field <code>string database = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setDatabase($var)
    {
        GPBUtil::checkString($var, True);
        $this->database = $var;

        return $this;
    }

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

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

}

