<gh_stars>0// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;

namespace Pulumi.Yandex
{
    /// <summary>
    /// Manages a MySQL user within the Yandex.Cloud. For more information, see
    /// [the official documentation](https://cloud.yandex.com/docs/managed-mysql/).
    /// 
    /// ## Import
    /// 
    /// A MySQL user can be imported using the following format
    /// 
    /// ```sh
    ///  $ pulumi import yandex:index/mdbMysqlUser:mdbMysqlUser foo {{cluster_id}}:{{username}}
    /// ```
    /// </summary>
    [YandexResourceType("yandex:index/mdbMysqlUser:mdbMysqlUser")]
    public partial class MdbMysqlUser : global::Pulumi.CustomResource
    {
        /// <summary>
        /// Authentication plugin. Allowed values: `MYSQL_NATIVE_PASSWORD`, `CACHING_SHA2_PASSWORD`, `SHA256_PASSWORD` (for version 5.7 `MYSQL_NATIVE_PASSWORD`, `SHA256_PASSWORD`)
        /// </summary>
        [Output("authenticationPlugin")]
        public Output<string> AuthenticationPlugin { get; private set; } = null!;

        [Output("clusterId")]
        public Output<string> ClusterId { get; private set; } = null!;

        /// <summary>
        /// User's connection limits. The structure is documented below.
        /// If the attribute is not specified there will be no changes.
        /// </summary>
        [Output("connectionLimits")]
        public Output<Outputs.MdbMysqlUserConnectionLimits> ConnectionLimits { get; private set; } = null!;

        /// <summary>
        /// List user's global permissions     
        /// Allowed permissions:  `REPLICATION_CLIENT`, `REPLICATION_SLAVE`, `PROCESS` for clear list use empty list.
        /// If the attribute is not specified there will be no changes.
        /// </summary>
        [Output("globalPermissions")]
        public Output<ImmutableArray<string>> GlobalPermissions { get; private set; } = null!;

        /// <summary>
        /// The name of the user.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// The password of the user.
        /// </summary>
        [Output("password")]
        public Output<string> Password { get; private set; } = null!;

        /// <summary>
        /// Set of permissions granted to the user. The structure is documented below.
        /// </summary>
        [Output("permissions")]
        public Output<ImmutableArray<Outputs.MdbMysqlUserPermission>> Permissions { get; private set; } = null!;


        /// <summary>
        /// Create a MdbMysqlUser resource with the given unique name, arguments, and options.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resource</param>
        /// <param name="args">The arguments used to populate this resource's properties</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public MdbMysqlUser(string name, MdbMysqlUserArgs args, CustomResourceOptions? options = null)
            : base("yandex:index/mdbMysqlUser:mdbMysqlUser", name, args ?? new MdbMysqlUserArgs(), MakeResourceOptions(options, ""))
        {
        }

