# coding=utf-8
# *** 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! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Union
from . import _utilities, _tables


class GetEntityResult:
    """
    A collection of values returned by getEntity.
    """
    def __init__(__self__, account_id=None, application_id=None, domain=None, guid=None, id=None, name=None, tag=None, type=None):
        if account_id and not isinstance(account_id, float):
            raise TypeError("Expected argument 'account_id' to be a float")
        __self__.account_id = account_id
        """
        The New Relic account ID associated with this entity.
        """
        if application_id and not isinstance(application_id, float):
            raise TypeError("Expected argument 'application_id' to be a float")
        __self__.application_id = application_id
        """
        The domain-specific application ID of the entity. Only returned for APM and Browser applications.
        """
        if domain and not isinstance(domain, str):
            raise TypeError("Expected argument 'domain' to be a str")
        __self__.domain = domain
        if guid and not isinstance(guid, str):
            raise TypeError("Expected argument 'guid' to be a str")
        __self__.guid = guid
        """
        The unique GUID of the entity.
        """
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        __self__.id = id
        """
        The provider-assigned unique ID for this managed resource.
        """
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        __self__.name = name
        if tag and not isinstance(tag, dict):
            raise TypeError("Expected argument 'tag' to be a dict")
        __self__.tag = tag
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        __self__.type = type


class AwaitableGetEntityResult(GetEntityResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetEntityResult(
            account_id=self.account_id,
            application_id=self.application_id,
            domain=self.domain,
            guid=self.guid,
            id=self.id,
            name=self.name,
            tag=self.tag,
            type=self.type)


def get_entity(domain=None, name=None, tag=None, type=None, opts=None):
    """
    Use this data source to get information about a specific entity in New Relic One that already exists.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_newrelic as newrelic

    app = newrelic.get_entity(name="my-app",
        domain="APM",
        type="APPLICATION",
        tag={
            "key": "my-tag",
            "value": "my-tag-value",
        })
    foo_alert_policy = newrelic.AlertPolicy("fooAlertPolicy")
    foo_alert_condition = newrelic.AlertCondition("fooAlertCondition",
        policy_id=foo_alert_policy.id,
        type="apm_app_metric",
        entities=[data["newrelic_application"]["app"]["application_id"]],
        metric="apdex",
        runbook_url="https://www.example.com",
        terms=[{
            "duration": 5,
            "operator": "below",
            "priority": "critical",
            "threshold": "0.75",
            "timeFunction": "all",
        }])
    ```


    :param str domain: The entity's domain. Valid values are APM, BROWSER, INFRA, MOBILE, and SYNTH.
    :param str name: The name of the entity in New Relic One.  The first entity matching this name for the given search parameters will be returned.
    :param str type: The entity's type. Valid values are APPLICATION, DASHBOARD, HOST, MONITOR, and WORRKLOAD.

    The **tag** object supports the following:

      * `key` (`str`)
      * `value` (`str`)
    """
    __args__ = dict()
    __args__['domain'] = domain
    __args__['name'] = name
    __args__['tag'] = tag
    __args__['type'] = type
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = _utilities.get_version()
    __ret__ = pulumi.runtime.invoke('newrelic:index/getEntity:getEntity', __args__, opts=opts).value

    return AwaitableGetEntityResult(
        account_id=__ret__.get('accountId'),
        application_id=__ret__.get('applicationId'),
        domain=__ret__.get('domain'),
        guid=__ret__.get('guid'),
        id=__ret__.get('id'),
        name=__ret__.get('name'),
        tag=__ret__.get('tag'),
        type=__ret__.get('type'))
