@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
100 lines • 3.87 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! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Network = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource represents an SDN private network that cloud servers and other resources from the same zone can be attached to.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* const exampleRouter = new upcloud.Router("example_router", {name: "example_router"});
* // SDN network with a router
* const exampleNetwork = new upcloud.Network("example_network", {
* name: "example_private_net",
* zone: "nl-ams1",
* router: exampleRouter.id,
* ipNetwork: {
* address: "10.0.0.0/24",
* dhcp: true,
* dhcpDefaultRoute: false,
* family: "IPv4",
* gateway: "10.0.0.1",
* },
* });
* ```
*
* ## Import
*
* The `pulumi import` command can be used, for example:
*
* ```sh
* $ pulumi import upcloud:index/network:Network my_example_network 03e44422-07b8-4798-a597-c8eab1fa64df
* ```
*/
class Network extends pulumi.CustomResource {
/**
* Get an existing Network 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 Network(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Network. 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'] === Network.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["effectiveRoutes"] = state?.effectiveRoutes;
resourceInputs["ipNetwork"] = state?.ipNetwork;
resourceInputs["labels"] = state?.labels;
resourceInputs["name"] = state?.name;
resourceInputs["router"] = state?.router;
resourceInputs["type"] = state?.type;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.ipNetwork === undefined && !opts.urn) {
throw new Error("Missing required property 'ipNetwork'");
}
if (args?.zone === undefined && !opts.urn) {
throw new Error("Missing required property 'zone'");
}
resourceInputs["ipNetwork"] = args?.ipNetwork;
resourceInputs["labels"] = args?.labels;
resourceInputs["name"] = args?.name;
resourceInputs["router"] = args?.router;
resourceInputs["zone"] = args?.zone;
resourceInputs["effectiveRoutes"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Network.__pulumiType, name, resourceInputs, opts);
}
}
exports.Network = Network;
/** @internal */
Network.__pulumiType = 'upcloud:index/network:Network';
//# sourceMappingURL=network.js.map