// *** 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.Mssql
{
    /// <summary>
    /// ## # mssql.Login
    /// 
    /// The `mssql.Login` resource creates and manages a login on a SQL Server.
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using Pulumi;
    /// using Mssql = Pulumi.Mssql;
    /// 
    /// class MyStack : Stack
    /// {
    ///     public MyStack()
    ///     {
    ///         var example = new Mssql.Login("example", new Mssql.LoginArgs
    ///         {
    ///             LoginName = "testlogin",
    ///             Server = new Mssql.Inputs.LoginServerArgs
    ///             {
    ///                 AzureLogin = ,
    ///                 Host = "example-sql-server.database.windows.net",
    ///             },
    ///         });
    ///     }
    /// 
    /// }
    /// ```
    /// 
    /// ## Import
    /// 
    /// Before importing `mssql_login`, you must to configure the authentication to your sql server1. Using Azure AD authentication, you must set the following environment variables`MSSQL_TENANT_ID`, `MSSQL_CLIENT_ID` and `MSSQL_CLIENT_SECRET`. 2. Using SQL authentication, you must set the following environment variables`MSSQL_USERNAME` and `MSSQL_PASSWORD`. After that you can import the SQL Server login using the server URL and `login name`, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import mssql:index/login:Login example 'mssql://example-sql-server.database.windows.net/testlogin'
    /// ```
    /// </summary>
    [MssqlResourceType("mssql:index/login:Login")]
    public partial class Login : Pulumi.CustomResource
    {
        /// <summary>
        /// The default database of this server login. Defaults to `master`. This argument does not apply to Azure SQL Database.
        /// </summary>
        [Output("defaultDatabase")]
        public Output<string?> DefaultDatabase { get; private set; } = null!;

        /// <summary>
        /// The default language of this server login. Defaults to `us_english`. This argument does not apply to Azure SQL Database.
        /// </summary>
        [Output("defaultLanguage")]
        public Output<string?> DefaultLanguage { get; private set; } = null!;

        /// <summary>
        /// The name of the server login. Changing this forces a new resource to be created.
        /// </summary>
        [Output("loginName")]
        public Output<string> LoginName { get; private set; } = null!;

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

        /// <summary>
        /// The principal id of this server login.
        /// </summary>
        [Output("principalId")]
        public Output<int> PrincipalId { get; private set; } = null!;

        /// <summary>
        /// Server and login details for the SQL Server. The attributes supported in the `server` block is detailed below.
        /// </summary>
        [Output("server")]
        public Output<Outputs.LoginServer> Server { get; private set; } = null!;


        /// <summary>
        /// Create a Login 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 Login(string name, LoginArgs args, CustomResourceOptions? options = null)
            : base("mssql:index/login:Login", name, args ?? new LoginArgs(), MakeResourceOptions(options, ""))
        {
        }

        private Login(string name, Input<string> id, LoginState? state = null, CustomResourceOptions? options = null)
            : base("mssql:index/login:Login", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
            };
            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 Login 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 Login Get(string name, Input<string> id, LoginState? state = null, CustomResourceOptions? options = null)
        {
            return new Login(name, id, state, options);
        }
    }

    public sealed class LoginArgs : Pulumi.ResourceArgs
    {
        /// <summary>
        /// The default database of this server login. Defaults to `master`. This argument does not apply to Azure SQL Database.
        /// </summary>
        [Input("defaultDatabase")]
        public Input<string>? DefaultDatabase { get; set; }

        /// <summary>
        /// The default language of this server login. Defaults to `us_english`. This argument does not apply to Azure SQL Database.
        /// </summary>
        [Input("defaultLanguage")]
        public Input<string>? DefaultLanguage { get; set; }

        /// <summary>
        /// The name of the server login. Changing this forces a new resource to be created.
        /// </summary>
        [Input("loginName", required: true)]
        public Input<string> LoginName { get; set; } = null!;

        /// <summary>
        /// The password of the server login.
        /// </summary>
        [Input("password", required: true)]
        public Input<string> Password { get; set; } = null!;

        /// <summary>
        /// Server and login details for the SQL Server. The attributes supported in the `server` block is detailed below.
        /// </summary>
        [Input("server", required: true)]
        public Input<Inputs.LoginServerArgs> Server { get; set; } = null!;

        public LoginArgs()
        {
        }
    }

    public sealed class LoginState : Pulumi.ResourceArgs
    {
        /// <summary>
        /// The default database of this server login. Defaults to `master`. This argument does not apply to Azure SQL Database.
        /// </summary>
        [Input("defaultDatabase")]
        public Input<string>? DefaultDatabase { get; set; }

        /// <summary>
        /// The default language of this server login. Defaults to `us_english`. This argument does not apply to Azure SQL Database.
        /// </summary>
        [Input("defaultLanguage")]
        public Input<string>? DefaultLanguage { get; set; }

        /// <summary>
        /// The name of the server login. Changing this forces a new resource to be created.
        /// </summary>
        [Input("loginName")]
        public Input<string>? LoginName { get; set; }

        /// <summary>
        /// The password of the server login.
        /// </summary>
        [Input("password")]
        public Input<string>? Password { get; set; }

        /// <summary>
        /// The principal id of this server login.
        /// </summary>
        [Input("principalId")]
        public Input<int>? PrincipalId { get; set; }

        /// <summary>
        /// Server and login details for the SQL Server. The attributes supported in the `server` block is detailed below.
        /// </summary>
        [Input("server")]
        public Input<Inputs.LoginServerGetArgs>? Server { get; set; }

        public LoginState()
        {
        }
    }
}
