// *** 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.KVStore
{
    public static class GetInstances
    {
        /// <summary>
        /// The `alicloud.kvstore.getInstances` data source provides a collection of kvstore instances available in Alicloud account.
        /// Filters support regular expression for the instance name, searches by tags, and other filters which are listed below.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var @default = AliCloud.KVStore.GetInstances.Invoke(new()
        ///     {
        ///         NameRegex = "testname",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstInstanceName"] = @default.Apply(getInstancesResult =&gt; getInstancesResult).Apply(@default =&gt; @default.Apply(getInstancesResult =&gt; getInstancesResult.Instances[0]?.Name)),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetInstancesResult> InvokeAsync(GetInstancesArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetInstancesResult>("alicloud:kvstore/getInstances:getInstances", args ?? new GetInstancesArgs(), options.WithDefaults());

        /// <summary>
        /// The `alicloud.kvstore.getInstances` data source provides a collection of kvstore instances available in Alicloud account.
        /// Filters support regular expression for the instance name, searches by tags, and other filters which are listed below.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var @default = AliCloud.KVStore.GetInstances.Invoke(new()
        ///     {
        ///         NameRegex = "testname",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstInstanceName"] = @default.Apply(getInstancesResult =&gt; getInstancesResult).Apply(@default =&gt; @default.Apply(getInstancesResult =&gt; getInstancesResult.Instances[0]?.Name)),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetInstancesResult> Invoke(GetInstancesInvokeArgs? args = null, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetInstancesResult>("alicloud:kvstore/getInstances:getInstances", args ?? new GetInstancesInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetInstancesArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// The type of the architecture. Valid values: `cluster`, `standard` and `SplitRW`.
        /// </summary>
        [Input("architectureType")]
        public string? ArchitectureType { get; set; }

        /// <summary>
        /// Used to retrieve instances belong to specified `vswitch` resources.  Valid values: `Enterprise`, `Community`.
        /// </summary>
        [Input("editionType")]
        public string? EditionType { get; set; }

        /// <summary>
        /// Default to `false`. Set it to true can output more details.
        /// </summary>
        [Input("enableDetails")]
        public bool? EnableDetails { get; set; }

        /// <summary>
        /// The engine version. Valid values: `2.8`, `4.0`, `5.0`, `6.0`, `7.0`.
        /// </summary>
        [Input("engineVersion")]
        public string? EngineVersion { get; set; }

        /// <summary>
        /// The expiration status of the instance.
        /// </summary>
        [Input("expired")]
        public string? Expired { get; set; }

        /// <summary>
        /// Whether to create a distributed cache.
        /// </summary>
        [Input("globalInstance")]
        public bool? GlobalInstance { get; set; }

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

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

        /// <summary>
        /// Type of the applied ApsaraDB for Redis instance. For more information, see [Instance type table](https://www.alibabacloud.com/help/doc-detail/61135.htm).
        /// </summary>
        [Input("instanceClass")]
        public string? InstanceClass { get; set; }

        /// <summary>
        /// The engine type of the KVStore DBInstance. Options are `Memcache`, and `Redis`. If no value is specified, all types are returned.
        /// </summary>
        [Input("instanceType")]
        public string? InstanceType { get; set; }

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

        /// <summary>
        /// The type of the network. Valid values: `CLASSIC`, `VPC`.
        /// </summary>
        [Input("networkType")]
        public string? NetworkType { get; set; }

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

        /// <summary>
        /// The payment type. Valid values: `PostPaid`, `PrePaid`.
        /// </summary>
        [Input("paymentType")]
        public string? PaymentType { get; set; }

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

        /// <summary>
        /// The name of the instance.
        /// </summary>
        [Input("searchKey")]
        public string? SearchKey { get; set; }

        /// <summary>
        /// The status of the KVStore DBInstance. Valid values: `Changing`, `CleaningUpExpiredData`, `Creating`, `Flushing`, `HASwitching`, `Inactive`, `MajorVersionUpgrading`, `Migrating`, `NetworkModifying`, `Normal`, `Rebooting`, `SSLModifying`, `Transforming`, `ZoneMigrating`.
        /// </summary>
        [Input("status")]
        public string? Status { get; set; }

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

        /// <summary>
        /// Query the instance bound to the tag. The format of the incoming value is `json` string, including `TagKey` and `TagValue`. `TagKey` cannot be null, and `TagValue` can be empty. Format example `{"key1":"value1"}`.
        /// </summary>
        public Dictionary<string, object> Tags
        {
            get => _tags ?? (_tags = new Dictionary<string, object>());
            set => _tags = value;
        }

        /// <summary>
        /// Used to retrieve instances belong to specified VPC.
        /// </summary>
        [Input("vpcId")]
        public string? VpcId { get; set; }

        /// <summary>
        /// Used to retrieve instances belong to specified `vswitch` resources.
        /// </summary>
        [Input("vswitchId")]
        public string? VswitchId { get; set; }

        /// <summary>
        /// The ID of the zone.
        /// </summary>
        [Input("zoneId")]
        public string? ZoneId { get; set; }

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

    public sealed class GetInstancesInvokeArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// The type of the architecture. Valid values: `cluster`, `standard` and `SplitRW`.
        /// </summary>
        [Input("architectureType")]
        public Input<string>? ArchitectureType { get; set; }

        /// <summary>
        /// Used to retrieve instances belong to specified `vswitch` resources.  Valid values: `Enterprise`, `Community`.
        /// </summary>
        [Input("editionType")]
        public Input<string>? EditionType { get; set; }

        /// <summary>
        /// Default to `false`. Set it to true can output more details.
        /// </summary>
        [Input("enableDetails")]
        public Input<bool>? EnableDetails { get; set; }

        /// <summary>
        /// The engine version. Valid values: `2.8`, `4.0`, `5.0`, `6.0`, `7.0`.
        /// </summary>
        [Input("engineVersion")]
        public Input<string>? EngineVersion { get; set; }

        /// <summary>
        /// The expiration status of the instance.
        /// </summary>
        [Input("expired")]
        public Input<string>? Expired { get; set; }

        /// <summary>
        /// Whether to create a distributed cache.
        /// </summary>
        [Input("globalInstance")]
        public Input<bool>? GlobalInstance { get; set; }

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

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

        /// <summary>
        /// Type of the applied ApsaraDB for Redis instance. For more information, see [Instance type table](https://www.alibabacloud.com/help/doc-detail/61135.htm).
        /// </summary>
        [Input("instanceClass")]
        public Input<string>? InstanceClass { get; set; }

        /// <summary>
        /// The engine type of the KVStore DBInstance. Options are `Memcache`, and `Redis`. If no value is specified, all types are returned.
        /// </summary>
        [Input("instanceType")]
        public Input<string>? InstanceType { get; set; }

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

        /// <summary>
        /// The type of the network. Valid values: `CLASSIC`, `VPC`.
        /// </summary>
        [Input("networkType")]
        public Input<string>? NetworkType { get; set; }

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

        /// <summary>
        /// The payment type. Valid values: `PostPaid`, `PrePaid`.
        /// </summary>
        [Input("paymentType")]
        public Input<string>? PaymentType { get; set; }

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

        /// <summary>
        /// The name of the instance.
        /// </summary>
        [Input("searchKey")]
        public Input<string>? SearchKey { get; set; }

        /// <summary>
        /// The status of the KVStore DBInstance. Valid values: `Changing`, `CleaningUpExpiredData`, `Creating`, `Flushing`, `HASwitching`, `Inactive`, `MajorVersionUpgrading`, `Migrating`, `NetworkModifying`, `Normal`, `Rebooting`, `SSLModifying`, `Transforming`, `ZoneMigrating`.
        /// </summary>
        [Input("status")]
        public Input<string>? Status { get; set; }

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

        /// <summary>
        /// Query the instance bound to the tag. The format of the incoming value is `json` string, including `TagKey` and `TagValue`. `TagKey` cannot be null, and `TagValue` can be empty. Format example `{"key1":"value1"}`.
        /// </summary>
        public InputMap<object> Tags
        {
            get => _tags ?? (_tags = new InputMap<object>());
            set => _tags = value;
        }

        /// <summary>
        /// Used to retrieve instances belong to specified VPC.
        /// </summary>
        [Input("vpcId")]
        public Input<string>? VpcId { get; set; }

        /// <summary>
        /// Used to retrieve instances belong to specified `vswitch` resources.
        /// </summary>
        [Input("vswitchId")]
        public Input<string>? VswitchId { get; set; }

        /// <summary>
        /// The ID of the zone.
        /// </summary>
        [Input("zoneId")]
        public Input<string>? ZoneId { get; set; }

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


    [OutputType]
    public sealed class GetInstancesResult
    {
        public readonly string? ArchitectureType;
        public readonly string? EditionType;
        public readonly bool? EnableDetails;
        /// <summary>
        /// The engine version of the instance.
        /// </summary>
        public readonly string? EngineVersion;
        public readonly string? Expired;
        public readonly bool? GlobalInstance;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        /// <summary>
        /// A list of KVStore Instance IDs.
        /// </summary>
        public readonly ImmutableArray<string> Ids;
        public readonly string? InstanceClass;
        /// <summary>
        /// (Optional) Database type. Valid Values: `Memcache`, `Redis`. If no value is specified, all types are returned.
        /// * `instance_class`- (Optional) Type of the applied ApsaraDB for instance.
        /// For more information, see [Instance type table](https://www.alibabacloud.com/help/doc-detail/61135.htm).
        /// </summary>
        public readonly string? InstanceType;
        /// <summary>
        /// A list of KVStore Instances. Its every element contains the following attributes:
        /// </summary>
        public readonly ImmutableArray<Outputs.GetInstancesInstanceResult> Instances;
        public readonly string? NameRegex;
        /// <summary>
        /// A list of KVStore Instance names.
        /// </summary>
        public readonly ImmutableArray<string> Names;
        /// <summary>
        /// The network type of the instance.
        /// </summary>
        public readonly string? NetworkType;
        public readonly string? OutputFile;
        /// <summary>
        /// Billing method. Valid Values: `PostPaid` for  Pay-As-You-Go and `PrePaid` for subscription.
        /// </summary>
        public readonly string? PaymentType;
        public readonly string? ResourceGroupId;
        public readonly string? SearchKey;
        /// <summary>
        /// Status of the instance.
        /// </summary>
        public readonly string? Status;
        public readonly ImmutableDictionary<string, object>? Tags;
        /// <summary>
        /// VPC ID the instance belongs to.
        /// </summary>
        public readonly string? VpcId;
        /// <summary>
        /// VSwitch ID the instance belongs to.
        /// </summary>
        public readonly string? VswitchId;
        /// <summary>
        /// The ID of zone.
        /// </summary>
        public readonly string? ZoneId;

        [OutputConstructor]
        private GetInstancesResult(
            string? architectureType,

            string? editionType,

            bool? enableDetails,

            string? engineVersion,

            string? expired,

            bool? globalInstance,

            string id,

            ImmutableArray<string> ids,

            string? instanceClass,

            string? instanceType,

            ImmutableArray<Outputs.GetInstancesInstanceResult> instances,

            string? nameRegex,

            ImmutableArray<string> names,

            string? networkType,

            string? outputFile,

            string? paymentType,

            string? resourceGroupId,

            string? searchKey,

            string? status,

            ImmutableDictionary<string, object>? tags,

            string? vpcId,

            string? vswitchId,

            string? zoneId)
        {
            ArchitectureType = architectureType;
            EditionType = editionType;
            EnableDetails = enableDetails;
            EngineVersion = engineVersion;
            Expired = expired;
            GlobalInstance = globalInstance;
            Id = id;
            Ids = ids;
            InstanceClass = instanceClass;
            InstanceType = instanceType;
            Instances = instances;
            NameRegex = nameRegex;
            Names = names;
            NetworkType = networkType;
            OutputFile = outputFile;
            PaymentType = paymentType;
            ResourceGroupId = resourceGroupId;
            SearchKey = searchKey;
            Status = status;
            Tags = tags;
            VpcId = vpcId;
            VswitchId = vswitchId;
            ZoneId = zoneId;
        }
    }
}
