1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. getRecords
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

digitalocean.getRecords

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Retrieve information about all DNS records within a domain, with the ability to filter and sort the results. If no filters are specified, all records will be returned.

    Example Usage

    Get data for all MX records in a domain:

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    import * as std from "@pulumi/std";
    
    const example = digitalocean.getRecords({
        domain: "example.com",
        filters: [{
            key: "type",
            values: ["MX"],
        }],
    });
    export const mailServers = example.then(example => std.join({
        separator: ",",
        input: example.records.map(__item => __item.value),
    })).then(invoke => invoke.result);
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    import pulumi_std as std
    
    example = digitalocean.get_records(domain="example.com",
        filters=[{
            "key": "type",
            "values": ["MX"],
        }])
    pulumi.export("mailServers", std.join(separator=",",
        input=[__item.value for __item in example.records]).result)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    example, err := digitalocean.GetRecords(ctx, &digitalocean.GetRecordsArgs{
    Domain: "example.com",
    Filters: []digitalocean.GetRecordsFilter{
    {
    Key: "type",
    Values: []string{
    "MX",
    },
    },
    },
    }, nil);
    if err != nil {
    return err
    }
    ctx.Export("mailServers", pulumi.String(std.Join(ctx, &std.JoinArgs{
    Separator: ",",
    Input: %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:11,17-41),
    }, nil).Result))
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var example = DigitalOcean.GetRecords.Invoke(new()
        {
            Domain = "example.com",
            Filters = new[]
            {
                new DigitalOcean.Inputs.GetRecordsFilterInputArgs
                {
                    Key = "type",
                    Values = new[]
                    {
                        "MX",
                    },
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["mailServers"] = Std.Join.Invoke(new()
            {
                Separator = ",",
                Input = example.Apply(getRecordsResult => getRecordsResult.Records).Select(__item => __item.Value).ToList(),
            }).Apply(invoke => invoke.Result),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.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 example = DigitaloceanFunctions.getRecords(GetRecordsArgs.builder()
                .domain("example.com")
                .filters(GetRecordsFilterArgs.builder()
                    .key("type")
                    .values("MX")
                    .build())
                .build());
    
            ctx.export("mailServers", StdFunctions.join(JoinArgs.builder()
                .separator(",")
                .input(example.applyValue(getRecordsResult -> getRecordsResult.records()).stream().map(element -> element.value()).collect(toList()))
                .build()).result());
        }
    }
    
    Coming soon!
    

    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: Optional[str] = None,
                    filters: Optional[Sequence[GetRecordsFilter]] = None,
                    sorts: Optional[Sequence[GetRecordsSort]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetRecordsResult
    def get_records_output(domain: Optional[pulumi.Input[str]] = None,
                    filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetRecordsFilterArgs]]]] = None,
                    sorts: Optional[pulumi.Input[Sequence[pulumi.Input[GetRecordsSortArgs]]]] = 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: digitalocean:index/getRecords:getRecords
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Domain string
    The domain name to search for DNS records
    Filters List<Pulumi.DigitalOcean.Inputs.GetRecordsFilter>
    Filter the results. The filter block is documented below.
    Sorts List<Pulumi.DigitalOcean.Inputs.GetRecordsSort>
    Sort the results. The sort block is documented below.
    Domain string
    The domain name to search for DNS records
    Filters []GetRecordsFilter
    Filter the results. The filter block is documented below.
    Sorts []GetRecordsSort
    Sort the results. The sort block is documented below.
    domain String
    The domain name to search for DNS records
    filters List<GetRecordsFilter>
    Filter the results. The filter block is documented below.
    sorts List<GetRecordsSort>
    Sort the results. The sort block is documented below.
    domain string
    The domain name to search for DNS records
    filters GetRecordsFilter[]
    Filter the results. The filter block is documented below.
    sorts GetRecordsSort[]
    Sort the results. The sort block is documented below.
    domain str
    The domain name to search for DNS records
    filters Sequence[GetRecordsFilter]
    Filter the results. The filter block is documented below.
    sorts Sequence[GetRecordsSort]
    Sort the results. The sort block is documented below.
    domain String
    The domain name to search for DNS records
    filters List<Property Map>
    Filter the results. The filter block is documented below.
    sorts List<Property Map>
    Sort the results. The sort block is documented below.

    getRecords Result

    The following output properties are available:

    Domain string
    Domain of the DNS record.
    Id string
    The provider-assigned unique ID for this managed resource.
    Records []GetRecordsRecord
    Filters []GetRecordsFilter
    Sorts []GetRecordsSort
    domain String
    Domain of the DNS record.
    id String
    The provider-assigned unique ID for this managed resource.
    records List<GetRecordsRecord>
    filters List<GetRecordsFilter>
    sorts List<GetRecordsSort>
    domain string
    Domain of the DNS record.
    id string
    The provider-assigned unique ID for this managed resource.
    records GetRecordsRecord[]
    filters GetRecordsFilter[]
    sorts GetRecordsSort[]
    domain str
    Domain of the DNS record.
    id str
    The provider-assigned unique ID for this managed resource.
    records Sequence[GetRecordsRecord]
    filters Sequence[GetRecordsFilter]
    sorts Sequence[GetRecordsSort]
    domain String
    Domain of the DNS record.
    id String
    The provider-assigned unique ID for this managed resource.
    records List<Property Map>
    filters List<Property Map>
    sorts List<Property Map>

    Supporting Types

    GetRecordsFilter

    Key string
    Filter the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    Values List<string>
    A list of values to match against the key field. Only retrieves DNS records where the key field takes on one or more of the values provided here.
    All bool
    Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.
    MatchBy string
    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.
    Key string
    Filter the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    Values []string
    A list of values to match against the key field. Only retrieves DNS records where the key field takes on one or more of the values provided here.
    All bool
    Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.
    MatchBy string
    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.
    key String
    Filter the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    values List<String>
    A list of values to match against the key field. Only retrieves DNS records where the key field takes on one or more of the values provided here.
    all Boolean
    Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.
    matchBy String
    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.
    key string
    Filter the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    values string[]
    A list of values to match against the key field. Only retrieves DNS records where the key field takes on one or more of the values provided here.
    all boolean
    Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.
    matchBy string
    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.
    key str
    Filter the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    values Sequence[str]
    A list of values to match against the key field. Only retrieves DNS records where the key field takes on one or more of the values provided here.
    all bool
    Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.
    match_by str
    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.
    key String
    Filter the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    values List<String>
    A list of values to match against the key field. Only retrieves DNS records where the key field takes on one or more of the values provided here.
    all Boolean
    Set to true to require that a field match all of the values instead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of the values are present in the list or set.
    matchBy String
    One of exact (default), re, or substring. For string-typed fields, specify re to match by using the values as regular expressions, or specify substring to match by treating the values as substrings to find within the string field.

    GetRecordsRecord

    Domain string
    The domain name to search for DNS records
    Flags int
    An unsigned integer between 0-255 used for CAA records.
    Id int
    The ID of the record.
    Name string
    The name of the DNS record.
    Port int
    The port for SRV records.
    Priority int
    The priority for SRV and MX records.
    Tag string
    The parameter tag for CAA records.
    Ttl int
    This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.
    Type string
    The type of the DNS record.
    Value string
    Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.
    Weight int
    The weight for SRV records.
    Domain string
    The domain name to search for DNS records
    Flags int
    An unsigned integer between 0-255 used for CAA records.
    Id int
    The ID of the record.
    Name string
    The name of the DNS record.
    Port int
    The port for SRV records.
    Priority int
    The priority for SRV and MX records.
    Tag string
    The parameter tag for CAA records.
    Ttl int
    This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.
    Type string
    The type of the DNS record.
    Value string
    Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.
    Weight int
    The weight for SRV records.
    domain String
    The domain name to search for DNS records
    flags Integer
    An unsigned integer between 0-255 used for CAA records.
    id Integer
    The ID of the record.
    name String
    The name of the DNS record.
    port Integer
    The port for SRV records.
    priority Integer
    The priority for SRV and MX records.
    tag String
    The parameter tag for CAA records.
    ttl Integer
    This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.
    type String
    The type of the DNS record.
    value String
    Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.
    weight Integer
    The weight for SRV records.
    domain string
    The domain name to search for DNS records
    flags number
    An unsigned integer between 0-255 used for CAA records.
    id number
    The ID of the record.
    name string
    The name of the DNS record.
    port number
    The port for SRV records.
    priority number
    The priority for SRV and MX records.
    tag string
    The parameter tag for CAA records.
    ttl number
    This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.
    type string
    The type of the DNS record.
    value string
    Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.
    weight number
    The weight for SRV records.
    domain str
    The domain name to search for DNS records
    flags int
    An unsigned integer between 0-255 used for CAA records.
    id int
    The ID of the record.
    name str
    The name of the DNS record.
    port int
    The port for SRV records.
    priority int
    The priority for SRV and MX records.
    tag str
    The parameter tag for CAA records.
    ttl int
    This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.
    type str
    The type of the DNS record.
    value str
    Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.
    weight int
    The weight for SRV records.
    domain String
    The domain name to search for DNS records
    flags Number
    An unsigned integer between 0-255 used for CAA records.
    id Number
    The ID of the record.
    name String
    The name of the DNS record.
    port Number
    The port for SRV records.
    priority Number
    The priority for SRV and MX records.
    tag String
    The parameter tag for CAA records.
    ttl Number
    This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh should be requested.
    type String
    The type of the DNS record.
    value String
    Variable data depending on record type. For example, the "data" value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates.
    weight Number
    The weight for SRV records.

    GetRecordsSort

    Key string
    Sort the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    Direction string
    The sort direction. This may be either asc or desc.
    Key string
    Sort the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    Direction string
    The sort direction. This may be either asc or desc.
    key String
    Sort the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    direction String
    The sort direction. This may be either asc or desc.
    key string
    Sort the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    direction string
    The sort direction. This may be either asc or desc.
    key str
    Sort the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    direction str
    The sort direction. This may be either asc or desc.
    key String
    Sort the DNS records by this key. This may be one of domain, flags, name, port, priority, tag, ttl, type, value, or weight.
    direction String
    The sort direction. This may be either asc or desc.

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi