# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
from . import outputs
from ._inputs import *

__all__ = ['ManagedPrefixList']


class ManagedPrefixList(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 address_family: Optional[pulumi.Input[str]] = None,
                 entries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ManagedPrefixListEntryArgs']]]]] = None,
                 max_entries: Optional[pulumi.Input[int]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides a managed prefix list resource.

        > **NOTE on `max_entries`:** When you reference a Prefix List in a resource,
        the maximum number of entries for the prefix lists counts as the same number of rules
        or entries for the resource. For example, if you create a prefix list with a maximum
        of 20 entries and you reference that prefix list in a security group rule, this counts
        as 20 rules for the security group.

        ## Example Usage

        Basic usage

        ```python
        import pulumi
        import pulumi_aws as aws

        example = aws.ec2.ManagedPrefixList("example",
            address_family="IPv4",
            max_entries=5,
            entries=[
                aws.ec2.ManagedPrefixListEntryArgs(
                    cidr=aws_vpc["example"]["cidr_block"],
                    description="Primary",
                ),
                aws.ec2.ManagedPrefixListEntryArgs(
                    cidr=aws_vpc_ipv4_cidr_block_association["example"]["cidr_block"],
                    description="Secondary",
                ),
            ],
            tags={
                "Env": "live",
            })
        ```

        ## Import

        Prefix Lists can be imported using the `id`, e.g.

        ```sh
         $ pulumi import aws:ec2/managedPrefixList:ManagedPrefixList default pl-0570a1d2d725c16be
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] address_family: The address family (`IPv4` or `IPv6`) of
               this prefix list.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ManagedPrefixListEntryArgs']]]] entries: Can be specified multiple times for each prefix list entry.
               Each entry block supports fields documented below. Different entries may have
               overlapping CIDR blocks, but a particular CIDR should not be duplicated.
        :param pulumi.Input[int] max_entries: The maximum number of entries that
               this prefix list can contain.
        :param pulumi.Input[str] name: The name of this resource. The name must not start with `com.amazonaws`.
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to this resource.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        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__ = dict()

            if address_family is None and not opts.urn:
                raise TypeError("Missing required property 'address_family'")
            __props__['address_family'] = address_family
            __props__['entries'] = entries
            if max_entries is None and not opts.urn:
                raise TypeError("Missing required property 'max_entries'")
            __props__['max_entries'] = max_entries
            __props__['name'] = name
            __props__['tags'] = tags
            __props__['arn'] = None
            __props__['owner_id'] = None
            __props__['version'] = None
        super(ManagedPrefixList, __self__).__init__(
            'aws:ec2/managedPrefixList:ManagedPrefixList',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            address_family: Optional[pulumi.Input[str]] = None,
            arn: Optional[pulumi.Input[str]] = None,
            entries: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ManagedPrefixListEntryArgs']]]]] = None,
            max_entries: Optional[pulumi.Input[int]] = None,
            name: Optional[pulumi.Input[str]] = None,
            owner_id: Optional[pulumi.Input[str]] = None,
            tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
            version: Optional[pulumi.Input[int]] = None) -> 'ManagedPrefixList':
        """
        Get an existing ManagedPrefixList 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] address_family: The address family (`IPv4` or `IPv6`) of
               this prefix list.
        :param pulumi.Input[str] arn: The ARN of the prefix list.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ManagedPrefixListEntryArgs']]]] entries: Can be specified multiple times for each prefix list entry.
               Each entry block supports fields documented below. Different entries may have
               overlapping CIDR blocks, but a particular CIDR should not be duplicated.
        :param pulumi.Input[int] max_entries: The maximum number of entries that
               this prefix list can contain.
        :param pulumi.Input[str] name: The name of this resource. The name must not start with `com.amazonaws`.
        :param pulumi.Input[str] owner_id: The ID of the AWS account that owns this prefix list.
        :param pulumi.Input[Mapping[str, pulumi.Input[str]]] tags: A map of tags to assign to this resource.
        :param pulumi.Input[int] version: The latest version of this prefix list.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["address_family"] = address_family
        __props__["arn"] = arn
        __props__["entries"] = entries
        __props__["max_entries"] = max_entries
        __props__["name"] = name
        __props__["owner_id"] = owner_id
        __props__["tags"] = tags
        __props__["version"] = version
        return ManagedPrefixList(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="addressFamily")
    def address_family(self) -> pulumi.Output[str]:
        """
        The address family (`IPv4` or `IPv6`) of
        this prefix list.
        """
        return pulumi.get(self, "address_family")

    @property
    @pulumi.getter
    def arn(self) -> pulumi.Output[str]:
        """
        The ARN of the prefix list.
        """
        return pulumi.get(self, "arn")

    @property
    @pulumi.getter
    def entries(self) -> pulumi.Output[Optional[Sequence['outputs.ManagedPrefixListEntry']]]:
        """
        Can be specified multiple times for each prefix list entry.
        Each entry block supports fields documented below. Different entries may have
        overlapping CIDR blocks, but a particular CIDR should not be duplicated.
        """
        return pulumi.get(self, "entries")

    @property
    @pulumi.getter(name="maxEntries")
    def max_entries(self) -> pulumi.Output[int]:
        """
        The maximum number of entries that
        this prefix list can contain.
        """
        return pulumi.get(self, "max_entries")

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        The name of this resource. The name must not start with `com.amazonaws`.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="ownerId")
    def owner_id(self) -> pulumi.Output[str]:
        """
        The ID of the AWS account that owns this prefix list.
        """
        return pulumi.get(self, "owner_id")

    @property
    @pulumi.getter
    def tags(self) -> pulumi.Output[Optional[Mapping[str, str]]]:
        """
        A map of tags to assign to this resource.
        """
        return pulumi.get(self, "tags")

    @property
    @pulumi.getter
    def version(self) -> pulumi.Output[int]:
        """
        The latest version of this prefix list.
        """
        return pulumi.get(self, "version")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

