# 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__ = [
    'GetPublicGatewayDhcpReservationResult',
    'AwaitableGetPublicGatewayDhcpReservationResult',
    'get_public_gateway_dhcp_reservation',
    'get_public_gateway_dhcp_reservation_output',
]

@pulumi.output_type
class GetPublicGatewayDhcpReservationResult:
    """
    A collection of values returned by getPublicGatewayDhcpReservation.
    """
    def __init__(__self__, created_at=None, gateway_network_id=None, hostname=None, id=None, ip_address=None, mac_address=None, reservation_id=None, type=None, updated_at=None, wait_for_dhcp=None, zone=None):
        if created_at and not isinstance(created_at, str):
            raise TypeError("Expected argument 'created_at' to be a str")
        pulumi.set(__self__, "created_at", created_at)
        if gateway_network_id and not isinstance(gateway_network_id, str):
            raise TypeError("Expected argument 'gateway_network_id' to be a str")
        pulumi.set(__self__, "gateway_network_id", gateway_network_id)
        if hostname and not isinstance(hostname, str):
            raise TypeError("Expected argument 'hostname' to be a str")
        pulumi.set(__self__, "hostname", hostname)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if ip_address and not isinstance(ip_address, str):
            raise TypeError("Expected argument 'ip_address' to be a str")
        pulumi.set(__self__, "ip_address", ip_address)
        if mac_address and not isinstance(mac_address, str):
            raise TypeError("Expected argument 'mac_address' to be a str")
        pulumi.set(__self__, "mac_address", mac_address)
        if reservation_id and not isinstance(reservation_id, str):
            raise TypeError("Expected argument 'reservation_id' to be a str")
        pulumi.set(__self__, "reservation_id", reservation_id)
        if type and not isinstance(type, str):
            raise TypeError("Expected argument 'type' to be a str")
        pulumi.set(__self__, "type", type)
        if updated_at and not isinstance(updated_at, str):
            raise TypeError("Expected argument 'updated_at' to be a str")
        pulumi.set(__self__, "updated_at", updated_at)
        if wait_for_dhcp and not isinstance(wait_for_dhcp, bool):
            raise TypeError("Expected argument 'wait_for_dhcp' to be a bool")
        pulumi.set(__self__, "wait_for_dhcp", wait_for_dhcp)
        if zone and not isinstance(zone, str):
            raise TypeError("Expected argument 'zone' to be a str")
        pulumi.set(__self__, "zone", zone)

    @_builtins.property
    @pulumi.getter(name="createdAt")
    def created_at(self) -> _builtins.str:
        return pulumi.get(self, "created_at")

    @_builtins.property
    @pulumi.getter(name="gatewayNetworkId")
    def gateway_network_id(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "gateway_network_id")

    @_builtins.property
    @pulumi.getter
    def hostname(self) -> _builtins.str:
        return pulumi.get(self, "hostname")

    @_builtins.property
    @pulumi.getter
    def id(self) -> _builtins.str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @_builtins.property
    @pulumi.getter(name="ipAddress")
    def ip_address(self) -> _builtins.str:
        return pulumi.get(self, "ip_address")

    @_builtins.property
    @pulumi.getter(name="macAddress")
    def mac_address(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "mac_address")

    @_builtins.property
    @pulumi.getter(name="reservationId")
    def reservation_id(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "reservation_id")

    @_builtins.property
    @pulumi.getter
    def type(self) -> _builtins.str:
        return pulumi.get(self, "type")

    @_builtins.property
    @pulumi.getter(name="updatedAt")
    def updated_at(self) -> _builtins.str:
        return pulumi.get(self, "updated_at")

    @_builtins.property
    @pulumi.getter(name="waitForDhcp")
    def wait_for_dhcp(self) -> Optional[_builtins.bool]:
        return pulumi.get(self, "wait_for_dhcp")

    @_builtins.property
    @pulumi.getter
    def zone(self) -> Optional[_builtins.str]:
        return pulumi.get(self, "zone")