        private MdbMysqlUser(string name, Input<string> id, MdbMysqlUserState? state = null, CustomResourceOptions? options = null)
            : base("yandex:index/mdbMysqlUser:mdbMysqlUser", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "https://github.com/regrau/pulumi-yandex/releases",
                AdditionalSecretOutputs =
                {
                    "password",
                },
            };
            var merged = CustomResourceOptions.Merge(defaultOptions, options);
            // Override the ID if one was specified for consistency with other language SDKs.
            merged.Id = id ?? merged.Id;
            return merged;
        }
        /// <summary>
        /// Get an existing MdbMysqlUser resource's state with the given name, ID, and optional extra
        /// properties used to qualify the lookup.
        /// </summary>
        ///
        /// <param name="name">The unique name of the resulting resource.</param>
        /// <param name="id">The unique provider ID of the resource to lookup.</param>
        /// <param name="state">Any extra arguments used during the lookup.</param>
        /// <param name="options">A bag of options that control this resource's behavior</param>
        public static MdbMysqlUser Get(string name, Input<string> id, MdbMysqlUserState? state = null, CustomResourceOptions? options = null)
        {
            return new MdbMysqlUser(name, id, state, options);
        }
    }

    public sealed class MdbMysqlUserArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Authentication plugin. Allowed values: `MYSQL_NATIVE_PASSWORD`, `CACHING_SHA2_PASSWORD`, `SHA256_PASSWORD` (for version 5.7 `MYSQL_NATIVE_PASSWORD`, `SHA256_PASSWORD`)
        /// </summary>
        [Input("authenticationPlugin")]
        public Input<string>? AuthenticationPlugin { get; set; }

        [Input("clusterId", required: true)]
        public Input<string> ClusterId { get; set; } = null!;

        /// <summary>
        /// User's connection limits. The structure is documented below.
        /// If the attribute is not specified there will be no changes.
        /// </summary>
        [Input("connectionLimits")]
        public Input<Inputs.MdbMysqlUserConnectionLimitsArgs>? ConnectionLimits { get; set; }

        [Input("globalPermissions")]
        private InputList<string>? _globalPermissions;

        /// <summary>
        /// List user's global permissions     
        /// Allowed permissions:  `REPLICATION_CLIENT`, `REPLICATION_SLAVE`, `PROCESS` for clear list use empty list.
        /// If the attribute is not specified there will be no changes.
        /// </summary>
        public InputList<string> GlobalPermissions
        {
            get => _globalPermissions ?? (_globalPermissions = new InputList<string>());
            set => _globalPermissions = value;
        }

        /// <summary>
        /// The name of the user.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        [Input("password", required: true)]
        private Input<string>? _password;

        /// <summary>
        /// The password of the user.
        /// </summary>
        public Input<string>? Password
        {
            get => _password;
            set
            {
                var emptySecret = Output.CreateSecret(0);
                _password = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
            }
        }

        [Input("permissions")]
        private InputList<Inputs.MdbMysqlUserPermissionArgs>? _permissions;

        /// <summary>
        /// Set of permissions granted to the user. The structure is documented below.
        /// </summary>
        public InputList<Inputs.MdbMysqlUserPermissionArgs> Permissions
        {
            get => _permissions ?? (_permissions = new InputList<Inputs.MdbMysqlUserPermissionArgs>());
            set => _permissions = value;
        }

        public MdbMysqlUserArgs()
        {
        }
        public static new MdbMysqlUserArgs Empty => new MdbMysqlUserArgs();
    }

    public sealed class MdbMysqlUserState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Authentication plugin. Allowed values: `MYSQL_NATIVE_PASSWORD`, `CACHING_SHA2_PASSWORD`, `SHA256_PASSWORD` (for version 5.7 `MYSQL_NATIVE_PASSWORD`, `SHA256_PASSWORD`)
        /// </summary>
        [Input("authenticationPlugin")]
        public Input<string>? AuthenticationPlugin { get; set; }

        [Input("clusterId")]
        public Input<string>? ClusterId { get; set; }

        /// <summary>
        /// User's connection limits. The structure is documented below.
        /// If the attribute is not specified there will be no changes.
        /// </summary>
        [Input("connectionLimits")]
        public Input<Inputs.MdbMysqlUserConnectionLimitsGetArgs>? ConnectionLimits { get; set; }

        [Input("globalPermissions")]
        private InputList<string>? _globalPermissions;

        /// <summary>
        /// List user's global permissions     
        /// Allowed permissions:  `REPLICATION_CLIENT`, `REPLICATION_SLAVE`, `PROCESS` for clear list use empty list.
        /// If the attribute is not specified there will be no changes.
        /// </summary>
        public InputList<string> GlobalPermissions
        {
            get => _globalPermissions ?? (_globalPermissions = new InputList<string>());
            set => _globalPermissions = value;
        }

        /// <summary>
        /// The name of the user.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

        [Input("password")]
        private Input<string>? _password;

        /// <summary>
        /// The password of the user.
        /// </summary>
        public Input<string>? Password
        {
            get => _password;
            set
            {
                var emptySecret = Output.CreateSecret(0);
                _password = Output.Tuple<Input<string>?, int>(value, emptySecret).Apply(t => t.Item1);
            }
        }

        [Input("permissions")]
        private InputList<Inputs.MdbMysqlUserPermissionGetArgs>? _permissions;

        /// <summary>
        /// Set of permissions granted to the user. The structure is documented below.
        /// </summary>
        public InputList<Inputs.MdbMysqlUserPermissionGetArgs> Permissions
        {
            get => _permissions ?? (_permissions = new InputList<Inputs.MdbMysqlUserPermissionGetArgs>());
            set => _permissions = value;
        }

        public MdbMysqlUserState()
        {
        }
        public static new MdbMysqlUserState Empty => new MdbMysqlUserState();
    }
}
