# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
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__ = ['GroupArgs', 'Group']

@pulumi.input_type
class GroupArgs:
    def __init__(__self__, *,
                 members: pulumi.Input[Sequence[pulumi.Input[_builtins.str]]],
                 type: pulumi.Input[_builtins.str],
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 site: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a Group resource.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] members: List of members in the group. The format depends on the group type:
                 * For address-group: IPv4 addresses or CIDR notation (e.g., ['192.168.1.10', '10.0.0.0/8'])
                 * For port-group: Port numbers or ranges (e.g., ['80', '443', '8000-8080'])
                 * For ipv6-address-group: IPv6 addresses or CIDR notation
        :param pulumi.Input[_builtins.str] type: The type of firewall group. Valid values are:
                 * `address-group` - Group of IPv4 addresses and/or networks (e.g., '192.168.1.10', '10.0.0.0/8')
                 * `port-group` - Group of ports or port ranges (e.g., '80', '443', '8000-8080')
                 * `ipv6-address-group` - Group of IPv6 addresses and/or networks
        :param pulumi.Input[_builtins.str] name: A friendly name for the firewall group to help identify its purpose (e.g., 'Trusted IPs' or 'Web Server Ports'). Must be unique within the site.
        :param pulumi.Input[_builtins.str] site: The name of the UniFi site where the firewall group should be created. If not specified, the default site will be used.
        """
        pulumi.set(__self__, "members", members)
        pulumi.set(__self__, "type", type)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if site is not None:
            pulumi.set(__self__, "site", site)

    @_builtins.property
    @pulumi.getter
    def members(self) -> pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]:
        """
        List of members in the group. The format depends on the group type:
          * For address-group: IPv4 addresses or CIDR notation (e.g., ['192.168.1.10', '10.0.0.0/8'])
          * For port-group: Port numbers or ranges (e.g., ['80', '443', '8000-8080'])
          * For ipv6-address-group: IPv6 addresses or CIDR notation
        """
        return pulumi.get(self, "members")

    @members.setter
    def members(self, value: pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]):
        pulumi.set(self, "members", value)

    @_builtins.property
    @pulumi.getter
    def type(self) -> pulumi.Input[_builtins.str]:
        """
        The type of firewall group. Valid values are:
          * `address-group` - Group of IPv4 addresses and/or networks (e.g., '192.168.1.10', '10.0.0.0/8')
          * `port-group` - Group of ports or port ranges (e.g., '80', '443', '8000-8080')
          * `ipv6-address-group` - Group of IPv6 addresses and/or networks
        """
        return pulumi.get(self, "type")

    @type.setter
    def type(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "type", value)

    @_builtins.property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        A friendly name for the firewall group to help identify its purpose (e.g., 'Trusted IPs' or 'Web Server Ports'). Must be unique within the site.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "name", value)

    @_builtins.property
    @pulumi.getter
    def site(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The name of the UniFi site where the firewall group should be created. If not specified, the default site will be used.
        """
        return pulumi.get(self, "site")

    @site.setter
    def site(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "site", value)


