# 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__, enabled=None, id=None, name=None, port=None, priority=None, site=None, ttl=None, type=None, value=None, weight=None):
        if enabled and not isinstance(enabled, bool):
            raise TypeError("Expected argument 'enabled' to be a bool")
        pulumi.set(__self__, "enabled", enabled)
        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 site and not isinstance(site, str):
            raise TypeError("Expected argument 'site' to be a str")
        pulumi.set(__self__, "site", site)
        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 value and not isinstance(value, str):
            raise TypeError("Expected argument 'value' to be a str")
        pulumi.set(__self__, "value", value)
        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 enabled(self) -> _builtins.bool:
        """
        Whether the DNS record is enabled.
        """
        return pulumi.get(self, "enabled")

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        The unique identifier of this resource.
        """
        return pulumi.get(self, "id")

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

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

    @_builtins.property
    @pulumi.getter
    def priority(self) -> _builtins.int:
        """
        Priority of the DNS records. Present only for MX and SRV records; unused by other record types.
        """
        return pulumi.get(self, "priority")

    @_builtins.property
    @pulumi.getter
    def site(self) -> _builtins.str:
        """
        The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
        """
        return pulumi.get(self, "site")

    @_builtins.property
    @pulumi.getter
    def ttl(self) -> _builtins.int:
        """
        Time To Live (TTL) of the DNS record in seconds. Setting to 0 means 'automatic'.
        """
        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 value(self) -> _builtins.str:
        """
        DNS record content.
        """
        return pulumi.get(self, "value")

    @_builtins.property
    @pulumi.getter
    def weight(self) -> _builtins.int:
        """
        A numeric value indicating the relative weight of the record.
        """
        return pulumi.get(self, "weight")


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


def get_record(name: Optional[_builtins.str] = None,
               site: Optional[_builtins.str] = None,
               value: Optional[_builtins.str] = None,
               opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetRecordResult:
    """
    Retrieves information about a specific DNS record configured in your UniFi network. This data source allows you to look up DNS records by either their name or record content. It's particularly useful for validating existing DNS configurations or referencing DNS records in other resources.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_unifi as unifi

    by_name = unifi.dns.get_record(name="example.mydomain.com")
    by_record = unifi.dns.get_record(value="192.168.0.1")
    ```


    :param _builtins.str name: DNS record name.
    :param _builtins.str site: The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    :param _builtins.str value: DNS record content.
    """
    __args__ = dict()
    __args__['name'] = name
    __args__['site'] = site
    __args__['value'] = value
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('unifi:dns/getRecord:getRecord', __args__, opts=opts, typ=GetRecordResult).value

    return AwaitableGetRecordResult(
        enabled=pulumi.get(__ret__, 'enabled'),
        id=pulumi.get(__ret__, 'id'),
        name=pulumi.get(__ret__, 'name'),
        port=pulumi.get(__ret__, 'port'),
        priority=pulumi.get(__ret__, 'priority'),
        site=pulumi.get(__ret__, 'site'),
        ttl=pulumi.get(__ret__, 'ttl'),
        type=pulumi.get(__ret__, 'type'),
        value=pulumi.get(__ret__, 'value'),
        weight=pulumi.get(__ret__, 'weight'))
def get_record_output(name: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                      site: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                      value: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                      opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetRecordResult]:
    """
    Retrieves information about a specific DNS record configured in your UniFi network. This data source allows you to look up DNS records by either their name or record content. It's particularly useful for validating existing DNS configurations or referencing DNS records in other resources.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_unifi as unifi

    by_name = unifi.dns.get_record(name="example.mydomain.com")
    by_record = unifi.dns.get_record(value="192.168.0.1")
    ```


    :param _builtins.str name: DNS record name.
    :param _builtins.str site: The name of the UniFi site where this resource should be applied. If not specified, the default site will be used.
    :param _builtins.str value: DNS record content.
    """
    __args__ = dict()
    __args__['name'] = name
    __args__['site'] = site
    __args__['value'] = value
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('unifi:dns/getRecord:getRecord', __args__, opts=opts, typ=GetRecordResult)
    return __ret__.apply(lambda __response__: GetRecordResult(
        enabled=pulumi.get(__response__, 'enabled'),
        id=pulumi.get(__response__, 'id'),
        name=pulumi.get(__response__, 'name'),
        port=pulumi.get(__response__, 'port'),
        priority=pulumi.get(__response__, 'priority'),
        site=pulumi.get(__response__, 'site'),
        ttl=pulumi.get(__response__, 'ttl'),
        type=pulumi.get(__response__, 'type'),
        value=pulumi.get(__response__, 'value'),
        weight=pulumi.get(__response__, 'weight')))
