<reponame>rhysmdnz/pulumi-alicloud-rhys-hacks<filename>sdk/dotnet/Ots/GetTunnels.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.Ots
{
    public static class GetTunnels
    {
        /// <summary>
        /// This data source provides the ots tunnels of the current Alibaba Cloud user.
        /// 
        /// For information about OTS tunnel and how to use it, see [Tunnel overview](https://www.alibabacloud.com/help/en/tablestore/latest/tunnel-service-overview).
        /// 
        /// &gt; **NOTE:** Available in v1.172.0+.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var tunnelsDs = AliCloud.Ots.GetTunnels.Invoke(new()
        ///     {
        ///         InstanceName = "sample-instance",
        ///         NameRegex = "sample-tunnel",
        ///         OutputFile = "tunnels.txt",
        ///         TableName = "sample-table",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstTunnelId"] = tunnelsDs.Apply(getTunnelsResult =&gt; getTunnelsResult.Tunnels[0]?.Id),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetTunnelsResult> InvokeAsync(GetTunnelsArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetTunnelsResult>("alicloud:ots/getTunnels:getTunnels", args ?? new GetTunnelsArgs(), options.WithDefaults());

        /// <summary>
        /// This data source provides the ots tunnels of the current Alibaba Cloud user.
        /// 
        /// For information about OTS tunnel and how to use it, see [Tunnel overview](https://www.alibabacloud.com/help/en/tablestore/latest/tunnel-service-overview).
        /// 
        /// &gt; **NOTE:** Available in v1.172.0+.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var tunnelsDs = AliCloud.Ots.GetTunnels.Invoke(new()
        ///     {
        ///         InstanceName = "sample-instance",
        ///         NameRegex = "sample-tunnel",
        ///         OutputFile = "tunnels.txt",
        ///         TableName = "sample-table",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstTunnelId"] = tunnelsDs.Apply(getTunnelsResult =&gt; getTunnelsResult.Tunnels[0]?.Id),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetTunnelsResult> Invoke(GetTunnelsInvokeArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetTunnelsResult>("alicloud:ots/getTunnels:getTunnels", args ?? new GetTunnelsInvokeArgs(), options.WithDefaults());
    }


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

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

        /// <summary>
        /// The name of OTS instance.
        /// </summary>
        [Input("instanceName", required: true)]
        public string InstanceName { get; set; } = null!;

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

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

        /// <summary>
        /// The name of OTS table.
        /// </summary>
        [Input("tableName", required: true)]
        public string TableName { get; set; } = null!;

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

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

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

        /// <summary>
        /// The name of OTS instance.
        /// </summary>
        [Input("instanceName", required: true)]
        public Input<string> InstanceName { get; set; } = null!;

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

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

        /// <summary>
        /// The name of OTS table.
        /// </summary>
        [Input("tableName", required: true)]
        public Input<string> TableName { get; set; } = null!;

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


    [OutputType]
    public sealed class GetTunnelsResult
    {
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        /// <summary>
        /// A list of tunnel IDs.
        /// </summary>
        public readonly ImmutableArray<string> Ids;
        /// <summary>
        /// The OTS instance name.
        /// </summary>
        public readonly string InstanceName;
        public readonly string? NameRegex;
        /// <summary>
        /// A list of tunnel names.
        /// </summary>
        public readonly ImmutableArray<string> Names;
        public readonly string? OutputFile;
        /// <summary>
        /// The table name of the OTS which could not be changed.
        /// </summary>
        public readonly string TableName;
        /// <summary>
        /// A list of tunnels. Each element contains the following attributes:
        /// </summary>
        public readonly ImmutableArray<Outputs.GetTunnelsTunnelResult> Tunnels;

        [OutputConstructor]
        private GetTunnelsResult(
            string id,

            ImmutableArray<string> ids,

            string instanceName,

            string? nameRegex,

            ImmutableArray<string> names,

            string? outputFile,

            string tableName,

            ImmutableArray<Outputs.GetTunnelsTunnelResult> tunnels)
        {
            Id = id;
            Ids = ids;
            InstanceName = instanceName;
            NameRegex = nameRegex;
            Names = names;
            OutputFile = outputFile;
            TableName = tableName;
            Tunnels = tunnels;
        }
    }
}
