# 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__ = ['AllowListArgs', 'AllowList']

@pulumi.input_type
class AllowListArgs:
    def __init__(__self__, *,
                 cidr_ip: pulumi.Input[str],
                 cidr_mask: pulumi.Input[int],
                 cluster_id: pulumi.Input[str],
                 sql: pulumi.Input[bool],
                 ui: pulumi.Input[bool],
                 name: Optional[pulumi.Input[str]] = None):
        """
        The set of arguments for constructing a AllowList resource.
        :param pulumi.Input[str] cidr_ip: IP address component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[int] cidr_mask: Map component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[bool] sql: Set to 'true' to allow SQL connections from this CIDR range.
        :param pulumi.Input[bool] ui: Set to 'true' to allow access to the management console from this CIDR range.
        :param pulumi.Input[str] name: Name of this allowlist entry.
        """
        pulumi.set(__self__, "cidr_ip", cidr_ip)
        pulumi.set(__self__, "cidr_mask", cidr_mask)
        pulumi.set(__self__, "cluster_id", cluster_id)
        pulumi.set(__self__, "sql", sql)
        pulumi.set(__self__, "ui", ui)
        if name is not None:
            pulumi.set(__self__, "name", name)

    @property
    @pulumi.getter(name="cidrIp")
    def cidr_ip(self) -> pulumi.Input[str]:
        """
        IP address component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        """
        return pulumi.get(self, "cidr_ip")

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

    @property
    @pulumi.getter(name="cidrMask")
    def cidr_mask(self) -> pulumi.Input[int]:
        """
        Map component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        """
        return pulumi.get(self, "cidr_mask")

    @cidr_mask.setter
    def cidr_mask(self, value: pulumi.Input[int]):
        pulumi.set(self, "cidr_mask", value)

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

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

    @property
    @pulumi.getter
    def sql(self) -> pulumi.Input[bool]:
        """
        Set to 'true' to allow SQL connections from this CIDR range.
        """
        return pulumi.get(self, "sql")

    @sql.setter
    def sql(self, value: pulumi.Input[bool]):
        pulumi.set(self, "sql", value)

    @property
    @pulumi.getter
    def ui(self) -> pulumi.Input[bool]:
        """
        Set to 'true' to allow access to the management console from this CIDR range.
        """
        return pulumi.get(self, "ui")

    @ui.setter
    def ui(self, value: pulumi.Input[bool]):
        pulumi.set(self, "ui", value)

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        Name of this allowlist entry.
        """
        return pulumi.get(self, "name")

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


@pulumi.input_type
class _AllowListState:
    def __init__(__self__, *,
                 cidr_ip: Optional[pulumi.Input[str]] = None,
                 cidr_mask: Optional[pulumi.Input[int]] = None,
                 cluster_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 sql: Optional[pulumi.Input[bool]] = None,
                 ui: Optional[pulumi.Input[bool]] = None):
        """
        Input properties used for looking up and filtering AllowList resources.
        :param pulumi.Input[str] cidr_ip: IP address component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[int] cidr_mask: Map component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[str] name: Name of this allowlist entry.
        :param pulumi.Input[bool] sql: Set to 'true' to allow SQL connections from this CIDR range.
        :param pulumi.Input[bool] ui: Set to 'true' to allow access to the management console from this CIDR range.
        """
        if cidr_ip is not None:
            pulumi.set(__self__, "cidr_ip", cidr_ip)
        if cidr_mask is not None:
            pulumi.set(__self__, "cidr_mask", cidr_mask)
        if cluster_id is not None:
            pulumi.set(__self__, "cluster_id", cluster_id)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if sql is not None:
            pulumi.set(__self__, "sql", sql)
        if ui is not None:
            pulumi.set(__self__, "ui", ui)

    @property
    @pulumi.getter(name="cidrIp")
    def cidr_ip(self) -> Optional[pulumi.Input[str]]:
        """
        IP address component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        """
        return pulumi.get(self, "cidr_ip")

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

    @property
    @pulumi.getter(name="cidrMask")
    def cidr_mask(self) -> Optional[pulumi.Input[int]]:
        """
        Map component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        """
        return pulumi.get(self, "cidr_mask")

    @cidr_mask.setter
    def cidr_mask(self, value: Optional[pulumi.Input[int]]):
        pulumi.set(self, "cidr_mask", value)

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

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

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        Name of this allowlist entry.
        """
        return pulumi.get(self, "name")

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

    @property
    @pulumi.getter
    def sql(self) -> Optional[pulumi.Input[bool]]:
        """
        Set to 'true' to allow SQL connections from this CIDR range.
        """
        return pulumi.get(self, "sql")

    @sql.setter
    def sql(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "sql", value)

    @property
    @pulumi.getter
    def ui(self) -> Optional[pulumi.Input[bool]]:
        """
        Set to 'true' to allow access to the management console from this CIDR range.
        """
        return pulumi.get(self, "ui")

    @ui.setter
    def ui(self, value: Optional[pulumi.Input[bool]]):
        pulumi.set(self, "ui", value)


