// *** 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.AliCloud.BastionHost
{
    /// <summary>
    /// Provides a Bastion Host Host Account Attachment resource to add list host accounts into one user and one host group.
    /// 
    /// &gt; **NOTE:** Available in v1.135.0+.
    /// 
    /// ## Example Usage
    /// 
    /// Basic Usage
    /// 
    /// ```csharp
    /// using System.Collections.Generic;
    /// using System.Linq;
    /// using Pulumi;
    /// using AliCloud = Pulumi.AliCloud;
    /// 
    /// return await Deployment.RunAsync(() =&gt; 
    /// {
    ///     var defaultHost = new AliCloud.BastionHost.Host("defaultHost", new()
    ///     {
    ///         InstanceId = "bastionhost-cn-tl3xxxxxxx",
    ///         HostName = @var.Name,
    ///         ActiveAddressType = "Private",
    ///         HostPrivateAddress = "172.16.0.10",
    ///         OsType = "Linux",
    ///         Source = "Local",
    ///     });
    /// 
    ///     var defaultHostAccount = new List&lt;AliCloud.BastionHost.HostAccount&gt;();
    ///     for (var rangeIndex = 0; rangeIndex &lt; 3; rangeIndex++)
    ///     {
    ///         var range = new { Value = rangeIndex };
    ///         defaultHostAccount.Add(new AliCloud.BastionHost.HostAccount($"defaultHostAccount-{range.Value}", new()
    ///         {
    ///             InstanceId = defaultHost.InstanceId,
    ///             HostAccountName = $"example_value-{range.Value}",
    ///             HostId = defaultHost.HostId,
    ///             ProtocolName = "SSH",
    ///             Password = "YourPassword12345",
    ///         }));
    ///     }
    ///     var defaultUser = new AliCloud.BastionHost.User("defaultUser", new()
    ///     {
    ///         InstanceId = defaultHost.InstanceId,
    ///         MobileCountryCode = "CN",
    ///         Mobile = "13312345678",
    ///         Password = "YourPassword-123",
    ///         Source = "Local",
    ///         UserName = "my-local-user",
    ///     });
    /// 
    ///     var defaultHostGroup = new AliCloud.BastionHost.HostGroup("defaultHostGroup", new()
    ///     {
    ///         HostGroupName = "example_value",
    ///         InstanceId = "bastionhost-cn-tl3xxxxxxx",
    ///     });
    /// 
    ///     var defaultHostGroupAccountUserAttachment = new AliCloud.BastionHost.HostGroupAccountUserAttachment("defaultHostGroupAccountUserAttachment", new()
    ///     {
    ///         InstanceId = defaultHost.InstanceId,
    ///         UserId = defaultUser.UserId,
    ///         HostGroupId = defaultHostGroup.HostGroupId,
    ///         HostAccountNames = defaultHostAccount.Select(__item =&gt; __item.HostAccountName).ToList(),
    ///     });
    /// 
    /// });
    /// ```
    /// 
    /// ## Import
    /// 
    /// Bastion Host Host Account can be imported using the id, e.g.
    /// 
    /// ```sh
    ///  $ pulumi import alicloud:bastionhost/hostGroupAccountUserAttachment:HostGroupAccountUserAttachment example &lt;instance_id&gt;:&lt;user_id&gt;:&lt;host_group_id&gt;
    /// ```
    /// </summary>
    [AliCloudResourceType("alicloud:bastionhost/hostGroupAccountUserAttachment:HostGroupAccountUserAttachment")]
    public partial class HostGroupAccountUserAttachment : global::Pulumi.CustomResource
    {
        /// <summary>
        /// A list names of the host account.
        /// </summary>
        [Output("hostAccountNames")]
        public Output<ImmutableArray<string>> HostAccountNames { get; private set; } = null!;

        /// <summary>
        /// The ID of the host group.
        /// </summary>
        [Output("hostGroupId")]
        public Output<string> HostGroupId { get; private set; } = null!;

        /// <summary>
        /// The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.
        /// </summary>
        [Output("instanceId")]
        public Output<string> InstanceId { get; private set; } = null!;

        /// <summary>
        /// The ID of the user that you want to authorize to manage the specified hosts and host accounts.
        /// </summary>
        [Output("userId")]
        public Output<string> UserId { get; private set; } = null!;


        /// <summary>
        /// Create a HostGroupAccountUserAttachment 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 HostGroupAccountUserAttachment(string name, HostGroupAccountUserAttachmentArgs args, CustomResourceOptions? options = null)
            : base("alicloud:bastionhost/hostGroupAccountUserAttachment:HostGroupAccountUserAttachment", name, args ?? new HostGroupAccountUserAttachmentArgs(), MakeResourceOptions(options, ""))
        {
        }

        private HostGroupAccountUserAttachment(string name, Input<string> id, HostGroupAccountUserAttachmentState? state = null, CustomResourceOptions? options = null)
            : base("alicloud:bastionhost/hostGroupAccountUserAttachment:HostGroupAccountUserAttachment", 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/rhysmdnz/pulumi-alicloud",
            };
            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 HostGroupAccountUserAttachment 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 HostGroupAccountUserAttachment Get(string name, Input<string> id, HostGroupAccountUserAttachmentState? state = null, CustomResourceOptions? options = null)
        {
            return new HostGroupAccountUserAttachment(name, id, state, options);
        }
    }

    public sealed class HostGroupAccountUserAttachmentArgs : global::Pulumi.ResourceArgs
    {
        [Input("hostAccountNames", required: true)]
        private InputList<string>? _hostAccountNames;

        /// <summary>
        /// A list names of the host account.
        /// </summary>
        public InputList<string> HostAccountNames
        {
            get => _hostAccountNames ?? (_hostAccountNames = new InputList<string>());
            set => _hostAccountNames = value;
        }

        /// <summary>
        /// The ID of the host group.
        /// </summary>
        [Input("hostGroupId", required: true)]
        public Input<string> HostGroupId { get; set; } = null!;

        /// <summary>
        /// The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.
        /// </summary>
        [Input("instanceId", required: true)]
        public Input<string> InstanceId { get; set; } = null!;

        /// <summary>
        /// The ID of the user that you want to authorize to manage the specified hosts and host accounts.
        /// </summary>
        [Input("userId", required: true)]
        public Input<string> UserId { get; set; } = null!;

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

    public sealed class HostGroupAccountUserAttachmentState : global::Pulumi.ResourceArgs
    {
        [Input("hostAccountNames")]
        private InputList<string>? _hostAccountNames;

        /// <summary>
        /// A list names of the host account.
        /// </summary>
        public InputList<string> HostAccountNames
        {
            get => _hostAccountNames ?? (_hostAccountNames = new InputList<string>());
            set => _hostAccountNames = value;
        }

        /// <summary>
        /// The ID of the host group.
        /// </summary>
        [Input("hostGroupId")]
        public Input<string>? HostGroupId { get; set; }

        /// <summary>
        /// The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.
        /// </summary>
        [Input("instanceId")]
        public Input<string>? InstanceId { get; set; }

        /// <summary>
        /// The ID of the user that you want to authorize to manage the specified hosts and host accounts.
        /// </summary>
        [Input("userId")]
        public Input<string>? UserId { get; set; }

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