# 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

__all__ = [
    'GetSecurityGroupResult',
    'AwaitableGetSecurityGroupResult',
    'get_security_group',
    'get_security_group_output',
]

@pulumi.output_type
class GetSecurityGroupResult:
    """
    A collection of values returned by getSecurityGroup.
    """
    def __init__(__self__, external_sources=None, id=None, name=None):
        if external_sources and not isinstance(external_sources, list):
            raise TypeError("Expected argument 'external_sources' to be a list")
        pulumi.set(__self__, "external_sources", external_sources)
        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(name="externalSources")
    def external_sources(self) -> Sequence[str]:
        """
        The list of external network sources, in [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notatio) notation.
        """
        return pulumi.get(self, "external_sources")

    @property
    @pulumi.getter
    def id(self) -> Optional[str]:
        """
        The security group ID to match (conflicts with `name`)
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def name(self) -> Optional[str]:
        """
        The name to match (conflicts with `id`)
        """
        return pulumi.get(self, "name")


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


def get_security_group(id: Optional[str] = None,
                       name: Optional[str] = None,
                       opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetSecurityGroupResult:
    """
    Fetch Exoscale [Security Groups](https://community.exoscale.com/documentation/compute/security-groups/) data.

    Corresponding resource: exoscale_security_group.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_exoscale as exoscale

    my_security_group = exoscale.get_security_group(name="my-security-group")
    pulumi.export("mySecurityGroupId", my_security_group.id)
    ```

    Please refer to the examples
    directory for complete configuration examples.


    :param str id: The security group ID to match (conflicts with `name`)
    :param str name: The 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/getSecurityGroup:getSecurityGroup', __args__, opts=opts, typ=GetSecurityGroupResult).value

    return AwaitableGetSecurityGroupResult(
        external_sources=pulumi.get(__ret__, 'external_sources'),
        id=pulumi.get(__ret__, 'id'),
        name=pulumi.get(__ret__, 'name'))
def get_security_group_output(id: Optional[pulumi.Input[Optional[str]]] = None,
                              name: Optional[pulumi.Input[Optional[str]]] = None,
                              opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetSecurityGroupResult]:
    """
    Fetch Exoscale [Security Groups](https://community.exoscale.com/documentation/compute/security-groups/) data.

    Corresponding resource: exoscale_security_group.

    ## Example Usage

    ```python
    import pulumi
    import pulumi_exoscale as exoscale

    my_security_group = exoscale.get_security_group(name="my-security-group")
    pulumi.export("mySecurityGroupId", my_security_group.id)
    ```

    Please refer to the examples
    directory for complete configuration examples.


    :param str id: The security group ID to match (conflicts with `name`)
    :param str name: The name to match (conflicts with `id`)
    """
    __args__ = dict()
    __args__['id'] = id
    __args__['name'] = name
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('exoscale:index/getSecurityGroup:getSecurityGroup', __args__, opts=opts, typ=GetSecurityGroupResult)
    return __ret__.apply(lambda __response__: GetSecurityGroupResult(
        external_sources=pulumi.get(__response__, 'external_sources'),
        id=pulumi.get(__response__, 'id'),
        name=pulumi.get(__response__, 'name')))
