# 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 pulumi
import pulumi.runtime

class SubnetPool(pulumi.CustomResource):
    """
    Manages a V2 Neutron subnetpool resource within OpenStack.
    """
    def __init__(__self__, __name__, __opts__=None, address_scope_id=None, default_prefixlen=None, default_quota=None, description=None, ip_version=None, is_default=None, max_prefixlen=None, min_prefixlen=None, name=None, prefixes=None, project_id=None, region=None, shared=None, value_specs=None):
        """Create a SubnetPool resource with the given unique name, props, and options."""
        if not __name__:
            raise TypeError('Missing resource name argument (for URN creation)')
        if not isinstance(__name__, basestring):
            raise TypeError('Expected resource name to be a string')
        if __opts__ and not isinstance(__opts__, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')

        __props__ = dict()

        if address_scope_id and not isinstance(address_scope_id, basestring):
            raise TypeError('Expected property address_scope_id to be a basestring')
        __self__.address_scope_id = address_scope_id
        """
        The Neutron address scope to assign to the
        subnetpool. Changing this updates the address scope id of the existing
        subnetpool.
        """
        __props__['addressScopeId'] = address_scope_id

        if default_prefixlen and not isinstance(default_prefixlen, int):
            raise TypeError('Expected property default_prefixlen to be a int')
        __self__.default_prefixlen = default_prefixlen
        """
        The size of the prefix to allocate when the cidr
        or prefixlen attributes are omitted when you create the subnet. Defaults to the
        MinPrefixLen. Changing this updates the default prefixlen of the existing
        subnetpool.
        """
        __props__['defaultPrefixlen'] = default_prefixlen

        if default_quota and not isinstance(default_quota, int):
            raise TypeError('Expected property default_quota to be a int')
        __self__.default_quota = default_quota
        """
        The per-project quota on the prefix space that can be
        allocated from the subnetpool for project subnets. Changing this updates the
        default quota of the existing subnetpool.
        """
        __props__['defaultQuota'] = default_quota

        if description and not isinstance(description, basestring):
            raise TypeError('Expected property description to be a basestring')
        __self__.description = description
        """
        The human-readable description for the subnetpool.
        Changing this updates the description of the existing subnetpool.
        """
        __props__['description'] = description

        if ip_version and not isinstance(ip_version, int):
            raise TypeError('Expected property ip_version to be a int')
        __self__.ip_version = ip_version
        """
        The IP protocol version.
        """
        __props__['ipVersion'] = ip_version

        if is_default and not isinstance(is_default, bool):
            raise TypeError('Expected property is_default to be a bool')
        __self__.is_default = is_default
        """
        Indicates whether the subnetpool is default
        subnetpool or not. Changing this updates the default status of the existing
        subnetpool.
        """
        __props__['isDefault'] = is_default

        if max_prefixlen and not isinstance(max_prefixlen, int):
            raise TypeError('Expected property max_prefixlen to be a int')
        __self__.max_prefixlen = max_prefixlen
        """
        The maximum prefix size that can be allocated from
        the subnetpool. For IPv4 subnetpools, default is 32. For IPv6 subnetpools,
        default is 128. Changing this updates the max prefixlen of the existing
        subnetpool.
        """
        __props__['maxPrefixlen'] = max_prefixlen

        if min_prefixlen and not isinstance(min_prefixlen, int):
            raise TypeError('Expected property min_prefixlen to be a int')
        __self__.min_prefixlen = min_prefixlen
        """
        The smallest prefix that can be allocated from a
        subnetpool. For IPv4 subnetpools, default is 8. For IPv6 subnetpools, default
        is 64. Changing this updates the min prefixlen of the existing subnetpool.
        """
        __props__['minPrefixlen'] = min_prefixlen

        if name and not isinstance(name, basestring):
            raise TypeError('Expected property name to be a basestring')
        __self__.name = name
        """
        The name of the subnetpool. Changing this updates the name of
        the existing subnetpool.
        """
        __props__['name'] = name

        if not prefixes:
            raise TypeError('Missing required property prefixes')
        elif not isinstance(prefixes, list):
            raise TypeError('Expected property prefixes to be a list')
        __self__.prefixes = prefixes
        """
        A list of subnet prefixes to assign to the subnetpool.
        Neutron API merges adjacent prefixes and treats them as a single prefix. Each
        subnet prefix must be unique among all subnet prefixes in all subnetpools that
        are associated with the address scope. Changing this updates the prefixes list
        of the existing subnetpool.
        """
        __props__['prefixes'] = prefixes

        if project_id and not isinstance(project_id, basestring):
            raise TypeError('Expected property project_id to be a basestring')
        __self__.project_id = project_id
        """
        The owner of the subnetpool. Required if admin wants to
        create a subnetpool for another project. Changing this creates a new subnetpool.
        """
        __props__['projectId'] = project_id

        if region and not isinstance(region, basestring):
            raise TypeError('Expected property region to be a basestring')
        __self__.region = region
        """
        The region in which to obtain the V2 Networking client.
        A Networking client is needed to create a Neutron subnetpool. If omitted, the
        `region` argument of the provider is used. Changing this creates a new
        subnetpool.
        """
        __props__['region'] = region

        if shared and not isinstance(shared, bool):
            raise TypeError('Expected property shared to be a bool')
        __self__.shared = shared
        """
        Indicates whether this subnetpool is shared across
        all projects. Changing this updates the shared status of the existing
        subnetpool.
        """
        __props__['shared'] = shared

        if value_specs and not isinstance(value_specs, dict):
            raise TypeError('Expected property value_specs to be a dict')
        __self__.value_specs = value_specs
        """
        Map of additional options.
        """
        __props__['valueSpecs'] = value_specs

        __self__.created_at = pulumi.runtime.UNKNOWN
        """
        The time at which subnetpool was created.
        """
        __self__.revision_number = pulumi.runtime.UNKNOWN
        """
        The revision number of the subnetpool.
        """
        __self__.updated_at = pulumi.runtime.UNKNOWN
        """
        The time at which subnetpool was created.
        """

        super(SubnetPool, __self__).__init__(
            'openstack:networking/subnetPool:SubnetPool',
            __name__,
            __props__,
            __opts__)

    def set_outputs(self, outs):
        if 'addressScopeId' in outs:
            self.address_scope_id = outs['addressScopeId']
        if 'createdAt' in outs:
            self.created_at = outs['createdAt']
        if 'defaultPrefixlen' in outs:
            self.default_prefixlen = outs['defaultPrefixlen']
        if 'defaultQuota' in outs:
            self.default_quota = outs['defaultQuota']
        if 'description' in outs:
            self.description = outs['description']
        if 'ipVersion' in outs:
            self.ip_version = outs['ipVersion']
        if 'isDefault' in outs:
            self.is_default = outs['isDefault']
        if 'maxPrefixlen' in outs:
            self.max_prefixlen = outs['maxPrefixlen']
        if 'minPrefixlen' in outs:
            self.min_prefixlen = outs['minPrefixlen']
        if 'name' in outs:
            self.name = outs['name']
        if 'prefixes' in outs:
            self.prefixes = outs['prefixes']
        if 'projectId' in outs:
            self.project_id = outs['projectId']
        if 'region' in outs:
            self.region = outs['region']
        if 'revisionNumber' in outs:
            self.revision_number = outs['revisionNumber']
        if 'shared' in outs:
            self.shared = outs['shared']
        if 'updatedAt' in outs:
            self.updated_at = outs['updatedAt']
        if 'valueSpecs' in outs:
            self.value_specs = outs['valueSpecs']
