# 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

__all__ = [
    'GetAffinityResult',
    'AwaitableGetAffinityResult',
    'get_affinity',
    'get_affinity_output',
]

@pulumi.output_type
class GetAffinityResult:
    """
    A collection of values returned by getAffinity.
    """
    def __init__(__self__, id=None, name=None):
        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)

    @property
    @pulumi.getter
    def id(self) -> Optional[str]:
        return pulumi.get(self, "id")

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


class AwaitableGetAffinityResult(GetAffinityResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetAffinityResult(
            id=self.id,
            name=self.name)


def get_affinity(id: Optional[str] = None,
                 name: Optional[str] = None,
                 opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetAffinityResult:
    """
    !> **WARNING:** This data source is DEPRECATED and will be removed in the next major version. Please use AntiAffinityGroup instead.


    :param str id: The anti-affinity group ID to match (conflicts with `name`)
    :param str name: The group name to match (conflicts with `id`)
    """
    __args__ = dict()
    __args__['id'] = id
    __args__['name'] = name
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('exoscale:index/getAffinity:getAffinity', __args__, opts=opts, typ=GetAffinityResult).value

    return AwaitableGetAffinityResult(
        id=__ret__.id,
        name=__ret__.name)


@_utilities.lift_output_func(get_affinity)
def get_affinity_output(id: Optional[pulumi.Input[Optional[str]]] = None,
                        name: Optional[pulumi.Input[Optional[str]]] = None,
                        opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetAffinityResult]:
    """
    !> **WARNING:** This data source is DEPRECATED and will be removed in the next major version. Please use AntiAffinityGroup instead.


    :param str id: The anti-affinity group ID to match (conflicts with `name`)
    :param str name: The group name to match (conflicts with `id`)
    """
    ...
