<reponame>rhysmdnz/pulumi-alicloud-rhys-hacks<filename>sdk/dotnet/Eds/GetDesktops.cs// *** 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.Eds
{
    public static class GetDesktops
    {
        /// <summary>
        /// This data source provides the Ecd Desktops of the current Alibaba Cloud user.
        /// 
        /// &gt; **NOTE:** Available in v1.144.0+.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// Basic Usage
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var defaultSimpleOfficeSite = new AliCloud.Eds.SimpleOfficeSite("defaultSimpleOfficeSite", new()
        ///     {
        ///         CidrBlock = "172.16.0.0/12",
        ///         DesktopAccessType = "Internet",
        ///         OfficeSiteName = "your_office_site_name",
        ///     });
        /// 
        ///     var defaultBundles = AliCloud.Eds.GetBundles.Invoke(new()
        ///     {
        ///         BundleType = "SYSTEM",
        ///     });
        /// 
        ///     var defaultEcdPolicyGroup = new AliCloud.Eds.EcdPolicyGroup("defaultEcdPolicyGroup", new()
        ///     {
        ///         PolicyGroupName = "your_policy_group_name",
        ///         Clipboard = "readwrite",
        ///         LocalDrive = "read",
        ///         AuthorizeAccessPolicyRules = new[]
        ///         {
        ///             new AliCloud.Eds.Inputs.EcdPolicyGroupAuthorizeAccessPolicyRuleArgs
        ///             {
        ///                 Description = "example_value",
        ///                 CidrIp = "1.2.3.4/24",
        ///             },
        ///         },
        ///         AuthorizeSecurityPolicyRules = new[]
        ///         {
        ///             new AliCloud.Eds.Inputs.EcdPolicyGroupAuthorizeSecurityPolicyRuleArgs
        ///             {
        ///                 Type = "inflow",
        ///                 Policy = "accept",
        ///                 Description = "example_value",
        ///                 PortRange = "80/80",
        ///                 IpProtocol = "TCP",
        ///                 Priority = "1",
        ///                 CidrIp = "0.0.0.0/0",
        ///             },
        ///         },
        ///     });
        /// 
        ///     var defaultUser = new AliCloud.Eds.User("defaultUser", new()
        ///     {
        ///         EndUserId = "your_end_user_id",
        ///         Email = "your_email",
        ///         Phone = "your_phone",
        ///         Password = "your_password",
        ///     });
        /// 
        ///     var defaultDesktop = new AliCloud.Eds.Desktop("defaultDesktop", new()
        ///     {
        ///         OfficeSiteId = defaultSimpleOfficeSite.Id,
        ///         PolicyGroupId = defaultEcdPolicyGroup.Id,
        ///         BundleId = defaultBundles.Apply(getBundlesResult =&gt; getBundlesResult.Bundles[0]?.Id),
        ///         DesktopName = "your_desktop_name",
        ///         EndUserIds = new[]
        ///         {
        ///             defaultUser.Id,
        ///         },
        ///     });
        /// 
        ///     var ids = AliCloud.Eds.GetDesktops.Invoke(new()
        ///     {
        ///         Ids = new[]
        ///         {
        ///             defaultDesktop.Id,
        ///         },
        ///     });
        /// 
        ///     var nameRegex = AliCloud.Eds.GetDesktops.Invoke(new()
        ///     {
        ///         NameRegex = defaultDesktop.DesktopName,
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["ecdDesktopId1"] = ids.Apply(getDesktopsResult =&gt; getDesktopsResult.Desktops[0]?.Id),
        ///         ["ecdDesktopId2"] = nameRegex.Apply(getDesktopsResult =&gt; getDesktopsResult.Desktops[0]?.Id),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetDesktopsResult> InvokeAsync(GetDesktopsArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetDesktopsResult>("alicloud:eds/getDesktops:getDesktops", args ?? new GetDesktopsArgs(), options.WithDefaults());

        /// <summary>
        /// This data source provides the Ecd Desktops of the current Alibaba Cloud user.
        /// 
        /// &gt; **NOTE:** Available in v1.144.0+.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// Basic Usage
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var defaultSimpleOfficeSite = new AliCloud.Eds.SimpleOfficeSite("defaultSimpleOfficeSite", new()
        ///     {
        ///         CidrBlock = "172.16.0.0/12",
        ///         DesktopAccessType = "Internet",
        ///         OfficeSiteName = "your_office_site_name",
        ///     });
        /// 
        ///     var defaultBundles = AliCloud.Eds.GetBundles.Invoke(new()
        ///     {
        ///         BundleType = "SYSTEM",
        ///     });
        /// 
        ///     var defaultEcdPolicyGroup = new AliCloud.Eds.EcdPolicyGroup("defaultEcdPolicyGroup", new()
        ///     {
        ///         PolicyGroupName = "your_policy_group_name",
        ///         Clipboard = "readwrite",
        ///         LocalDrive = "read",
        ///         AuthorizeAccessPolicyRules = new[]
        ///         {
        ///             new AliCloud.Eds.Inputs.EcdPolicyGroupAuthorizeAccessPolicyRuleArgs
        ///             {
        ///                 Description = "example_value",
        ///                 CidrIp = "1.2.3.4/24",
        ///             },
        ///         },
        ///         AuthorizeSecurityPolicyRules = new[]
        ///         {
        ///             new AliCloud.Eds.Inputs.EcdPolicyGroupAuthorizeSecurityPolicyRuleArgs
        ///             {
        ///                 Type = "inflow",
        ///                 Policy = "accept",
        ///                 Description = "example_value",
        ///                 PortRange = "80/80",
        ///                 IpProtocol = "TCP",
        ///                 Priority = "1",
        ///                 CidrIp = "0.0.0.0/0",
        ///             },
        ///         },
        ///     });
        /// 
        ///     var defaultUser = new AliCloud.Eds.User("defaultUser", new()
        ///     {
        ///         EndUserId = "your_end_user_id",
        ///         Email = "your_email",
        ///         Phone = "your_phone",
        ///         Password = "your_password",
        ///     });
        /// 
        ///     var defaultDesktop = new AliCloud.Eds.Desktop("defaultDesktop", new()
        ///     {
        ///         OfficeSiteId = defaultSimpleOfficeSite.Id,
        ///         PolicyGroupId = defaultEcdPolicyGroup.Id,
        ///         BundleId = defaultBundles.Apply(getBundlesResult =&gt; getBundlesResult.Bundles[0]?.Id),
        ///         DesktopName = "your_desktop_name",
        ///         EndUserIds = new[]
        ///         {
        ///             defaultUser.Id,
        ///         },
        ///     });
        /// 
        ///     var ids = AliCloud.Eds.GetDesktops.Invoke(new()
        ///     {
        ///         Ids = new[]
        ///         {
        ///             defaultDesktop.Id,
        ///         },
        ///     });
        /// 
        ///     var nameRegex = AliCloud.Eds.GetDesktops.Invoke(new()
        ///     {
        ///         NameRegex = defaultDesktop.DesktopName,
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["ecdDesktopId1"] = ids.Apply(getDesktopsResult =&gt; getDesktopsResult.Desktops[0]?.Id),
        ///         ["ecdDesktopId2"] = nameRegex.Apply(getDesktopsResult =&gt; getDesktopsResult.Desktops[0]?.Id),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetDesktopsResult> Invoke(GetDesktopsInvokeArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetDesktopsResult>("alicloud:eds/getDesktops:getDesktops", args ?? new GetDesktopsInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetDesktopsArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// The desktop name of the Desktop.
        /// </summary>
        [Input("desktopName")]
        public string? DesktopName { get; set; }

        [Input("endUserIds")]
        private List<string>? _endUserIds;

        /// <summary>
        /// The desktop end user id of the Desktop.
        /// </summary>
        public List<string> EndUserIds
        {
            get => _endUserIds ?? (_endUserIds = new List<string>());
            set => _endUserIds = value;
        }

        [Input("ids")]
        private List<string>? _ids;

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

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

        /// <summary>
        /// The ID of the Simple Office Site.
        /// </summary>
        [Input("officeSiteId")]
        public string? OfficeSiteId { get; set; }

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

        /// <summary>
        /// The policy group id of the Desktop.
        /// </summary>
        [Input("policyGroupId")]
        public string? PolicyGroupId { get; set; }

        /// <summary>
        /// The status of the Desktop. Valid values: `Deleted`, `Expired`, `Pending`, `Running`, `Starting`, `Stopped`, `Stopping`.
        /// </summary>
        [Input("status")]
        public string? Status { get; set; }

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

    public sealed class GetDesktopsInvokeArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// The desktop name of the Desktop.
        /// </summary>
        [Input("desktopName")]
        public Input<string>? DesktopName { get; set; }

        [Input("endUserIds")]
        private InputList<string>? _endUserIds;

        /// <summary>
        /// The desktop end user id of the Desktop.
        /// </summary>
        public InputList<string> EndUserIds
        {
            get => _endUserIds ?? (_endUserIds = new InputList<string>());
            set => _endUserIds = value;
        }

        [Input("ids")]
        private InputList<string>? _ids;

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

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

        /// <summary>
        /// The ID of the Simple Office Site.
        /// </summary>
        [Input("officeSiteId")]
        public Input<string>? OfficeSiteId { get; set; }

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

        /// <summary>
        /// The policy group id of the Desktop.
        /// </summary>
        [Input("policyGroupId")]
        public Input<string>? PolicyGroupId { get; set; }

        /// <summary>
        /// The status of the Desktop. Valid values: `Deleted`, `Expired`, `Pending`, `Running`, `Starting`, `Stopped`, `Stopping`.
        /// </summary>
        [Input("status")]
        public Input<string>? Status { get; set; }

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


    [OutputType]
    public sealed class GetDesktopsResult
    {
        public readonly string? DesktopName;
        public readonly ImmutableArray<Outputs.GetDesktopsDesktopResult> Desktops;
        public readonly ImmutableArray<string> EndUserIds;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        public readonly ImmutableArray<string> Ids;
        public readonly string? NameRegex;
        public readonly ImmutableArray<string> Names;
        public readonly string? OfficeSiteId;
        public readonly string? OutputFile;
        public readonly string? PolicyGroupId;
        public readonly string? Status;

        [OutputConstructor]
        private GetDesktopsResult(
            string? desktopName,

            ImmutableArray<Outputs.GetDesktopsDesktopResult> desktops,

            ImmutableArray<string> endUserIds,

            string id,

            ImmutableArray<string> ids,

            string? nameRegex,

            ImmutableArray<string> names,

            string? officeSiteId,

            string? outputFile,

            string? policyGroupId,

            string? status)
        {
            DesktopName = desktopName;
            Desktops = desktops;
            EndUserIds = endUserIds;
            Id = id;
            Ids = ids;
            NameRegex = nameRegex;
            Names = names;
            OfficeSiteId = officeSiteId;
            OutputFile = outputFile;
            PolicyGroupId = policyGroupId;
            Status = status;
        }
    }
}