@pulumi.input_type
class _GroupState:
    def __init__(__self__, *,
                 members: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 site: Optional[pulumi.Input[_builtins.str]] = None,
                 type: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering Group resources.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] members: List of members in the group. The format depends on the group type:
                 * For address-group: IPv4 addresses or CIDR notation (e.g., ['192.168.1.10', '10.0.0.0/8'])
                 * For port-group: Port numbers or ranges (e.g., ['80', '443', '8000-8080'])
                 * For ipv6-address-group: IPv6 addresses or CIDR notation
        :param pulumi.Input[_builtins.str] name: A friendly name for the firewall group to help identify its purpose (e.g., 'Trusted IPs' or 'Web Server Ports'). Must be unique within the site.
        :param pulumi.Input[_builtins.str] site: The name of the UniFi site where the firewall group should be created. If not specified, the default site will be used.
        :param pulumi.Input[_builtins.str] type: The type of firewall group. Valid values are:
                 * `address-group` - Group of IPv4 addresses and/or networks (e.g., '192.168.1.10', '10.0.0.0/8')
                 * `port-group` - Group of ports or port ranges (e.g., '80', '443', '8000-8080')
                 * `ipv6-address-group` - Group of IPv6 addresses and/or networks
        """
        if members is not None:
            pulumi.set(__self__, "members", members)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if site is not None:
            pulumi.set(__self__, "site", site)
        if type is not None:
            pulumi.set(__self__, "type", type)

    @_builtins.property
    @pulumi.getter
    def members(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]]:
        """
        List of members in the group. The format depends on the group type:
          * For address-group: IPv4 addresses or CIDR notation (e.g., ['192.168.1.10', '10.0.0.0/8'])
          * For port-group: Port numbers or ranges (e.g., ['80', '443', '8000-8080'])
          * For ipv6-address-group: IPv6 addresses or CIDR notation
        """
        return pulumi.get(self, "members")

    @members.setter
    def members(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]]):
        pulumi.set(self, "members", value)

    @_builtins.property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        A friendly name for the firewall group to help identify its purpose (e.g., 'Trusted IPs' or 'Web Server Ports'). Must be unique within the site.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "name", value)

    @_builtins.property
    @pulumi.getter
    def site(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The name of the UniFi site where the firewall group should be created. If not specified, the default site will be used.
        """
        return pulumi.get(self, "site")

    @site.setter
    def site(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "site", value)

    @_builtins.property
    @pulumi.getter
    def type(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The type of firewall group. Valid values are:
          * `address-group` - Group of IPv4 addresses and/or networks (e.g., '192.168.1.10', '10.0.0.0/8')
          * `port-group` - Group of ports or port ranges (e.g., '80', '443', '8000-8080')
          * `ipv6-address-group` - Group of IPv6 addresses and/or networks
        """
        return pulumi.get(self, "type")

    @type.setter
    def type(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "type", value)


@pulumi.type_token("unifi:firewall/group:Group")
class Group(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 members: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 site: Optional[pulumi.Input[_builtins.str]] = None,
                 type: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        The `firewall.Group` resource manages reusable groups of addresses or ports that can be referenced in firewall rules (`firewall.Rule`).

        Firewall groups help organize and simplify firewall rule management by allowing you to:
          * Create collections of IP addresses or networks
          * Define sets of ports for specific services
          * Group IPv6 addresses for IPv6-specific rules

        Common use cases include:
          * Creating groups of trusted IP addresses
          * Defining port groups for specific applications
          * Managing access control lists
          * Simplifying rule maintenance by using groups instead of individual IPs/ports

        ## Example Usage

        ```python
        import pulumi
        import pulumiverse_unifi as unifi

        config = pulumi.Config()
        laptop_ips = config.require_object("laptopIps")
        can_print = unifi.firewall.Group("can_print",
            name="can-print",
            type="address-group",
            members=laptop_ips)
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] members: List of members in the group. The format depends on the group type:
                 * For address-group: IPv4 addresses or CIDR notation (e.g., ['192.168.1.10', '10.0.0.0/8'])
                 * For port-group: Port numbers or ranges (e.g., ['80', '443', '8000-8080'])
                 * For ipv6-address-group: IPv6 addresses or CIDR notation
        :param pulumi.Input[_builtins.str] name: A friendly name for the firewall group to help identify its purpose (e.g., 'Trusted IPs' or 'Web Server Ports'). Must be unique within the site.
        :param pulumi.Input[_builtins.str] site: The name of the UniFi site where the firewall group should be created. If not specified, the default site will be used.
        :param pulumi.Input[_builtins.str] type: The type of firewall group. Valid values are:
                 * `address-group` - Group of IPv4 addresses and/or networks (e.g., '192.168.1.10', '10.0.0.0/8')
                 * `port-group` - Group of ports or port ranges (e.g., '80', '443', '8000-8080')
                 * `ipv6-address-group` - Group of IPv6 addresses and/or networks
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: GroupArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        The `firewall.Group` resource manages reusable groups of addresses or ports that can be referenced in firewall rules (`firewall.Rule`).

        Firewall groups help organize and simplify firewall rule management by allowing you to:
          * Create collections of IP addresses or networks
          * Define sets of ports for specific services
          * Group IPv6 addresses for IPv6-specific rules

        Common use cases include:
          * Creating groups of trusted IP addresses
          * Defining port groups for specific applications
          * Managing access control lists
          * Simplifying rule maintenance by using groups instead of individual IPs/ports

        ## Example Usage

        ```python
        import pulumi
        import pulumiverse_unifi as unifi

        config = pulumi.Config()
        laptop_ips = config.require_object("laptopIps")
        can_print = unifi.firewall.Group("can_print",
            name="can-print",
            type="address-group",
            members=laptop_ips)
        ```

        :param str resource_name: The name of the resource.
        :param GroupArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(GroupArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 members: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
                 name: Optional[pulumi.Input[_builtins.str]] = None,
                 site: Optional[pulumi.Input[_builtins.str]] = None,
                 type: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = GroupArgs.__new__(GroupArgs)

            if members is None and not opts.urn:
                raise TypeError("Missing required property 'members'")
            __props__.__dict__["members"] = members
            __props__.__dict__["name"] = name
            __props__.__dict__["site"] = site
            if type is None and not opts.urn:
                raise TypeError("Missing required property 'type'")
            __props__.__dict__["type"] = type
        super(Group, __self__).__init__(
            'unifi:firewall/group:Group',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            members: Optional[pulumi.Input[Sequence[pulumi.Input[_builtins.str]]]] = None,
            name: Optional[pulumi.Input[_builtins.str]] = None,
            site: Optional[pulumi.Input[_builtins.str]] = None,
            type: Optional[pulumi.Input[_builtins.str]] = None) -> 'Group':
        """
        Get an existing Group resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Sequence[pulumi.Input[_builtins.str]]] members: List of members in the group. The format depends on the group type:
                 * For address-group: IPv4 addresses or CIDR notation (e.g., ['192.168.1.10', '10.0.0.0/8'])
                 * For port-group: Port numbers or ranges (e.g., ['80', '443', '8000-8080'])
                 * For ipv6-address-group: IPv6 addresses or CIDR notation
        :param pulumi.Input[_builtins.str] name: A friendly name for the firewall group to help identify its purpose (e.g., 'Trusted IPs' or 'Web Server Ports'). Must be unique within the site.
        :param pulumi.Input[_builtins.str] site: The name of the UniFi site where the firewall group should be created. If not specified, the default site will be used.
        :param pulumi.Input[_builtins.str] type: The type of firewall group. Valid values are:
                 * `address-group` - Group of IPv4 addresses and/or networks (e.g., '192.168.1.10', '10.0.0.0/8')
                 * `port-group` - Group of ports or port ranges (e.g., '80', '443', '8000-8080')
                 * `ipv6-address-group` - Group of IPv6 addresses and/or networks
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _GroupState.__new__(_GroupState)

        __props__.__dict__["members"] = members
        __props__.__dict__["name"] = name
        __props__.__dict__["site"] = site
        __props__.__dict__["type"] = type
        return Group(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter
    def members(self) -> pulumi.Output[Sequence[_builtins.str]]:
        """
        List of members in the group. The format depends on the group type:
          * For address-group: IPv4 addresses or CIDR notation (e.g., ['192.168.1.10', '10.0.0.0/8'])
          * For port-group: Port numbers or ranges (e.g., ['80', '443', '8000-8080'])
          * For ipv6-address-group: IPv6 addresses or CIDR notation
        """
        return pulumi.get(self, "members")

    @_builtins.property
    @pulumi.getter
    def name(self) -> pulumi.Output[_builtins.str]:
        """
        A friendly name for the firewall group to help identify its purpose (e.g., 'Trusted IPs' or 'Web Server Ports'). Must be unique within the site.
        """
        return pulumi.get(self, "name")

    @_builtins.property
    @pulumi.getter
    def site(self) -> pulumi.Output[_builtins.str]:
        """
        The name of the UniFi site where the firewall group should be created. If not specified, the default site will be used.
        """
        return pulumi.get(self, "site")

    @_builtins.property
    @pulumi.getter
    def type(self) -> pulumi.Output[_builtins.str]:
        """
        The type of firewall group. Valid values are:
          * `address-group` - Group of IPv4 addresses and/or networks (e.g., '192.168.1.10', '10.0.0.0/8')
          * `port-group` - Group of ports or port ranges (e.g., '80', '443', '8000-8080')
          * `ipv6-address-group` - Group of IPv6 addresses and/or networks
        """
        return pulumi.get(self, "type")

