<reponame>rhysmdnz/pulumi-alicloud-rhys-hacks// *** 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
{
    public static class GetUserGroups
    {
        /// <summary>
        /// This data source provides the Bastionhost User Groups of the current Alibaba Cloud user.
        /// 
        /// &gt; **NOTE:** Available in v1.132.0+.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// Basic Usage
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var ids = AliCloud.BastionHost.GetUserGroups.Invoke(new()
        ///     {
        ///         InstanceId = "bastionhost-cn-xxxx",
        ///         Ids = new[]
        ///         {
        ///             "1",
        ///             "2",
        ///         },
        ///     });
        /// 
        ///     var nameRegex = AliCloud.BastionHost.GetUserGroups.Invoke(new()
        ///     {
        ///         InstanceId = "bastionhost-cn-xxxx",
        ///         NameRegex = "^my-UserGroup",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["bastionhostUserGroupId1"] = ids.Apply(getUserGroupsResult =&gt; getUserGroupsResult.Groups[0]?.Id),
        ///         ["bastionhostUserGroupId2"] = nameRegex.Apply(getUserGroupsResult =&gt; getUserGroupsResult.Groups[0]?.Id),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetUserGroupsResult> InvokeAsync(GetUserGroupsArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetUserGroupsResult>("alicloud:bastionhost/getUserGroups:getUserGroups", args ?? new GetUserGroupsArgs(), options.WithDefaults());

        /// <summary>
        /// This data source provides the Bastionhost User Groups of the current Alibaba Cloud user.
        /// 
        /// &gt; **NOTE:** Available in v1.132.0+.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// Basic Usage
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var ids = AliCloud.BastionHost.GetUserGroups.Invoke(new()
        ///     {
        ///         InstanceId = "bastionhost-cn-xxxx",
        ///         Ids = new[]
        ///         {
        ///             "1",
        ///             "2",
        ///         },
        ///     });
        /// 
        ///     var nameRegex = AliCloud.BastionHost.GetUserGroups.Invoke(new()
        ///     {
        ///         InstanceId = "bastionhost-cn-xxxx",
        ///         NameRegex = "^my-UserGroup",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["bastionhostUserGroupId1"] = ids.Apply(getUserGroupsResult =&gt; getUserGroupsResult.Groups[0]?.Id),
        ///         ["bastionhostUserGroupId2"] = nameRegex.Apply(getUserGroupsResult =&gt; getUserGroupsResult.Groups[0]?.Id),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetUserGroupsResult> Invoke(GetUserGroupsInvokeArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetUserGroupsResult>("alicloud:bastionhost/getUserGroups:getUserGroups", args ?? new GetUserGroupsInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetUserGroupsArgs : global::Pulumi.InvokeArgs
    {
        [Input("ids")]
        private List<string>? _ids;

        /// <summary>
        /// A list of User Group self IDs.
        /// </summary>
        public List<string> Ids
        {
            get => _ids ?? (_ids = new List<string>());
            set => _ids = value;
        }

        /// <summary>
        /// Specify the New Group of the Bastion Host of Instance Id.
        /// </summary>
        [Input("instanceId", required: true)]
        public string InstanceId { get; set; } = null!;

        /// <summary>
        /// A regex string to filter results by User Group name.
        /// </summary>
        [Input("nameRegex")]
        public string? NameRegex { get; set; }

        [Input("outputFile")]
        public string? OutputFile { get; set; }

        /// <summary>
        /// Specify the New Group Name. Supports up to 128 Characters.
        /// </summary>
        [Input("userGroupName")]
        public string? UserGroupName { get; set; }

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

    public sealed class GetUserGroupsInvokeArgs : global::Pulumi.InvokeArgs
    {
        [Input("ids")]
        private InputList<string>? _ids;

        /// <summary>
        /// A list of User Group self IDs.
        /// </summary>
        public InputList<string> Ids
        {
            get => _ids ?? (_ids = new InputList<string>());
            set => _ids = value;
        }

        /// <summary>
        /// Specify the New Group of the Bastion Host of Instance Id.
        /// </summary>
        [Input("instanceId", required: true)]
        public Input<string> InstanceId { get; set; } = null!;

        /// <summary>
        /// A regex string to filter results by User Group name.
        /// </summary>
        [Input("nameRegex")]
        public Input<string>? NameRegex { get; set; }

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

        /// <summary>
        /// Specify the New Group Name. Supports up to 128 Characters.
        /// </summary>
        [Input("userGroupName")]
        public Input<string>? UserGroupName { get; set; }

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


    [OutputType]
    public sealed class GetUserGroupsResult
    {
        public readonly ImmutableArray<Outputs.GetUserGroupsGroupResult> Groups;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        public readonly ImmutableArray<string> Ids;
        public readonly string InstanceId;
        public readonly string? NameRegex;
        public readonly ImmutableArray<string> Names;
        public readonly string? OutputFile;
        public readonly string? UserGroupName;

        [OutputConstructor]
        private GetUserGroupsResult(
            ImmutableArray<Outputs.GetUserGroupsGroupResult> groups,

            string id,

            ImmutableArray<string> ids,

            string instanceId,

            string? nameRegex,

            ImmutableArray<string> names,

            string? outputFile,

            string? userGroupName)
        {
            Groups = groups;
            Id = id;
            Ids = ids;
            InstanceId = instanceId;
            NameRegex = nameRegex;
            Names = names;
            OutputFile = outputFile;
            UserGroupName = userGroupName;
        }
    }
}
