@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
96 lines • 3.94 kB
JavaScript
;
// *** 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! ***
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
*
* ```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, Object.assign(Object.assign({}, 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["ipNetwork"] = state ? state.ipNetwork : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["router"] = state ? state.router : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.ipNetwork === undefined) && !opts.urn) {
throw new Error("Missing required property 'ipNetwork'");
}
if ((!args || args.zone === undefined) && !opts.urn) {
throw new Error("Missing required property 'zone'");
}
resourceInputs["ipNetwork"] = args ? args.ipNetwork : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["router"] = args ? args.router : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
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