class AllowList(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 cidr_ip: Optional[pulumi.Input[str]] = None,
                 cidr_mask: Optional[pulumi.Input[int]] = None,
                 cluster_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 sql: Optional[pulumi.Input[bool]] = None,
                 ui: Optional[pulumi.Input[bool]] = None,
                 __props__=None):
        """
        List of IP ranges allowed to access the cluster.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] cidr_ip: IP address component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[int] cidr_mask: Map component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[str] name: Name of this allowlist entry.
        :param pulumi.Input[bool] sql: Set to 'true' to allow SQL connections from this CIDR range.
        :param pulumi.Input[bool] ui: Set to 'true' to allow access to the management console from this CIDR range.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: AllowListArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        List of IP ranges allowed to access the cluster.

        :param str resource_name: The name of the resource.
        :param AllowListArgs 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(AllowListArgs, 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,
                 cidr_ip: Optional[pulumi.Input[str]] = None,
                 cidr_mask: Optional[pulumi.Input[int]] = None,
                 cluster_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 sql: Optional[pulumi.Input[bool]] = None,
                 ui: Optional[pulumi.Input[bool]] = 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__ = AllowListArgs.__new__(AllowListArgs)

            if cidr_ip is None and not opts.urn:
                raise TypeError("Missing required property 'cidr_ip'")
            __props__.__dict__["cidr_ip"] = cidr_ip
            if cidr_mask is None and not opts.urn:
                raise TypeError("Missing required property 'cidr_mask'")
            __props__.__dict__["cidr_mask"] = cidr_mask
            if cluster_id is None and not opts.urn:
                raise TypeError("Missing required property 'cluster_id'")
            __props__.__dict__["cluster_id"] = cluster_id
            __props__.__dict__["name"] = name
            if sql is None and not opts.urn:
                raise TypeError("Missing required property 'sql'")
            __props__.__dict__["sql"] = sql
            if ui is None and not opts.urn:
                raise TypeError("Missing required property 'ui'")
            __props__.__dict__["ui"] = ui
        super(AllowList, __self__).__init__(
            'cockroach:index/allowList:AllowList',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            cidr_ip: Optional[pulumi.Input[str]] = None,
            cidr_mask: Optional[pulumi.Input[int]] = None,
            cluster_id: Optional[pulumi.Input[str]] = None,
            name: Optional[pulumi.Input[str]] = None,
            sql: Optional[pulumi.Input[bool]] = None,
            ui: Optional[pulumi.Input[bool]] = None) -> 'AllowList':
        """
        Get an existing AllowList 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[str] cidr_ip: IP address component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[int] cidr_mask: Map component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        :param pulumi.Input[str] name: Name of this allowlist entry.
        :param pulumi.Input[bool] sql: Set to 'true' to allow SQL connections from this CIDR range.
        :param pulumi.Input[bool] ui: Set to 'true' to allow access to the management console from this CIDR range.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _AllowListState.__new__(_AllowListState)

        __props__.__dict__["cidr_ip"] = cidr_ip
        __props__.__dict__["cidr_mask"] = cidr_mask
        __props__.__dict__["cluster_id"] = cluster_id
        __props__.__dict__["name"] = name
        __props__.__dict__["sql"] = sql
        __props__.__dict__["ui"] = ui
        return AllowList(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="cidrIp")
    def cidr_ip(self) -> pulumi.Output[str]:
        """
        IP address component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        """
        return pulumi.get(self, "cidr_ip")

    @property
    @pulumi.getter(name="cidrMask")
    def cidr_mask(self) -> pulumi.Output[int]:
        """
        Map component of the [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation) range for this entry.
        """
        return pulumi.get(self, "cidr_mask")

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

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[Optional[str]]:
        """
        Name of this allowlist entry.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter
    def sql(self) -> pulumi.Output[bool]:
        """
        Set to 'true' to allow SQL connections from this CIDR range.
        """
        return pulumi.get(self, "sql")

    @property
    @pulumi.getter
    def ui(self) -> pulumi.Output[bool]:
        """
        Set to 'true' to allow access to the management console from this CIDR range.
        """
        return pulumi.get(self, "ui")

