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

namespace Google\Cloud\AlloyDb\V1alpha;

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

/**
 * Message describing User object.
 *
 * Generated from protobuf message <code>google.cloud.alloydb.v1alpha.User</code>
 */
class User extends \Google\Protobuf\Internal\Message
{
    /**
     * Output only. Name of the resource in the form of
     * projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     */
    protected $name = '';
    /**
     * Input only. Password for the user.
     *
     * Generated from protobuf field <code>string password = 2 [(.google.api.field_behavior) = INPUT_ONLY];</code>
     */
    protected $password = '';
    /**
     * Optional. List of database roles this user has.
     * The database role strings are subject to the PostgreSQL naming conventions.
     *
     * Generated from protobuf field <code>repeated string database_roles = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $database_roles;
    /**
     * Optional. Type of this user.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1alpha.User.UserType user_type = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $user_type = 0;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           Output only. Name of the resource in the form of
     *           projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
     *     @type string $password
     *           Input only. Password for the user.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $database_roles
     *           Optional. List of database roles this user has.
     *           The database role strings are subject to the PostgreSQL naming conventions.
     *     @type int $user_type
     *           Optional. Type of this user.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Alloydb\V1Alpha\Resources::initOnce();
        parent::__construct($data);
    }

    /**
     * Output only. Name of the resource in the form of
     * projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Output only. Name of the resource in the form of
     * projects/{project}/locations/{location}/cluster/{cluster}/users/{user}.
     *
     * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * Input only. Password for the user.
     *
     * Generated from protobuf field <code>string password = 2 [(.google.api.field_behavior) = INPUT_ONLY];</code>
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Input only. Password for the user.
     *
     * Generated from protobuf field <code>string password = 2 [(.google.api.field_behavior) = INPUT_ONLY];</code>
     * @param string $var
     * @return $this
     */
    public function setPassword($var)
    {
        GPBUtil::checkString($var, True);
        $this->password = $var;

        return $this;
    }

    /**
     * Optional. List of database roles this user has.
     * The database role strings are subject to the PostgreSQL naming conventions.
     *
     * Generated from protobuf field <code>repeated string database_roles = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getDatabaseRoles()
    {
        return $this->database_roles;
    }

    /**
     * Optional. List of database roles this user has.
     * The database role strings are subject to the PostgreSQL naming conventions.
     *
     * Generated from protobuf field <code>repeated string database_roles = 4 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setDatabaseRoles($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->database_roles = $arr;

        return $this;
    }

    /**
     * Optional. Type of this user.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1alpha.User.UserType user_type = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return int
     */
    public function getUserType()
    {
        return $this->user_type;
    }

    /**
     * Optional. Type of this user.
     *
     * Generated from protobuf field <code>.google.cloud.alloydb.v1alpha.User.UserType user_type = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param int $var
     * @return $this
     */
    public function setUserType($var)
    {
        GPBUtil::checkEnum($var, \Google\Cloud\AlloyDb\V1alpha\User\UserType::class);
        $this->user_type = $var;

        return $this;
    }

}

