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

namespace Google\Cloud\Datastream\V1;

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

/**
 * MongoDB profile.
 *
 * Generated from protobuf message <code>google.cloud.datastream.v1.MongodbProfile</code>
 */
class MongodbProfile extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. List of host addresses for a MongoDB cluster.
     * For SRV connection format, this list must contain exactly one DNS host
     * without a port. For Standard connection format, this list must contain all
     * the required hosts in the cluster with their respective ports.
     *
     * Generated from protobuf field <code>repeated .google.cloud.datastream.v1.HostAddress host_addresses = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $host_addresses;
    /**
     * Optional. Name of the replica set. Only needed for self hosted replica set
     * type MongoDB cluster. For SRV connection format, this field must be empty.
     * For Standard connection format, this field must be specified.
     *
     * Generated from protobuf field <code>string replica_set = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $replica_set = '';
    /**
     * Required. Username for the MongoDB connection.
     *
     * Generated from protobuf field <code>string username = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $username = '';
    /**
     * Optional. Password for the MongoDB connection. Mutually exclusive with the
     * `secret_manager_stored_password` field.
     *
     * Generated from protobuf field <code>string password = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $password = '';
    /**
     * Optional. A reference to a Secret Manager resource name storing the
     * SQLServer connection password. Mutually exclusive with the `password`
     * field.
     *
     * Generated from protobuf field <code>string secret_manager_stored_password = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $secret_manager_stored_password = '';
    /**
     * Optional. SSL configuration for the MongoDB connection.
     *
     * Generated from protobuf field <code>.google.cloud.datastream.v1.MongodbSslConfig ssl_config = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $ssl_config = null;
    protected $mongodb_connection_format;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<\Google\Cloud\Datastream\V1\HostAddress>|\Google\Protobuf\Internal\RepeatedField $host_addresses
     *           Required. List of host addresses for a MongoDB cluster.
     *           For SRV connection format, this list must contain exactly one DNS host
     *           without a port. For Standard connection format, this list must contain all
     *           the required hosts in the cluster with their respective ports.
     *     @type string $replica_set
     *           Optional. Name of the replica set. Only needed for self hosted replica set
     *           type MongoDB cluster. For SRV connection format, this field must be empty.
     *           For Standard connection format, this field must be specified.
     *     @type string $username
     *           Required. Username for the MongoDB connection.
     *     @type string $password
     *           Optional. Password for the MongoDB connection. Mutually exclusive with the
     *           `secret_manager_stored_password` field.
     *     @type string $secret_manager_stored_password
     *           Optional. A reference to a Secret Manager resource name storing the
     *           SQLServer connection password. Mutually exclusive with the `password`
     *           field.
     *     @type \Google\Cloud\Datastream\V1\MongodbSslConfig $ssl_config
     *           Optional. SSL configuration for the MongoDB connection.
     *     @type \Google\Cloud\Datastream\V1\SrvConnectionFormat $srv_connection_format
     *           Srv connection format.
     *     @type \Google\Cloud\Datastream\V1\StandardConnectionFormat $standard_connection_format
     *           Standard connection format.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Datastream\V1\DatastreamResources::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. List of host addresses for a MongoDB cluster.
     * For SRV connection format, this list must contain exactly one DNS host
     * without a port. For Standard connection format, this list must contain all
     * the required hosts in the cluster with their respective ports.
     *
     * Generated from protobuf field <code>repeated .google.cloud.datastream.v1.HostAddress host_addresses = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getHostAddresses()
    {
        return $this->host_addresses;
    }

    /**
     * Required. List of host addresses for a MongoDB cluster.
     * For SRV connection format, this list must contain exactly one DNS host
     * without a port. For Standard connection format, this list must contain all
     * the required hosts in the cluster with their respective ports.
     *
     * Generated from protobuf field <code>repeated .google.cloud.datastream.v1.HostAddress host_addresses = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param array<\Google\Cloud\Datastream\V1\HostAddress>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setHostAddresses($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Datastream\V1\HostAddress::class);
        $this->host_addresses = $arr;

        return $this;
    }

    /**
     * Optional. Name of the replica set. Only needed for self hosted replica set
     * type MongoDB cluster. For SRV connection format, this field must be empty.
     * For Standard connection format, this field must be specified.
     *
     * Generated from protobuf field <code>string replica_set = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getReplicaSet()
    {
        return $this->replica_set;
    }

    /**
     * Optional. Name of the replica set. Only needed for self hosted replica set
     * type MongoDB cluster. For SRV connection format, this field must be empty.
     * For Standard connection format, this field must be specified.
     *
     * Generated from protobuf field <code>string replica_set = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setReplicaSet($var)
    {
        GPBUtil::checkString($var, True);
        $this->replica_set = $var;

        return $this;
    }

    /**
     * Required. Username for the MongoDB connection.
     *
     * Generated from protobuf field <code>string username = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return string
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Required. Username for the MongoDB connection.
     *
     * Generated from protobuf field <code>string username = 3 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param string $var
     * @return $this
     */
    public function setUsername($var)
    {
        GPBUtil::checkString($var, True);
        $this->username = $var;

        return $this;
    }

    /**
     * Optional. Password for the MongoDB connection. Mutually exclusive with the
     * `secret_manager_stored_password` field.
     *
     * Generated from protobuf field <code>string password = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Optional. Password for the MongoDB connection. Mutually exclusive with the
     * `secret_manager_stored_password` field.
     *
     * Generated from protobuf field <code>string password = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setPassword($var)
    {
        GPBUtil::checkString($var, True);
        $this->password = $var;

        return $this;
    }

    /**
     * Optional. A reference to a Secret Manager resource name storing the
     * SQLServer connection password. Mutually exclusive with the `password`
     * field.
     *
     * Generated from protobuf field <code>string secret_manager_stored_password = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return string
     */
    public function getSecretManagerStoredPassword()
    {
        return $this->secret_manager_stored_password;
    }

    /**
     * Optional. A reference to a Secret Manager resource name storing the
     * SQLServer connection password. Mutually exclusive with the `password`
     * field.
     *
     * Generated from protobuf field <code>string secret_manager_stored_password = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string $var
     * @return $this
     */
    public function setSecretManagerStoredPassword($var)
    {
        GPBUtil::checkString($var, True);
        $this->secret_manager_stored_password = $var;

        return $this;
    }

    /**
     * Optional. SSL configuration for the MongoDB connection.
     *
     * Generated from protobuf field <code>.google.cloud.datastream.v1.MongodbSslConfig ssl_config = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\Datastream\V1\MongodbSslConfig|null
     */
    public function getSslConfig()
    {
        return $this->ssl_config;
    }

    public function hasSslConfig()
    {
        return isset($this->ssl_config);
    }

    public function clearSslConfig()
    {
        unset($this->ssl_config);
    }

    /**
     * Optional. SSL configuration for the MongoDB connection.
     *
     * Generated from protobuf field <code>.google.cloud.datastream.v1.MongodbSslConfig ssl_config = 6 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\Datastream\V1\MongodbSslConfig $var
     * @return $this
     */
    public function setSslConfig($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Datastream\V1\MongodbSslConfig::class);
        $this->ssl_config = $var;

        return $this;
    }

    /**
     * Srv connection format.
     *
     * Generated from protobuf field <code>.google.cloud.datastream.v1.SrvConnectionFormat srv_connection_format = 101;</code>
     * @return \Google\Cloud\Datastream\V1\SrvConnectionFormat|null
     */
    public function getSrvConnectionFormat()
    {
        return $this->readOneof(101);
    }

    public function hasSrvConnectionFormat()
    {
        return $this->hasOneof(101);
    }

    /**
     * Srv connection format.
     *
     * Generated from protobuf field <code>.google.cloud.datastream.v1.SrvConnectionFormat srv_connection_format = 101;</code>
     * @param \Google\Cloud\Datastream\V1\SrvConnectionFormat $var
     * @return $this
     */
    public function setSrvConnectionFormat($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Datastream\V1\SrvConnectionFormat::class);
        $this->writeOneof(101, $var);

        return $this;
    }

    /**
     * Standard connection format.
     *
     * Generated from protobuf field <code>.google.cloud.datastream.v1.StandardConnectionFormat standard_connection_format = 102;</code>
     * @return \Google\Cloud\Datastream\V1\StandardConnectionFormat|null
     */
    public function getStandardConnectionFormat()
    {
        return $this->readOneof(102);
    }

    public function hasStandardConnectionFormat()
    {
        return $this->hasOneof(102);
    }

    /**
     * Standard connection format.
     *
     * Generated from protobuf field <code>.google.cloud.datastream.v1.StandardConnectionFormat standard_connection_format = 102;</code>
     * @param \Google\Cloud\Datastream\V1\StandardConnectionFormat $var
     * @return $this
     */
    public function setStandardConnectionFormat($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\Datastream\V1\StandardConnectionFormat::class);
        $this->writeOneof(102, $var);

        return $this;
    }

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

}

