<filename>sdk/dotnet/Dns/GetRecords.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.Dns
{
    public static class GetRecords
    {
        /// <summary>
        /// This data source provides a list of DNS Domain Records in an Alibaba Cloud account according to the specified filters.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var recordsDs = AliCloud.Dns.GetRecords.Invoke(new()
        ///     {
        ///         DomainName = "xiaozhu.top",
        ///         HostRecordRegex = "^@",
        ///         IsLocked = false,
        ///         OutputFile = "records.txt",
        ///         Type = "A",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstRecordId"] = recordsDs.Apply(getRecordsResult =&gt; getRecordsResult.Records[0]?.RecordId),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Task<GetRecordsResult> InvokeAsync(GetRecordsArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.InvokeAsync<GetRecordsResult>("alicloud:dns/getRecords:getRecords", args ?? new GetRecordsArgs(), options.WithDefaults());

        /// <summary>
        /// This data source provides a list of DNS Domain Records in an Alibaba Cloud account according to the specified filters.
        /// 
        /// {{% examples %}}
        /// ## Example Usage
        /// {{% example %}}
        /// 
        /// ```csharp
        /// using System.Collections.Generic;
        /// using Pulumi;
        /// using AliCloud = Pulumi.AliCloud;
        /// 
        /// return await Deployment.RunAsync(() =&gt; 
        /// {
        ///     var recordsDs = AliCloud.Dns.GetRecords.Invoke(new()
        ///     {
        ///         DomainName = "xiaozhu.top",
        ///         HostRecordRegex = "^@",
        ///         IsLocked = false,
        ///         OutputFile = "records.txt",
        ///         Type = "A",
        ///     });
        /// 
        ///     return new Dictionary&lt;string, object?&gt;
        ///     {
        ///         ["firstRecordId"] = recordsDs.Apply(getRecordsResult =&gt; getRecordsResult.Records[0]?.RecordId),
        ///     };
        /// });
        /// ```
        /// {{% /example %}}
        /// {{% /examples %}}
        /// </summary>
        public static Output<GetRecordsResult> Invoke(GetRecordsInvokeArgs args, InvokeOptions? options = null)
            => Pulumi.Deployment.Instance.Invoke<GetRecordsResult>("alicloud:dns/getRecords:getRecords", args ?? new GetRecordsInvokeArgs(), options.WithDefaults());
    }


    public sealed class GetRecordsArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// The domain name associated to the records.
        /// </summary>
        [Input("domainName", required: true)]
        public string DomainName { get; set; } = null!;

        /// <summary>
        /// Host record regex.
        /// </summary>
        [Input("hostRecordRegex")]
        public string? HostRecordRegex { get; set; }

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

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

        /// <summary>
        /// Whether the record is locked or not.
        /// </summary>
        [Input("isLocked")]
        public bool? IsLocked { get; set; }

        /// <summary>
        /// ISP line. Valid items are `default`, `telecom`, `unicom`, `mobile`, `oversea`, `edu`, `drpeng`, `btvn`, .etc. For checking all resolution lines enumeration please visit [Alibaba Cloud DNS doc](https://www.alibabacloud.com/help/doc-detail/34339.htm)
        /// </summary>
        [Input("line")]
        public string? Line { get; set; }

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

        /// <summary>
        /// Record status. Valid items are `ENABLE` and `DISABLE`.
        /// </summary>
        [Input("status")]
        public string? Status { get; set; }

        /// <summary>
        /// Record type. Valid items are `A`, `NS`, `MX`, `TXT`, `CNAME`, `SRV`, `AAAA`, `REDIRECT_URL`, `FORWORD_URL` .
        /// </summary>
        [Input("type")]
        public string? Type { get; set; }

        /// <summary>
        /// Host record value regex.
        /// </summary>
        [Input("valueRegex")]
        public string? ValueRegex { get; set; }

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

    public sealed class GetRecordsInvokeArgs : global::Pulumi.InvokeArgs
    {
        /// <summary>
        /// The domain name associated to the records.
        /// </summary>
        [Input("domainName", required: true)]
        public Input<string> DomainName { get; set; } = null!;

        /// <summary>
        /// Host record regex.
        /// </summary>
        [Input("hostRecordRegex")]
        public Input<string>? HostRecordRegex { get; set; }

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

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

        /// <summary>
        /// Whether the record is locked or not.
        /// </summary>
        [Input("isLocked")]
        public Input<bool>? IsLocked { get; set; }

        /// <summary>
        /// ISP line. Valid items are `default`, `telecom`, `unicom`, `mobile`, `oversea`, `edu`, `drpeng`, `btvn`, .etc. For checking all resolution lines enumeration please visit [Alibaba Cloud DNS doc](https://www.alibabacloud.com/help/doc-detail/34339.htm)
        /// </summary>
        [Input("line")]
        public Input<string>? Line { get; set; }

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

        /// <summary>
        /// Record status. Valid items are `ENABLE` and `DISABLE`.
        /// </summary>
        [Input("status")]
        public Input<string>? Status { get; set; }

        /// <summary>
        /// Record type. Valid items are `A`, `NS`, `MX`, `TXT`, `CNAME`, `SRV`, `AAAA`, `REDIRECT_URL`, `FORWORD_URL` .
        /// </summary>
        [Input("type")]
        public Input<string>? Type { get; set; }

        /// <summary>
        /// Host record value regex.
        /// </summary>
        [Input("valueRegex")]
        public Input<string>? ValueRegex { get; set; }

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


    [OutputType]
    public sealed class GetRecordsResult
    {
        /// <summary>
        /// Name of the domain the record belongs to.
        /// </summary>
        public readonly string DomainName;
        public readonly string? HostRecordRegex;
        /// <summary>
        /// The provider-assigned unique ID for this managed resource.
        /// </summary>
        public readonly string Id;
        /// <summary>
        /// A list of record IDs.
        /// </summary>
        public readonly ImmutableArray<string> Ids;
        public readonly bool? IsLocked;
        /// <summary>
        /// ISP line of the record.
        /// </summary>
        public readonly string? Line;
        public readonly string? OutputFile;
        /// <summary>
        /// A list of records. Each element contains the following attributes:
        /// </summary>
        public readonly ImmutableArray<Outputs.GetRecordsRecordResult> Records;
        /// <summary>
        /// Status of the record.
        /// </summary>
        public readonly string? Status;
        /// <summary>
        /// Type of the record.
        /// </summary>
        public readonly string? Type;
        /// <summary>
        /// A list of entire URLs. Each item format as `&lt;host_record&gt;.&lt;domain_name&gt;`.
        /// </summary>
        public readonly ImmutableArray<string> Urls;
        public readonly string? ValueRegex;

        [OutputConstructor]
        private GetRecordsResult(
            string domainName,

            string? hostRecordRegex,

            string id,

            ImmutableArray<string> ids,

            bool? isLocked,

            string? line,

            string? outputFile,

            ImmutableArray<Outputs.GetRecordsRecordResult> records,

            string? status,

            string? type,

            ImmutableArray<string> urls,

            string? valueRegex)
        {
            DomainName = domainName;
            HostRecordRegex = hostRecordRegex;
            Id = id;
            Ids = ids;
            IsLocked = isLocked;
            Line = line;
            OutputFile = outputFile;
            Records = records;
            Status = status;
            Type = type;
            Urls = urls;
            ValueRegex = valueRegex;
        }
    }
}
