# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from . import _utilities

__all__ = [
    'GetRecordResult',
    'AwaitableGetRecordResult',
    'get_record',
    'get_record_output',
]

@pulumi.output_type
class GetRecordResult:
    """
    A collection of values returned by getRecord.
    """
    def __init__(__self__, data=None, domain=None, flags=None, id=None, name=None, port=None, priority=None, tag=None, ttl=None, type=None, weight=None):
        if data and not isinstance(data, str):
            raise TypeError("Expected argument 'data' to be a str")
        pulumi.set(__self__, "data", data)
        if domain and not isinstance(domain, str):
            raise TypeError("Expected argument 'domain' to be a str")
        pulumi.set(__self__, "domain", domain)
        if flags and not isinstance(flags, int):
            raise TypeError("Expected argument 'flags' to be a int")
        pulumi.set(__self__, "flags", flags)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if port and not isinstance(port, int):
            raise TypeError("Expected argument 'port' to be a int")
        pulumi.set(__self__, "port", port)
        if priority and not isinstance(priority, int):
            raise TypeError("Expected argument 'priority' to be a int")
        pulumi.set(__self__, "priority", priority)
        if tag and not isinstance(tag, str):
            raise TypeError("Expected argument 'tag' to be a str")
        pulumi.set(__self__, "tag", tag)
        if ttl and not isinstance(ttl, int):
            raise TypeError("Expected argument 'ttl' to be a int")
        pulumi.set(__self__, "ttl", ttl)
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        pulumi.set(__self__, "type", type)
        if weight and not isinstance(weight, int):
            raise TypeError("Expected argument 'weight' to be a int")
        pulumi.set(__self__, "weight", weight)

    @_builtins.property
    @pulumi.getter
    def data(self) -> _builtins.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.
        """
        return pulumi.get(self, "data")

    @_builtins.property
    @pulumi.getter
    def domain(self) -> _builtins.str:
        return pulumi.get(self, "domain")

    @_builtins.property
    @pulumi.getter
    def flags(self) -> _builtins.int:
        """
        An unsigned integer between 0-255 used for CAA records.
        """
        return pulumi.get(self, "flags")

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter
    def name(self) -> _builtins.str:
        return pulumi.get(self, "name")

    @_builtins.property
    @pulumi.getter
    def port(self) -> _builtins.int:
        """
        The port for SRV records.
        """
        return pulumi.get(self, "port")

    @_builtins.property
    @pulumi.getter
    def priority(self) -> _builtins.int:
        """
        The priority for SRV and MX records.
        """
        return pulumi.get(self, "priority")

    @_builtins.property
    @pulumi.getter
    def tag(self) -> _builtins.str:
        """
        The parameter tag for CAA records.
        """
        return pulumi.get(self, "tag")

    @_builtins.property
    @pulumi.getter
    def ttl(self) -> _builtins.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.
        """
        return pulumi.get(self, "ttl")

    @_builtins.property
    @pulumi.getter
    def type(self) -> _builtins.str:
        """
        The type of the DNS record.
        """
        return pulumi.get(self, "type")

    @_builtins.property
    @pulumi.getter
    def weight(self) -> _builtins.int:
        """
        The weight for SRV records.
        """
        return pulumi.get(self, "weight")


class AwaitableGetRecordResult(GetRecordResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetRecordResult(
            data=self.data,
            domain=self.domain,
            flags=self.flags,
            id=self.id,
            name=self.name,
            port=self.port,
            priority=self.priority,
            tag=self.tag,
            ttl=self.ttl,
            type=self.type,
            weight=self.weight)


def get_record(domain: Optional[_builtins.str] = None,
               name: Optional[_builtins.str] = None,
               opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetRecordResult:
    """
    Get information on a DNS record. This data source provides the name, TTL, and zone
    file as configured on your DigitalOcean account. This is useful if the record
    in question is not managed by the provider.

    An error is triggered if the provided domain name or record are not managed with
    your DigitalOcean account.

    ## Example Usage

    Get data from a DNS record:

    ```python
    import pulumi
    import pulumi_digitalocean as digitalocean

    example = digitalocean.get_record(domain="example.com",
        name="test")
    pulumi.export("recordType", example.type)
    pulumi.export("recordTtl", example.ttl)
    ```


    :param _builtins.str domain: The domain name of the record.
    :param _builtins.str name: The name of the record.
    """
    __args__ = dict()
    __args__['domain'] = domain
    __args__['name'] = name
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('digitalocean:index/getRecord:getRecord', __args__, opts=opts, typ=GetRecordResult).value

    return AwaitableGetRecordResult(
        data=pulumi.get(__ret__, 'data'),
        domain=pulumi.get(__ret__, 'domain'),
        flags=pulumi.get(__ret__, 'flags'),
        id=pulumi.get(__ret__, 'id'),
        name=pulumi.get(__ret__, 'name'),
        port=pulumi.get(__ret__, 'port'),
        priority=pulumi.get(__ret__, 'priority'),
        tag=pulumi.get(__ret__, 'tag'),
        ttl=pulumi.get(__ret__, 'ttl'),
        type=pulumi.get(__ret__, 'type'),
        weight=pulumi.get(__ret__, 'weight'))
def get_record_output(domain: Optional[pulumi.Input[_builtins.str]] = None,
                      name: Optional[pulumi.Input[_builtins.str]] = None,
                      opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetRecordResult]:
    """
    Get information on a DNS record. This data source provides the name, TTL, and zone
    file as configured on your DigitalOcean account. This is useful if the record
    in question is not managed by the provider.

    An error is triggered if the provided domain name or record are not managed with
    your DigitalOcean account.

    ## Example Usage

    Get data from a DNS record:

    ```python
    import pulumi
    import pulumi_digitalocean as digitalocean

    example = digitalocean.get_record(domain="example.com",
        name="test")
    pulumi.export("recordType", example.type)
    pulumi.export("recordTtl", example.ttl)
    ```


    :param _builtins.str domain: The domain name of the record.
    :param _builtins.str name: The name of the record.
    """
    __args__ = dict()
    __args__['domain'] = domain
    __args__['name'] = name
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('digitalocean:index/getRecord:getRecord', __args__, opts=opts, typ=GetRecordResult)
    return __ret__.apply(lambda __response__: GetRecordResult(
        data=pulumi.get(__response__, 'data'),
        domain=pulumi.get(__response__, 'domain'),
        flags=pulumi.get(__response__, 'flags'),
        id=pulumi.get(__response__, 'id'),
        name=pulumi.get(__response__, 'name'),
        port=pulumi.get(__response__, 'port'),
        priority=pulumi.get(__response__, 'priority'),
        tag=pulumi.get(__response__, 'tag'),
        ttl=pulumi.get(__response__, 'ttl'),
        type=pulumi.get(__response__, 'type'),
        weight=pulumi.get(__response__, 'weight')))
