<filename>sdk/dotnet/Ecs/GetKeyPairs.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.Ecs
{
    public static class GetKeyPairs
    {
        /// <summary>
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     // Declare the data source
        ///     var defaultKeyPair = new AliCloud.Ecs.KeyPair("defaultKeyPair", new()
        ///     {
        ///         KeyName = "keyPairDatasource",
        ///     });
        /// 
        ///     var defaultKeyPairs = AliCloud.Ecs.GetKeyPairs.Invoke(new()
        ///     {
        ///         NameRegex = defaultKeyPair.KeyName,
        ///     });
        /// 
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetKeyPairsResult> InvokeAsync(GetKeyPairsArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetKeyPairsResult>("alicloud:ecs/getKeyPairs:getKeyPairs", args ?? new GetKeyPairsArgs(), options.WithDefaults());

        /// <summary>
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     // Declare the data source
        ///     var defaultKeyPair = new AliCloud.Ecs.KeyPair("defaultKeyPair", new()
        ///     {
        ///         KeyName = "keyPairDatasource",
        ///     });
        /// 
        ///     var defaultKeyPairs = AliCloud.Ecs.GetKeyPairs.Invoke(new()
        ///     {
        ///         NameRegex = defaultKeyPair.KeyName,
        ///     });
        /// 
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetKeyPairsResult> Invoke(GetKeyPairsInvokeArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetKeyPairsResult>("alicloud:ecs/getKeyPairs:getKeyPairs", args ?? new GetKeyPairsInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetKeyPairsArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// A finger print used to retrieve specified key pair.
        /// </summary>
        [Input("fingerPrint")]
        public string? FingerPrint { get; set; }

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

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

        /// <summary>
        /// A regex string to apply to the resulting key pairs.
        /// </summary>
        [Input("nameRegex")]
        public string? NameRegex { get; set; }

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

        /// <summary>
        /// The Id of resource group which the key pair belongs.
        /// </summary>
        [Input("resourceGroupId")]
        public string? ResourceGroupId { get; set; }

        [Input("tags")]
        private Dictionary<string, object>? _tags;

        /// <summary>
        /// A mapping of tags to assign to the resource.
        /// </summary>
        public Dictionary<string, object> Tags
        {
            get => _tags ?? (_tags = new Dictionary<string, object>());
            set => _tags = value;
        }

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

    public sealed class GetKeyPairsInvokeArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// A finger print used to retrieve specified key pair.
        /// </summary>
        [Input("fingerPrint")]
        public Input<string>? FingerPrint { get; set; }

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

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

        /// <summary>
        /// A regex string to apply to the resulting key pairs.
        /// </summary>
        [Input("nameRegex")]
        public Input<string>? NameRegex { get; set; }

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

        /// <summary>
        /// The Id of resource group which the key pair belongs.
        /// </summary>
        [Input("resourceGroupId")]
        public Input<string>? ResourceGroupId { get; set; }

        [Input("tags")]
        private InputMap<object>? _tags;

        /// <summary>
        /// A mapping of tags to assign to the resource.
        /// </summary>
        public InputMap<object> Tags
        {
            get => _tags ?? (_tags = new InputMap<object>());
            set => _tags = value;
        }

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


    [OutputType]
    public sealed class GetKeyPairsResult
    {
        /// <summary>
        /// Finger print of the key pair.
        /// </summary>
        public readonly string? FingerPrint;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        public readonly ImmutableArray<string> Ids;
        /// <summary>
        /// A list of key pairs. Each element contains the following attributes:
        /// </summary>
        public readonly ImmutableArray<Outputs.GetKeyPairsKeyPairResult> KeyPairs;
        public readonly string? NameRegex;
        /// <summary>
        /// A list of key pair names.
        /// </summary>
        public readonly ImmutableArray<string> Names;
        public readonly string? OutputFile;
        public readonly ImmutableArray<Outputs.GetKeyPairsPairResult> Pairs;
        /// <summary>
        /// The Id of resource group.
        /// </summary>
        public readonly string? ResourceGroupId;
        /// <summary>
        /// (Optional, Available in v1.66.0+) A mapping of tags to assign to the resource.
        /// </summary>
        public readonly ImmutableDictionary<string, object>? Tags;

        [OutputConstructor]
        private GetKeyPairsResult(
            string? fingerPrint,

            string id,

            ImmutableArray<string> ids,

            ImmutableArray<Outputs.GetKeyPairsKeyPairResult> keyPairs,

            string? nameRegex,

            ImmutableArray<string> names,

            string? outputFile,

            ImmutableArray<Outputs.GetKeyPairsPairResult> pairs,

            string? resourceGroupId,

            ImmutableDictionary<string, object>? tags)
        {
            FingerPrint = fingerPrint;
            Id = id;
            Ids = ids;
            KeyPairs = keyPairs;
            NameRegex = nameRegex;
            Names = names;
            OutputFile = outputFile;
            Pairs = pairs;
            ResourceGroupId = resourceGroupId;
            Tags = tags;
        }
    }
}
