# 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 copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs

__all__ = [
    'GetBackendHealthResult',
    'AwaitableGetBackendHealthResult',
    'get_backend_health',
    'get_backend_health_output',
]

@pulumi.output_type
class GetBackendHealthResult:
    """
    A collection of values returned by getBackendHealth.
    """
    def __init__(__self__, backend_name=None, backend_set_name=None, health_check_results=None, id=None, load_balancer_id=None, status=None):
        if backend_name and not isinstance(backend_name, str):
            raise TypeError("Expected argument 'backend_name' to be a str")
        pulumi.set(__self__, "backend_name", backend_name)
        if backend_set_name and not isinstance(backend_set_name, str):
            raise TypeError("Expected argument 'backend_set_name' to be a str")
        pulumi.set(__self__, "backend_set_name", backend_set_name)
        if health_check_results and not isinstance(health_check_results, list):
            raise TypeError("Expected argument 'health_check_results' to be a list")
        pulumi.set(__self__, "health_check_results", health_check_results)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if load_balancer_id and not isinstance(load_balancer_id, str):
            raise TypeError("Expected argument 'load_balancer_id' to be a str")
        pulumi.set(__self__, "load_balancer_id", load_balancer_id)
        if status and not isinstance(status, str):
            raise TypeError("Expected argument 'status' to be a str")
        pulumi.set(__self__, "status", status)

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

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

    @property
    @pulumi.getter(name="healthCheckResults")
    def health_check_results(self) -> Sequence['outputs.GetBackendHealthHealthCheckResultResult']:
        """
        A list of the most recent health check results returned for the specified backend server.
        """
        return pulumi.get(self, "health_check_results")

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

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

    @property
    @pulumi.getter
    def status(self) -> str:
        """
        The general health status of the specified backend server as reported by the primary and standby load balancers.
        *   **OK:** Both health checks returned `OK`.
        *   **WARNING:** One health check returned `OK` and one did not.
        *   **CRITICAL:** Neither health check returned `OK`.
        *   **UNKNOWN:** One or both health checks returned `UNKNOWN`, or the system was unable to retrieve metrics at this time.
        """
        return pulumi.get(self, "status")


class AwaitableGetBackendHealthResult(GetBackendHealthResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetBackendHealthResult(
            backend_name=self.backend_name,
            backend_set_name=self.backend_set_name,
            health_check_results=self.health_check_results,
            id=self.id,
            load_balancer_id=self.load_balancer_id,
            status=self.status)


def get_backend_health(backend_name: Optional[str] = None,
                       backend_set_name: Optional[str] = None,
                       load_balancer_id: Optional[str] = None,
                       opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetBackendHealthResult:
    """
    This data source provides details about a specific Backend Health resource in Oracle Cloud Infrastructure Load Balancer service.

    Gets the current health status of the specified backend server.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_oci as oci

    test_backend_health = oci.LoadBalancer.get_backend_health(backend_name=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
        backend_set_name=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
        load_balancer_id=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
    ```


    :param str backend_name: The IP address and port of the backend server to retrieve the health status for.  Example: `10.0.0.3:8080`
    :param str backend_set_name: The name of the backend set associated with the backend server to retrieve the health status for.  Example: `example_backend_set`
    :param str load_balancer_id: The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend server health status to be retrieved.
    """
    __args__ = dict()
    __args__['backendName'] = backend_name
    __args__['backendSetName'] = backend_set_name
    __args__['loadBalancerId'] = load_balancer_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('oci:LoadBalancer/getBackendHealth:getBackendHealth', __args__, opts=opts, typ=GetBackendHealthResult).value

    return AwaitableGetBackendHealthResult(
        backend_name=__ret__.backend_name,
        backend_set_name=__ret__.backend_set_name,
        health_check_results=__ret__.health_check_results,
        id=__ret__.id,
        load_balancer_id=__ret__.load_balancer_id,
        status=__ret__.status)


@_utilities.lift_output_func(get_backend_health)
def get_backend_health_output(backend_name: Optional[pulumi.Input[str]] = None,
                              backend_set_name: Optional[pulumi.Input[str]] = None,
                              load_balancer_id: Optional[pulumi.Input[str]] = None,
                              opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetBackendHealthResult]:
    """
    This data source provides details about a specific Backend Health resource in Oracle Cloud Infrastructure Load Balancer service.

    Gets the current health status of the specified backend server.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_oci as oci

    test_backend_health = oci.LoadBalancer.get_backend_health(backend_name=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
        backend_set_name=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference),
        load_balancer_id=%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
    ```


    :param str backend_name: The IP address and port of the backend server to retrieve the health status for.  Example: `10.0.0.3:8080`
    :param str backend_set_name: The name of the backend set associated with the backend server to retrieve the health status for.  Example: `example_backend_set`
    :param str load_balancer_id: The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the load balancer associated with the backend server health status to be retrieved.
    """
    ...
