// *** 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;
using Pulumi;

namespace zscaler.PulumiPackage.Zia.Users
{
    /// <summary>
    /// The **zia_user_management** resource allows the creation and management of local user account in the Zscaler Internet Access cloud. The user account resource can then be associated with several different types of resource within the ZIA tenant.
    /// 
    /// ## Example Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using Pulumi;
    /// using Zia = Pulumi.Zia;
    /// using Zia = zscaler.PulumiPackage.Zia;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var normalInternet = Zia.Groups.GetGroupManagement.Invoke(new()
    ///     {
    ///         Name = "Normal_Internet",
    ///     });
    /// 
    ///     var engineering = Zia.Departments.GetDepartmentManagement.Invoke(new()
    ///     {
    ///         Name = "Engineering",
    ///     });
    /// 
    ///     // ZIA Local User Account
    ///     var johnAshcroft = new Zia.Users.UserManagement("johnAshcroft", new()
    ///     {
    ///         Email = "hzdkv@example.com",
    ///         Password = "P@ssw0rd123*",
    ///         Groups = new Zia.Users.Inputs.UserManagementGroupsArgs
    ///         {
    ///             Ids = normalInternet.Apply(getGroupManagementResult =&gt; getGroupManagementResult.Id),
    ///         },
    ///         Department = new Zia.Users.Inputs.UserManagementDepartmentArgs
    ///         {
    ///             Id = engineering.Apply(getDepartmentManagementResult =&gt; getDepartmentManagementResult.Id),
    ///         },
    ///     });
    /// 
    /// });
    /// ```
    /// ## Optional
    /// 
    /// The following attributes are supported:
    /// 
    /// * `comments` - (Optional) Additional information about this user.
    /// * `temp_auth_email` - (Optional) Temporary Authentication Email. If you enabled one-time tokens or links, enter the email address to which the Zscaler service sends the tokens or links. If this is empty, the service will send the email to the User email.
    /// </summary>
    [ZiaResourceType("zia:Users/userManagement:UserManagement")]
    public partial class UserManagement : global::Pulumi.CustomResource
    {
        /// <summary>
        /// Additional information about this user.
        /// </summary>
        [Output("comments")]
        public Output<string?> Comments { get; private set; } = null!;

        /// <summary>
        /// Department a user belongs to
        /// </summary>
        [Output("department")]
        public Output<Outputs.UserManagementDepartment?> Department { get; private set; } = null!;

        /// <summary>
        /// User email consists of a user name and domain name. It does not have to be a valid email address, but it must be unique and its domain must belong to the organization.
        /// </summary>
        [Output("email")]
        public Output<string> Email { get; private set; } = null!;

        /// <summary>
        /// List of Groups a user belongs to. Groups are used in policies.
        /// </summary>
        [Output("groups")]
        public Output<Outputs.UserManagementGroups> Groups { get; private set; } = null!;

        /// <summary>
        /// User name. This appears when choosing users for policies.
        /// </summary>
        [Output("name")]
        public Output<string> Name { get; private set; } = null!;

        /// <summary>
        /// User's password. Applicable only when authentication type is Hosted DB. Password strength must follow what is defined in the auth settings.
        /// </summary>
        [Output("password")]
        public Output<string> Password { get; private set; } = null!;

        /// <summary>
        /// Temporary Authentication Email. If you enabled one-time tokens or links, enter the email address to which the Zscaler
        /// service sends the tokens or links. If this is empty, the service will send the email to the User email.
        /// </summary>
        [Output("tempAuthEmail")]
        public Output<string?> TempAuthEmail { get; private set; } = null!;

        [Output("userId")]
        public Output<int> UserId { get; private set; } = null!;


        /// <summary>
        /// Create a UserManagement 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 UserManagement(string name, UserManagementArgs args, CustomResourceOptions? options = null)
            : base("zia:Users/userManagement:UserManagement", name, args ?? new UserManagementArgs(), MakeResourceOptions(options, ""))
        {
        }

        private UserManagement(string name, Input<string> id, UserManagementState? state = null, CustomResourceOptions? options = null)
            : base("zia:Users/userManagement:UserManagement", name, state, MakeResourceOptions(options, id))
        {
        }

        private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
        {
            var defaultOptions = new CustomResourceOptions
            {
                Version = Utilities.Version,
                PluginDownloadURL = "github://api.github.com/zscaler",
                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 UserManagement 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 UserManagement Get(string name, Input<string> id, UserManagementState? state = null, CustomResourceOptions? options = null)
        {
            return new UserManagement(name, id, state, options);
        }
    }

    public sealed class UserManagementArgs : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Additional information about this user.
        /// </summary>
        [Input("comments")]
        public Input<string>? Comments { get; set; }

        /// <summary>
        /// Department a user belongs to
        /// </summary>
        [Input("department")]
        public Input<Inputs.UserManagementDepartmentArgs>? Department { get; set; }

        /// <summary>
        /// User email consists of a user name and domain name. It does not have to be a valid email address, but it must be unique and its domain must belong to the organization.
        /// </summary>
        [Input("email", required: true)]
        public Input<string> Email { get; set; } = null!;

        /// <summary>
        /// List of Groups a user belongs to. Groups are used in policies.
        /// </summary>
        [Input("groups")]
        public Input<Inputs.UserManagementGroupsArgs>? Groups { get; set; }

        /// <summary>
        /// User name. This appears when choosing users for policies.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

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

        /// <summary>
        /// User's password. Applicable only when authentication type is Hosted DB. Password strength must follow what is defined in the auth settings.
        /// </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);
            }
        }

        /// <summary>
        /// Temporary Authentication Email. If you enabled one-time tokens or links, enter the email address to which the Zscaler
        /// service sends the tokens or links. If this is empty, the service will send the email to the User email.
        /// </summary>
        [Input("tempAuthEmail")]
        public Input<string>? TempAuthEmail { get; set; }

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

    public sealed class UserManagementState : global::Pulumi.ResourceArgs
    {
        /// <summary>
        /// Additional information about this user.
        /// </summary>
        [Input("comments")]
        public Input<string>? Comments { get; set; }

        /// <summary>
        /// Department a user belongs to
        /// </summary>
        [Input("department")]
        public Input<Inputs.UserManagementDepartmentGetArgs>? Department { get; set; }

        /// <summary>
        /// User email consists of a user name and domain name. It does not have to be a valid email address, but it must be unique and its domain must belong to the organization.
        /// </summary>
        [Input("email")]
        public Input<string>? Email { get; set; }

        /// <summary>
        /// List of Groups a user belongs to. Groups are used in policies.
        /// </summary>
        [Input("groups")]
        public Input<Inputs.UserManagementGroupsGetArgs>? Groups { get; set; }

        /// <summary>
        /// User name. This appears when choosing users for policies.
        /// </summary>
        [Input("name")]
        public Input<string>? Name { get; set; }

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

        /// <summary>
        /// User's password. Applicable only when authentication type is Hosted DB. Password strength must follow what is defined in the auth settings.
        /// </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);
            }
        }

        /// <summary>
        /// Temporary Authentication Email. If you enabled one-time tokens or links, enter the email address to which the Zscaler
        /// service sends the tokens or links. If this is empty, the service will send the email to the User email.
        /// </summary>
        [Input("tempAuthEmail")]
        public Input<string>? TempAuthEmail { get; set; }

        [Input("userId")]
        public Input<int>? UserId { get; set; }

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