class AwaitableGetPublicGatewayDhcpReservationResult(GetPublicGatewayDhcpReservationResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetPublicGatewayDhcpReservationResult(
            created_at=self.created_at,
            gateway_network_id=self.gateway_network_id,
            hostname=self.hostname,
            id=self.id,
            ip_address=self.ip_address,
            mac_address=self.mac_address,
            reservation_id=self.reservation_id,
            type=self.type,
            updated_at=self.updated_at,
            wait_for_dhcp=self.wait_for_dhcp,
            zone=self.zone)


def get_public_gateway_dhcp_reservation(gateway_network_id: Optional[_builtins.str] = None,
                                        mac_address: Optional[_builtins.str] = None,
                                        reservation_id: Optional[_builtins.str] = None,
                                        wait_for_dhcp: Optional[_builtins.bool] = None,
                                        zone: Optional[_builtins.str] = None,
                                        opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetPublicGatewayDhcpReservationResult:
    """
    > **Important:**  The data source `network.PublicGatewayDhcpReservation` has been deprecated and will no longer be supported.
    In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed.
    You can use IPAM to manage your IPs. For more information, please refer to the dedicated guide.

    Gets information about a DHCP entry. For further information, please see the
    [API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#path-dhcp-entries-list-dhcp-entries).

    ## Example Dynamic

    ```python
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway

    main = scaleway.network.PrivateNetwork("main")
    main_server = scaleway.instance.Server("main",
        image="ubuntu_jammy",
        type="DEV1-S",
        zone="fr-par-1")
    main_private_nic = scaleway.instance.PrivateNic("main",
        server_id=main_server.id,
        private_network_id=main.id)
    main_public_gateway_ip = scaleway.network.PublicGatewayIp("main")
    main_public_gateway_dhcp = scaleway.network.PublicGatewayDhcp("main", subnet="192.168.1.0/24")
    main_public_gateway = scaleway.network.PublicGateway("main",
        name="foobar",
        type="VPC-GW-S",
        ip_id=main_public_gateway_ip.id)
    main_gateway_network = scaleway.network.GatewayNetwork("main",
        gateway_id=main_public_gateway.id,
        private_network_id=main.id,
        dhcp_id=main_public_gateway_dhcp.id,
        cleanup_dhcp=True,
        enable_masquerade=True)
    ## Retrieve the dynamic entries generated by mac address & gateway network
    by_mac_address_and_gw_network = scaleway.network.get_public_gateway_dhcp_reservation_output(mac_address=main_private_nic.mac_address,
        gateway_network_id=main_gateway_network.id)
    ```

    ## Example Static and PAT Rule

    ```python
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway

    main = scaleway.network.PrivateNetwork("main")
    main_security_group = scaleway.instance.SecurityGroup("main",
        inbound_default_policy="drop",
        outbound_default_policy="accept",
        inbound_rules=[{
            "action": "accept",
            "port": 22,
        }])
    main_server = scaleway.instance.Server("main",
        image="ubuntu_jammy",
        type="DEV1-S",
        zone="fr-par-1",
        security_group_id=main_security_group.id)
    main_private_nic = scaleway.instance.PrivateNic("main",
        server_id=main_server.id,
        private_network_id=main.id)
    main_public_gateway_ip = scaleway.network.PublicGatewayIp("main")
    main_public_gateway_dhcp = scaleway.network.PublicGatewayDhcp("main", subnet="192.168.1.0/24")
    main_public_gateway = scaleway.network.PublicGateway("main",
        name="foobar",
        type="VPC-GW-S",
        ip_id=main_public_gateway_ip.id)
    main_gateway_network = scaleway.network.GatewayNetwork("main",
        gateway_id=main_public_gateway.id,
        private_network_id=main.id,
        dhcp_id=main_public_gateway_dhcp.id,
        cleanup_dhcp=True,
        enable_masquerade=True)
    main_public_gateway_dhcp_reservation = scaleway.network.PublicGatewayDhcpReservation("main",
        gateway_network_id=main_gateway_network.id,
        mac_address=main_private_nic.mac_address,
        ip_address="192.168.1.4")
    ### VPC PAT RULE
    main_public_gateway_pat_rule = scaleway.network.PublicGatewayPatRule("main",
        gateway_id=main_public_gateway.id,
        private_ip=main_public_gateway_dhcp_reservation.ip_address,
        private_port=22,
        public_port=2222,
        protocol="tcp")
    by_id = scaleway.network.get_public_gateway_dhcp_reservation_output(reservation_id=main_public_gateway_dhcp_reservation.id)
    ```


    :param _builtins.str gateway_network_id: The ID of the owning GatewayNetwork.
           
           > Only one of `reservation_id` or `mac_address` with `gateway_network_id` should be specified.
    :param _builtins.str mac_address: The MAC address of the reservation to retrieve.
    :param _builtins.str reservation_id: The ID of the reservation (DHCP entry) to retrieve.
    :param _builtins.bool wait_for_dhcp: Whether to wait for `mac_address` to exist in DHCP.
    :param _builtins.str zone: `zone`). The zone in which the reservation exists.
    """
    __args__ = dict()
    __args__['gatewayNetworkId'] = gateway_network_id
    __args__['macAddress'] = mac_address
    __args__['reservationId'] = reservation_id
    __args__['waitForDhcp'] = wait_for_dhcp
    __args__['zone'] = zone
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('scaleway:network/getPublicGatewayDhcpReservation:getPublicGatewayDhcpReservation', __args__, opts=opts, typ=GetPublicGatewayDhcpReservationResult).value

    return AwaitableGetPublicGatewayDhcpReservationResult(
        created_at=pulumi.get(__ret__, 'created_at'),
        gateway_network_id=pulumi.get(__ret__, 'gateway_network_id'),
        hostname=pulumi.get(__ret__, 'hostname'),
        id=pulumi.get(__ret__, 'id'),
        ip_address=pulumi.get(__ret__, 'ip_address'),
        mac_address=pulumi.get(__ret__, 'mac_address'),
        reservation_id=pulumi.get(__ret__, 'reservation_id'),
        type=pulumi.get(__ret__, 'type'),
        updated_at=pulumi.get(__ret__, 'updated_at'),
        wait_for_dhcp=pulumi.get(__ret__, 'wait_for_dhcp'),
        zone=pulumi.get(__ret__, 'zone'))
def get_public_gateway_dhcp_reservation_output(gateway_network_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                                               mac_address: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                                               reservation_id: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                                               wait_for_dhcp: Optional[pulumi.Input[Optional[_builtins.bool]]] = None,
                                               zone: Optional[pulumi.Input[Optional[_builtins.str]]] = None,
                                               opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetPublicGatewayDhcpReservationResult]:
    """
    > **Important:**  The data source `network.PublicGatewayDhcpReservation` has been deprecated and will no longer be supported.
    In 2023, DHCP functionality was moved from Public Gateways to Private Networks, DHCP resources are now no longer needed.
    You can use IPAM to manage your IPs. For more information, please refer to the dedicated guide.

    Gets information about a DHCP entry. For further information, please see the
    [API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#path-dhcp-entries-list-dhcp-entries).

    ## Example Dynamic

    ```python
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway

    main = scaleway.network.PrivateNetwork("main")
    main_server = scaleway.instance.Server("main",
        image="ubuntu_jammy",
        type="DEV1-S",
        zone="fr-par-1")
    main_private_nic = scaleway.instance.PrivateNic("main",
        server_id=main_server.id,
        private_network_id=main.id)
    main_public_gateway_ip = scaleway.network.PublicGatewayIp("main")
    main_public_gateway_dhcp = scaleway.network.PublicGatewayDhcp("main", subnet="192.168.1.0/24")
    main_public_gateway = scaleway.network.PublicGateway("main",
        name="foobar",
        type="VPC-GW-S",
        ip_id=main_public_gateway_ip.id)
    main_gateway_network = scaleway.network.GatewayNetwork("main",
        gateway_id=main_public_gateway.id,
        private_network_id=main.id,
        dhcp_id=main_public_gateway_dhcp.id,
        cleanup_dhcp=True,
        enable_masquerade=True)
    ## Retrieve the dynamic entries generated by mac address & gateway network
    by_mac_address_and_gw_network = scaleway.network.get_public_gateway_dhcp_reservation_output(mac_address=main_private_nic.mac_address,
        gateway_network_id=main_gateway_network.id)
    ```

    ## Example Static and PAT Rule

    ```python
    import pulumi
    import pulumi_scaleway as scaleway
    import pulumiverse_scaleway as scaleway

    main = scaleway.network.PrivateNetwork("main")
    main_security_group = scaleway.instance.SecurityGroup("main",
        inbound_default_policy="drop",
        outbound_default_policy="accept",
        inbound_rules=[{
            "action": "accept",
            "port": 22,
        }])
    main_server = scaleway.instance.Server("main",
        image="ubuntu_jammy",
        type="DEV1-S",
        zone="fr-par-1",
        security_group_id=main_security_group.id)
    main_private_nic = scaleway.instance.PrivateNic("main",
        server_id=main_server.id,
        private_network_id=main.id)
    main_public_gateway_ip = scaleway.network.PublicGatewayIp("main")
    main_public_gateway_dhcp = scaleway.network.PublicGatewayDhcp("main", subnet="192.168.1.0/24")
    main_public_gateway = scaleway.network.PublicGateway("main",
        name="foobar",
        type="VPC-GW-S",
        ip_id=main_public_gateway_ip.id)
    main_gateway_network = scaleway.network.GatewayNetwork("main",
        gateway_id=main_public_gateway.id,
        private_network_id=main.id,
        dhcp_id=main_public_gateway_dhcp.id,
        cleanup_dhcp=True,
        enable_masquerade=True)
    main_public_gateway_dhcp_reservation = scaleway.network.PublicGatewayDhcpReservation("main",
        gateway_network_id=main_gateway_network.id,
        mac_address=main_private_nic.mac_address,
        ip_address="192.168.1.4")
    ### VPC PAT RULE
    main_public_gateway_pat_rule = scaleway.network.PublicGatewayPatRule("main",
        gateway_id=main_public_gateway.id,
        private_ip=main_public_gateway_dhcp_reservation.ip_address,
        private_port=22,
        public_port=2222,
        protocol="tcp")
    by_id = scaleway.network.get_public_gateway_dhcp_reservation_output(reservation_id=main_public_gateway_dhcp_reservation.id)
    ```


    :param _builtins.str gateway_network_id: The ID of the owning GatewayNetwork.
           
           > Only one of `reservation_id` or `mac_address` with `gateway_network_id` should be specified.
    :param _builtins.str mac_address: The MAC address of the reservation to retrieve.
    :param _builtins.str reservation_id: The ID of the reservation (DHCP entry) to retrieve.
    :param _builtins.bool wait_for_dhcp: Whether to wait for `mac_address` to exist in DHCP.
    :param _builtins.str zone: `zone`). The zone in which the reservation exists.
    """
    __args__ = dict()
    __args__['gatewayNetworkId'] = gateway_network_id
    __args__['macAddress'] = mac_address
    __args__['reservationId'] = reservation_id
    __args__['waitForDhcp'] = wait_for_dhcp
    __args__['zone'] = zone
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('scaleway:network/getPublicGatewayDhcpReservation:getPublicGatewayDhcpReservation', __args__, opts=opts, typ=GetPublicGatewayDhcpReservationResult)
    return __ret__.apply(lambda __response__: GetPublicGatewayDhcpReservationResult(
        created_at=pulumi.get(__response__, 'created_at'),
        gateway_network_id=pulumi.get(__response__, 'gateway_network_id'),
        hostname=pulumi.get(__response__, 'hostname'),
        id=pulumi.get(__response__, 'id'),
        ip_address=pulumi.get(__response__, 'ip_address'),
        mac_address=pulumi.get(__response__, 'mac_address'),
        reservation_id=pulumi.get(__response__, 'reservation_id'),
        type=pulumi.get(__response__, 'type'),
        updated_at=pulumi.get(__response__, 'updated_at'),
        wait_for_dhcp=pulumi.get(__response__, 'wait_for_dhcp'),
        zone=pulumi.get(__response__, 'zone')))
