@pulumi/hcloud
Version:
A Pulumi package for creating and managing hcloud cloud resources.
92 lines • 3.66 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.NetworkRoute = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Hetzner Cloud Network Route to represent a Network route in the Hetzner Cloud.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as hcloud from "@pulumi/hcloud";
*
* const mynet = new hcloud.Network("mynet", {
* name: "my-net",
* ipRange: "10.0.0.0/8",
* });
* const privNet = new hcloud.NetworkRoute("privNet", {
* networkId: mynet.id,
* destination: "10.100.1.0/24",
* gateway: "10.0.1.1",
* });
* ```
*
* ## Import
*
* Network Route entries can be imported using a compound ID with the following format:
*
* `<network-id>-<destination>`
*
* ```sh
* $ pulumi import hcloud:index/networkRoute:NetworkRoute example "$NETWORK_ID-$DESTINATION"
* ```
*/
class NetworkRoute extends pulumi.CustomResource {
/**
* Get an existing NetworkRoute 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 NetworkRoute(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NetworkRoute. 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'] === NetworkRoute.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["destination"] = state ? state.destination : undefined;
resourceInputs["gateway"] = state ? state.gateway : undefined;
resourceInputs["networkId"] = state ? state.networkId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.destination === undefined) && !opts.urn) {
throw new Error("Missing required property 'destination'");
}
if ((!args || args.gateway === undefined) && !opts.urn) {
throw new Error("Missing required property 'gateway'");
}
if ((!args || args.networkId === undefined) && !opts.urn) {
throw new Error("Missing required property 'networkId'");
}
resourceInputs["destination"] = args ? args.destination : undefined;
resourceInputs["gateway"] = args ? args.gateway : undefined;
resourceInputs["networkId"] = args ? args.networkId : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkRoute.__pulumiType, name, resourceInputs, opts);
}
}
exports.NetworkRoute = NetworkRoute;
/** @internal */
NetworkRoute.__pulumiType = 'hcloud:index/networkRoute:NetworkRoute';
//# sourceMappingURL=networkRoute.js.map