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

namespace Google\Cloud\ApiHub\V1\AuthConfig;

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

/**
 * Parameters to support Username and Password Authentication.
 *
 * Generated from protobuf message <code>google.cloud.apihub.v1.AuthConfig.UserPasswordConfig</code>
 */
class UserPasswordConfig extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. Username.
     *
     * Generated from protobuf field <code>string username = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $username = '';
    /**
     * Required. Secret version reference containing the password.
     * The `secretmanager.versions.access` permission should be
     * granted to the service account accessing the secret.
     *
     * Generated from protobuf field <code>.google.cloud.apihub.v1.Secret password = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    protected $password = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $username
     *           Required. Username.
     *     @type \Google\Cloud\ApiHub\V1\Secret $password
     *           Required. Secret version reference containing the password.
     *           The `secretmanager.versions.access` permission should be
     *           granted to the service account accessing the secret.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Apihub\V1\CommonFields::initOnce();
        parent::__construct($data);
    }

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

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

        return $this;
    }

    /**
     * Required. Secret version reference containing the password.
     * The `secretmanager.versions.access` permission should be
     * granted to the service account accessing the secret.
     *
     * Generated from protobuf field <code>.google.cloud.apihub.v1.Secret password = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Cloud\ApiHub\V1\Secret|null
     */
    public function getPassword()
    {
        return $this->password;
    }

    public function hasPassword()
    {
        return isset($this->password);
    }

    public function clearPassword()
    {
        unset($this->password);
    }

    /**
     * Required. Secret version reference containing the password.
     * The `secretmanager.versions.access` permission should be
     * granted to the service account accessing the secret.
     *
     * Generated from protobuf field <code>.google.cloud.apihub.v1.Secret password = 2 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param \Google\Cloud\ApiHub\V1\Secret $var
     * @return $this
     */
    public function setPassword($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\ApiHub\V1\Secret::class);
        $this->password = $var;

        return $this;
    }

}


