# 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 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
from . import outputs
from ._inputs import *

__all__ = [
    'GetNodesResult',
    'AwaitableGetNodesResult',
    'get_nodes',
    'get_nodes_output',
]

@pulumi.output_type
class GetNodesResult:
    """
    A collection of values returned by getNodes.
    """
    def __init__(__self__, datacenter=None, id=None, node_ids=None, node_names=None, nodes=None, query_options=None):
        if datacenter and not isinstance(datacenter, str):
            raise TypeError("Expected argument 'datacenter' to be a str")
        pulumi.set(__self__, "datacenter", datacenter)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if node_ids and not isinstance(node_ids, list):
            raise TypeError("Expected argument 'node_ids' to be a list")
        pulumi.set(__self__, "node_ids", node_ids)
        if node_names and not isinstance(node_names, list):
            raise TypeError("Expected argument 'node_names' to be a list")
        pulumi.set(__self__, "node_names", node_names)
        if nodes and not isinstance(nodes, list):
            raise TypeError("Expected argument 'nodes' to be a list")
        pulumi.set(__self__, "nodes", nodes)
        if query_options and not isinstance(query_options, list):
            raise TypeError("Expected argument 'query_options' to be a list")
        pulumi.set(__self__, "query_options", query_options)

    @property
    @pulumi.getter
    def datacenter(self) -> str:
        """
        The datacenter the keys are being read from to.
        """
        return pulumi.get(self, "datacenter")

    @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="nodeIds")
    def node_ids(self) -> Sequence[str]:
        """
        A list of the Consul node IDs.
        """
        return pulumi.get(self, "node_ids")

    @property
    @pulumi.getter(name="nodeNames")
    def node_names(self) -> Sequence[str]:
        """
        A list of the Consul node names.
        """
        return pulumi.get(self, "node_names")

    @property
    @pulumi.getter
    def nodes(self) -> Sequence['outputs.GetNodesNodeResult']:
        """
        A list of nodes and details about each Consul agent.  The list of
        per-node attributes is detailed below.
        """
        return pulumi.get(self, "nodes")

    @property
    @pulumi.getter(name="queryOptions")
    def query_options(self) -> Optional[Sequence['outputs.GetNodesQueryOptionResult']]:
        return pulumi.get(self, "query_options")


class AwaitableGetNodesResult(GetNodesResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetNodesResult(
            datacenter=self.datacenter,
            id=self.id,
            node_ids=self.node_ids,
            node_names=self.node_names,
            nodes=self.nodes,
            query_options=self.query_options)


def get_nodes(query_options: Optional[Sequence[Union['GetNodesQueryOptionArgs', 'GetNodesQueryOptionArgsDict']]] = None,
              opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetNodesResult:
    """
    The `get_nodes` data source returns a list of Consul nodes that have
    been registered with the Consul cluster in a given datacenter.  By specifying a
    different datacenter in the `query_options` it is possible to retrieve a list of
    nodes from a different WAN-attached Consul datacenter.


    :param Sequence[Union['GetNodesQueryOptionArgs', 'GetNodesQueryOptionArgsDict']] query_options: See below.
    """
    __args__ = dict()
    __args__['queryOptions'] = query_options
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('consul:index/getNodes:getNodes', __args__, opts=opts, typ=GetNodesResult).value

    return AwaitableGetNodesResult(
        datacenter=pulumi.get(__ret__, 'datacenter'),
        id=pulumi.get(__ret__, 'id'),
        node_ids=pulumi.get(__ret__, 'node_ids'),
        node_names=pulumi.get(__ret__, 'node_names'),
        nodes=pulumi.get(__ret__, 'nodes'),
        query_options=pulumi.get(__ret__, 'query_options'))
def get_nodes_output(query_options: Optional[pulumi.Input[Optional[Sequence[Union['GetNodesQueryOptionArgs', 'GetNodesQueryOptionArgsDict']]]]] = None,
                     opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetNodesResult]:
    """
    The `get_nodes` data source returns a list of Consul nodes that have
    been registered with the Consul cluster in a given datacenter.  By specifying a
    different datacenter in the `query_options` it is possible to retrieve a list of
    nodes from a different WAN-attached Consul datacenter.


    :param Sequence[Union['GetNodesQueryOptionArgs', 'GetNodesQueryOptionArgsDict']] query_options: See below.
    """
    __args__ = dict()
    __args__['queryOptions'] = query_options
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('consul:index/getNodes:getNodes', __args__, opts=opts, typ=GetNodesResult)
    return __ret__.apply(lambda __response__: GetNodesResult(
        datacenter=pulumi.get(__response__, 'datacenter'),
        id=pulumi.get(__response__, 'id'),
        node_ids=pulumi.get(__response__, 'node_ids'),
        node_names=pulumi.get(__response__, 'node_names'),
        nodes=pulumi.get(__response__, 'nodes'),
        query_options=pulumi.get(__response__, 'query_options')))
