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

namespace Google\Cloud\SecurityCenter\V1;

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

/**
 * Represents database access information, such as queries.
 * A database may be a sub-resource of an instance (as in the case of CloudSQL
 * instances or Cloud Spanner instances), or the database instance itself.
 * Some database resources may not have the full resource name populated
 * because these resource types are not yet supported by Cloud Asset Inventory
 * (e.g. CloudSQL databases).  In these cases only the display name will be
 * provided.
 *
 * Generated from protobuf message <code>google.cloud.securitycenter.v1.Database</code>
 */
class Database extends \Google\Protobuf\Internal\Message
{
    /**
     * The full resource name of the database the user connected to, if it is
     * supported by CAI. (https://google.aip.dev/122#full-resource-names)
     *
     * Generated from protobuf field <code>string name = 1;</code>
     */
    private $name = '';
    /**
     * The human readable name of the database the user connected to.
     *
     * Generated from protobuf field <code>string display_name = 2;</code>
     */
    private $display_name = '';
    /**
     * The username used to connect to the DB. This may not necessarily be an IAM
     * principal, and has no required format.
     *
     * Generated from protobuf field <code>string user_name = 3;</code>
     */
    private $user_name = '';
    /**
     * The SQL statement associated with the relevant access.
     *
     * Generated from protobuf field <code>string query = 4;</code>
     */
    private $query = '';
    /**
     * The target usernames/roles/groups of a SQL privilege grant (not an IAM
     * policy change).
     *
     * Generated from protobuf field <code>repeated string grantees = 5;</code>
     */
    private $grantees;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $name
     *           The full resource name of the database the user connected to, if it is
     *           supported by CAI. (https://google.aip.dev/122#full-resource-names)
     *     @type string $display_name
     *           The human readable name of the database the user connected to.
     *     @type string $user_name
     *           The username used to connect to the DB. This may not necessarily be an IAM
     *           principal, and has no required format.
     *     @type string $query
     *           The SQL statement associated with the relevant access.
     *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $grantees
     *           The target usernames/roles/groups of a SQL privilege grant (not an IAM
     *           policy change).
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Securitycenter\V1\Database::initOnce();
        parent::__construct($data);
    }

    /**
     * The full resource name of the database the user connected to, if it is
     * supported by CAI. (https://google.aip.dev/122#full-resource-names)
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * The full resource name of the database the user connected to, if it is
     * supported by CAI. (https://google.aip.dev/122#full-resource-names)
     *
     * Generated from protobuf field <code>string name = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setName($var)
    {
        GPBUtil::checkString($var, True);
        $this->name = $var;

        return $this;
    }

    /**
     * The human readable name of the database the user connected to.
     *
     * Generated from protobuf field <code>string display_name = 2;</code>
     * @return string
     */
    public function getDisplayName()
    {
        return $this->display_name;
    }

    /**
     * The human readable name of the database the user connected to.
     *
     * Generated from protobuf field <code>string display_name = 2;</code>
     * @param string $var
     * @return $this
     */
    public function setDisplayName($var)
    {
        GPBUtil::checkString($var, True);
        $this->display_name = $var;

        return $this;
    }

    /**
     * The username used to connect to the DB. This may not necessarily be an IAM
     * principal, and has no required format.
     *
     * Generated from protobuf field <code>string user_name = 3;</code>
     * @return string
     */
    public function getUserName()
    {
        return $this->user_name;
    }

    /**
     * The username used to connect to the DB. This may not necessarily be an IAM
     * principal, and has no required format.
     *
     * Generated from protobuf field <code>string user_name = 3;</code>
     * @param string $var
     * @return $this
     */
    public function setUserName($var)
    {
        GPBUtil::checkString($var, True);
        $this->user_name = $var;

        return $this;
    }

    /**
     * The SQL statement associated with the relevant access.
     *
     * Generated from protobuf field <code>string query = 4;</code>
     * @return string
     */
    public function getQuery()
    {
        return $this->query;
    }

    /**
     * The SQL statement associated with the relevant access.
     *
     * Generated from protobuf field <code>string query = 4;</code>
     * @param string $var
     * @return $this
     */
    public function setQuery($var)
    {
        GPBUtil::checkString($var, True);
        $this->query = $var;

        return $this;
    }

    /**
     * The target usernames/roles/groups of a SQL privilege grant (not an IAM
     * policy change).
     *
     * Generated from protobuf field <code>repeated string grantees = 5;</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getGrantees()
    {
        return $this->grantees;
    }

    /**
     * The target usernames/roles/groups of a SQL privilege grant (not an IAM
     * policy change).
     *
     * Generated from protobuf field <code>repeated string grantees = 5;</code>
     * @param array<string>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setGrantees($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->grantees = $arr;

        return $this;
    }

}

