@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
161 lines • 7.56 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicGatewayDhcpReservation = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* > **Important:** The resource `scaleway.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.
*
* Creates and manages [Scaleway DHCP Reservations](https://www.scaleway.com/en/docs/vpc/concepts/#dhcp).
*
* These static associations are used to assign IP addresses based on the MAC addresses of the resource.
*
* Statically assigned IP addresses should fall within the configured subnet, but be outside of the dynamic range.
*
* For more information, see the [API documentation](https://www.scaleway.com/en/developers/api/public-gateway/#dhcp-c05544).
*
* [DHCP reservations](https://www.scaleway.com/en/developers/api/public-gateway/#dhcp-entries-e40fb6) hold both dynamic DHCP leases (IP addresses dynamically assigned by the gateway to resources) and static user-created DHCP reservations.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const main = new scaleway.network.PrivateNetwork("main", {name: "your_private_network"});
* const mainServer = new scaleway.instance.Server("main", {
* image: "ubuntu_jammy",
* type: "DEV1-S",
* zone: "fr-par-1",
* privateNetworks: [{
* pnId: main.id,
* }],
* });
* const mainPublicGatewayIp = new scaleway.network.PublicGatewayIp("main", {});
* const mainPublicGatewayDhcp = new scaleway.network.PublicGatewayDhcp("main", {subnet: "192.168.1.0/24"});
* const mainPublicGateway = new scaleway.network.PublicGateway("main", {
* name: "foobar",
* type: "VPC-GW-S",
* ipId: mainPublicGatewayIp.id,
* });
* const mainGatewayNetwork = new scaleway.network.GatewayNetwork("main", {
* gatewayId: mainPublicGateway.id,
* privateNetworkId: main.id,
* dhcpId: mainPublicGatewayDhcp.id,
* cleanupDhcp: true,
* enableMasquerade: true,
* }, {
* dependsOn: [
* mainPublicGatewayIp,
* main,
* ],
* });
* const mainPublicGatewayDhcpReservation = new scaleway.network.PublicGatewayDhcpReservation("main", {
* gatewayNetworkId: mainGatewayNetwork.id,
* macAddress: mainServer.privateNetworks.apply(privateNetworks => privateNetworks?.[0]?.macAddress),
* ipAddress: "192.168.1.1",
* });
* ```
*
* ## Import
*
* Public Gateway DHCP reservation configurations can be imported using `{zone}/{id}`, e.g.
*
* ```sh
* $ pulumi import scaleway:network/publicGatewayDhcpReservation:PublicGatewayDhcpReservation main fr-par-1/11111111-1111-1111-1111-111111111111
* ```
*/
class PublicGatewayDhcpReservation extends pulumi.CustomResource {
/**
* Get an existing PublicGatewayDhcpReservation resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new PublicGatewayDhcpReservation(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:network/publicGatewayDhcpReservation:PublicGatewayDhcpReservation';
/**
* Returns true if the given object is an instance of PublicGatewayDhcpReservation. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === PublicGatewayDhcpReservation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["gatewayNetworkId"] = state?.gatewayNetworkId;
resourceInputs["hostname"] = state?.hostname;
resourceInputs["ipAddress"] = state?.ipAddress;
resourceInputs["macAddress"] = state?.macAddress;
resourceInputs["type"] = state?.type;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.gatewayNetworkId === undefined && !opts.urn) {
throw new Error("Missing required property 'gatewayNetworkId'");
}
if (args?.ipAddress === undefined && !opts.urn) {
throw new Error("Missing required property 'ipAddress'");
}
if (args?.macAddress === undefined && !opts.urn) {
throw new Error("Missing required property 'macAddress'");
}
resourceInputs["gatewayNetworkId"] = args?.gatewayNetworkId;
resourceInputs["ipAddress"] = args?.ipAddress;
resourceInputs["macAddress"] = args?.macAddress;
resourceInputs["zone"] = args?.zone;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["hostname"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "scaleway:index/vpcPublicGatewayDhcpReservation:VpcPublicGatewayDhcpReservation" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(PublicGatewayDhcpReservation.__pulumiType, name, resourceInputs, opts);
}
}
exports.PublicGatewayDhcpReservation = PublicGatewayDhcpReservation;
//# sourceMappingURL=publicGatewayDhcpReservation.js.map