# 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

__all__ = ['InstanceIp']


class InstanceIp(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 linode_id: Optional[pulumi.Input[int]] = None,
                 public: Optional[pulumi.Input[bool]] = None,
                 rdns: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        > **NOTICE:** You may need to contact support to increase your instance IP limit before you can allocate additional IPs.

        Manages a Linode instance IP.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_linode as linode

        foo_instance = linode.Instance("fooInstance",
            image="linode/alpine3.12",
            label="foobar-test",
            type="g6-nanode-1",
            region="us-east")
        foo_instance_ip = linode.InstanceIp("fooInstanceIp",
            linode_id=foo_instance.id,
            public=True)
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[int] linode_id: The ID of the Linode to allocate an IPv4 address for.
        :param pulumi.Input[bool] public: Whether the IPv4 address is public or private. Defaults to true.
        :param pulumi.Input[str] rdns: The reverse DNS assigned to this address.
        """
        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 linode_id is None and not opts.urn:
                raise TypeError("Missing required property 'linode_id'")
            __props__['linode_id'] = linode_id
            __props__['public'] = public
            __props__['rdns'] = rdns
            __props__['address'] = None
            __props__['gateway'] = None
            __props__['prefix'] = None
            __props__['region'] = None
            __props__['subnet_mask'] = None
            __props__['type'] = None
        super(InstanceIp, __self__).__init__(
            'linode:index/instanceIp:InstanceIp',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            address: Optional[pulumi.Input[str]] = None,
            gateway: Optional[pulumi.Input[str]] = None,
            linode_id: Optional[pulumi.Input[int]] = None,
            prefix: Optional[pulumi.Input[int]] = None,
            public: Optional[pulumi.Input[bool]] = None,
            rdns: Optional[pulumi.Input[str]] = None,
            region: Optional[pulumi.Input[str]] = None,
            subnet_mask: Optional[pulumi.Input[str]] = None,
            type: Optional[pulumi.Input[str]] = None) -> 'InstanceIp':
        """
        Get an existing InstanceIp 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: The resulting IPv4 address.
        :param pulumi.Input[str] gateway: The default gateway for this address
        :param pulumi.Input[int] linode_id: The ID of the Linode to allocate an IPv4 address for.
        :param pulumi.Input[int] prefix: The number of bits set in the subnet mask.
        :param pulumi.Input[bool] public: Whether the IPv4 address is public or private. Defaults to true.
        :param pulumi.Input[str] rdns: The reverse DNS assigned to this address.
        :param pulumi.Input[str] region: The region this IP resides in.
        :param pulumi.Input[str] subnet_mask: The mask that separates host bits from network bits for this address.
        :param pulumi.Input[str] type: The type of IP address.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["address"] = address
        __props__["gateway"] = gateway
        __props__["linode_id"] = linode_id
        __props__["prefix"] = prefix
        __props__["public"] = public
        __props__["rdns"] = rdns
        __props__["region"] = region
        __props__["subnet_mask"] = subnet_mask
        __props__["type"] = type
        return InstanceIp(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def address(self) -> pulumi.Output[str]:
        """
        The resulting IPv4 address.
        """
        return pulumi.get(self, "address")

    @property
    @pulumi.getter
    def gateway(self) -> pulumi.Output[str]:
        """
        The default gateway for this address
        """
        return pulumi.get(self, "gateway")

    @property
    @pulumi.getter(name="linodeId")
    def linode_id(self) -> pulumi.Output[int]:
        """
        The ID of the Linode to allocate an IPv4 address for.
        """
        return pulumi.get(self, "linode_id")

    @property
    @pulumi.getter
    def prefix(self) -> pulumi.Output[int]:
        """
        The number of bits set in the subnet mask.
        """
        return pulumi.get(self, "prefix")

    @property
    @pulumi.getter
    def public(self) -> pulumi.Output[Optional[bool]]:
        """
        Whether the IPv4 address is public or private. Defaults to true.
        """
        return pulumi.get(self, "public")

    @property
    @pulumi.getter
    def rdns(self) -> pulumi.Output[str]:
        """
        The reverse DNS assigned to this address.
        """
        return pulumi.get(self, "rdns")

    @property
    @pulumi.getter
    def region(self) -> pulumi.Output[str]:
        """
        The region this IP resides in.
        """
        return pulumi.get(self, "region")

    @property
    @pulumi.getter(name="subnetMask")
    def subnet_mask(self) -> pulumi.Output[str]:
        """
        The mask that separates host bits from network bits for this address.
        """
        return pulumi.get(self, "subnet_mask")

    @property
    @pulumi.getter
    def type(self) -> pulumi.Output[str]:
        """
        The type of IP address.
        """
        return pulumi.get(self, "type")

    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

