1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. dns
  5. getRecords
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.dns.getRecords

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    This data source provides a list of DNS Domain Records in an Alibaba Cloud account according to the specified filters.

    NOTE: Available since v1.0.0.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const recordsDs = alicloud.dns.getRecords({
        domainName: "xiaozhu.top",
        hostRecordRegex: "^@",
        isLocked: false,
        outputFile: "records.txt",
        type: "A",
    });
    export const firstRecordId = recordsDs.then(recordsDs => recordsDs.records?.[0]?.recordId);
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    records_ds = alicloud.dns.get_records(domain_name="xiaozhu.top",
        host_record_regex="^@",
        is_locked=False,
        output_file="records.txt",
        type="A")
    pulumi.export("firstRecordId", records_ds.records[0].record_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/dns"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		recordsDs, err := dns.GetRecords(ctx, &dns.GetRecordsArgs{
    			DomainName:      "xiaozhu.top",
    			HostRecordRegex: pulumi.StringRef("^@"),
    			IsLocked:        pulumi.BoolRef(false),
    			OutputFile:      pulumi.StringRef("records.txt"),
    			Type:            pulumi.StringRef("A"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("firstRecordId", recordsDs.Records[0].RecordId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var recordsDs = AliCloud.Dns.GetRecords.Invoke(new()
        {
            DomainName = "xiaozhu.top",
            HostRecordRegex = "^@",
            IsLocked = false,
            OutputFile = "records.txt",
            Type = "A",
        });
    
        return new Dictionary<string, object?>
        {
            ["firstRecordId"] = recordsDs.Apply(getRecordsResult => getRecordsResult.Records[0]?.RecordId),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.dns.DnsFunctions;
    import com.pulumi.alicloud.dns.inputs.GetRecordsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var recordsDs = DnsFunctions.getRecords(GetRecordsArgs.builder()
                .domainName("xiaozhu.top")
                .hostRecordRegex("^@")
                .isLocked(false)
                .outputFile("records.txt")
                .type("A")
                .build());
    
            ctx.export("firstRecordId", recordsDs.applyValue(getRecordsResult -> getRecordsResult.records()[0].recordId()));
        }
    }
    
    variables:
      recordsDs:
        fn::invoke:
          Function: alicloud:dns:getRecords
          Arguments:
            domainName: xiaozhu.top
            hostRecordRegex: ^@
            isLocked: false
            outputFile: records.txt
            type: A
    outputs:
      firstRecordId: ${recordsDs.records[0].recordId}
    

    Using getRecords

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getRecords(args: GetRecordsArgs, opts?: InvokeOptions): Promise<GetRecordsResult>
    function getRecordsOutput(args: GetRecordsOutputArgs, opts?: InvokeOptions): Output<GetRecordsResult>
    def get_records(domain_name: Optional[str] = None,
                    host_record_regex: Optional[str] = None,
                    ids: Optional[Sequence[str]] = None,
                    is_locked: Optional[bool] = None,
                    line: Optional[str] = None,
                    output_file: Optional[str] = None,
                    status: Optional[str] = None,
                    type: Optional[str] = None,
                    value_regex: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetRecordsResult
    def get_records_output(domain_name: Optional[pulumi.Input[str]] = None,
                    host_record_regex: Optional[pulumi.Input[str]] = None,
                    ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    is_locked: Optional[pulumi.Input[bool]] = None,
                    line: Optional[pulumi.Input[str]] = None,
                    output_file: Optional[pulumi.Input[str]] = None,
                    status: Optional[pulumi.Input[str]] = None,
                    type: Optional[pulumi.Input[str]] = None,
                    value_regex: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetRecordsResult]
    func GetRecords(ctx *Context, args *GetRecordsArgs, opts ...InvokeOption) (*GetRecordsResult, error)
    func GetRecordsOutput(ctx *Context, args *GetRecordsOutputArgs, opts ...InvokeOption) GetRecordsResultOutput

    > Note: This function is named GetRecords in the Go SDK.

    public static class GetRecords 
    {
        public static Task<GetRecordsResult> InvokeAsync(GetRecordsArgs args, InvokeOptions? opts = null)
        public static Output<GetRecordsResult> Invoke(GetRecordsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRecordsResult> getRecords(GetRecordsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:dns/getRecords:getRecords
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DomainName string
    The domain name associated to the records.
    HostRecordRegex string
    Host record regex.
    Ids List<string>
    A list of record IDs.
    IsLocked bool
    Whether the record is locked or not.
    Line string
    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
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    Record status. Valid items are ENABLE and DISABLE.
    Type string
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    ValueRegex string
    Host record value regex.
    DomainName string
    The domain name associated to the records.
    HostRecordRegex string
    Host record regex.
    Ids []string
    A list of record IDs.
    IsLocked bool
    Whether the record is locked or not.
    Line string
    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
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    Status string
    Record status. Valid items are ENABLE and DISABLE.
    Type string
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    ValueRegex string
    Host record value regex.
    domainName String
    The domain name associated to the records.
    hostRecordRegex String
    Host record regex.
    ids List<String>
    A list of record IDs.
    isLocked Boolean
    Whether the record is locked or not.
    line String
    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
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    Record status. Valid items are ENABLE and DISABLE.
    type String
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    valueRegex String
    Host record value regex.
    domainName string
    The domain name associated to the records.
    hostRecordRegex string
    Host record regex.
    ids string[]
    A list of record IDs.
    isLocked boolean
    Whether the record is locked or not.
    line string
    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
    outputFile string
    File name where to save data source results (after running pulumi preview).
    status string
    Record status. Valid items are ENABLE and DISABLE.
    type string
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    valueRegex string
    Host record value regex.
    domain_name str
    The domain name associated to the records.
    host_record_regex str
    Host record regex.
    ids Sequence[str]
    A list of record IDs.
    is_locked bool
    Whether the record is locked or not.
    line str
    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
    output_file str
    File name where to save data source results (after running pulumi preview).
    status str
    Record status. Valid items are ENABLE and DISABLE.
    type str
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    value_regex str
    Host record value regex.
    domainName String
    The domain name associated to the records.
    hostRecordRegex String
    Host record regex.
    ids List<String>
    A list of record IDs.
    isLocked Boolean
    Whether the record is locked or not.
    line String
    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
    outputFile String
    File name where to save data source results (after running pulumi preview).
    status String
    Record status. Valid items are ENABLE and DISABLE.
    type String
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    valueRegex String
    Host record value regex.

    getRecords Result

    The following output properties are available:

    DomainName string
    Name of the domain the record belongs to.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of record IDs.
    Records List<Pulumi.AliCloud.Dns.Outputs.GetRecordsRecord>
    A list of records. Each element contains the following attributes:
    Urls List<string>
    A list of entire URLs. Each item format as <host_record>.<domain_name>.
    HostRecordRegex string
    IsLocked bool
    Line string
    ISP line of the record.
    OutputFile string
    Status string
    Status of the record.
    Type string
    Type of the record.
    ValueRegex string
    DomainName string
    Name of the domain the record belongs to.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of record IDs.
    Records []GetRecordsRecord
    A list of records. Each element contains the following attributes:
    Urls []string
    A list of entire URLs. Each item format as <host_record>.<domain_name>.
    HostRecordRegex string
    IsLocked bool
    Line string
    ISP line of the record.
    OutputFile string
    Status string
    Status of the record.
    Type string
    Type of the record.
    ValueRegex string
    domainName String
    Name of the domain the record belongs to.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of record IDs.
    records List<GetRecordsRecord>
    A list of records. Each element contains the following attributes:
    urls List<String>
    A list of entire URLs. Each item format as <host_record>.<domain_name>.
    hostRecordRegex String
    isLocked Boolean
    line String
    ISP line of the record.
    outputFile String
    status String
    Status of the record.
    type String
    Type of the record.
    valueRegex String
    domainName string
    Name of the domain the record belongs to.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of record IDs.
    records GetRecordsRecord[]
    A list of records. Each element contains the following attributes:
    urls string[]
    A list of entire URLs. Each item format as <host_record>.<domain_name>.
    hostRecordRegex string
    isLocked boolean
    line string
    ISP line of the record.
    outputFile string
    status string
    Status of the record.
    type string
    Type of the record.
    valueRegex string
    domain_name str
    Name of the domain the record belongs to.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of record IDs.
    records Sequence[GetRecordsRecord]
    A list of records. Each element contains the following attributes:
    urls Sequence[str]
    A list of entire URLs. Each item format as <host_record>.<domain_name>.
    host_record_regex str
    is_locked bool
    line str
    ISP line of the record.
    output_file str
    status str
    Status of the record.
    type str
    Type of the record.
    value_regex str
    domainName String
    Name of the domain the record belongs to.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of record IDs.
    records List<Property Map>
    A list of records. Each element contains the following attributes:
    urls List<String>
    A list of entire URLs. Each item format as <host_record>.<domain_name>.
    hostRecordRegex String
    isLocked Boolean
    line String
    ISP line of the record.
    outputFile String
    status String
    Status of the record.
    type String
    Type of the record.
    valueRegex String

    Supporting Types

    GetRecordsRecord

    DomainName string
    The domain name associated to the records.
    HostRecord string
    Host record of the domain.
    Line string
    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
    Locked bool
    Indicates whether the record is locked.
    Priority int
    Priority of the MX record.
    RecordId string
    ID of the record.
    Status string
    Record status. Valid items are ENABLE and DISABLE.
    Ttl double
    TTL of the record.
    Type string
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    Value string
    Host record value of the domain.
    DomainName string
    The domain name associated to the records.
    HostRecord string
    Host record of the domain.
    Line string
    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
    Locked bool
    Indicates whether the record is locked.
    Priority int
    Priority of the MX record.
    RecordId string
    ID of the record.
    Status string
    Record status. Valid items are ENABLE and DISABLE.
    Ttl float64
    TTL of the record.
    Type string
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    Value string
    Host record value of the domain.
    domainName String
    The domain name associated to the records.
    hostRecord String
    Host record of the domain.
    line String
    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
    locked Boolean
    Indicates whether the record is locked.
    priority Integer
    Priority of the MX record.
    recordId String
    ID of the record.
    status String
    Record status. Valid items are ENABLE and DISABLE.
    ttl Double
    TTL of the record.
    type String
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    value String
    Host record value of the domain.
    domainName string
    The domain name associated to the records.
    hostRecord string
    Host record of the domain.
    line string
    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
    locked boolean
    Indicates whether the record is locked.
    priority number
    Priority of the MX record.
    recordId string
    ID of the record.
    status string
    Record status. Valid items are ENABLE and DISABLE.
    ttl number
    TTL of the record.
    type string
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    value string
    Host record value of the domain.
    domain_name str
    The domain name associated to the records.
    host_record str
    Host record of the domain.
    line str
    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
    locked bool
    Indicates whether the record is locked.
    priority int
    Priority of the MX record.
    record_id str
    ID of the record.
    status str
    Record status. Valid items are ENABLE and DISABLE.
    ttl float
    TTL of the record.
    type str
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    value str
    Host record value of the domain.
    domainName String
    The domain name associated to the records.
    hostRecord String
    Host record of the domain.
    line String
    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
    locked Boolean
    Indicates whether the record is locked.
    priority Number
    Priority of the MX record.
    recordId String
    ID of the record.
    status String
    Record status. Valid items are ENABLE and DISABLE.
    ttl Number
    TTL of the record.
    type String
    Record type. Valid items are A, NS, MX, TXT, CNAME, SRV, AAAA, REDIRECT_URL, FORWORD_URL .
    value String
    Host record value of the domain.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi