@pulumi/hcloud
Version:
A Pulumi package for creating and managing hcloud cloud resources.
102 lines • 4.26 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.NetworkSubnet = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Hetzner Cloud Network Subnet to represent a Subnet 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 foonet = new hcloud.NetworkSubnet("foonet", {
* networkId: mynet.id,
* type: "cloud",
* networkZone: "eu-central",
* ipRange: "10.0.1.0/24",
* });
* ```
*
* ## Import
*
* Network Subnet entries can be imported using a compound ID with the following format:
*
* `<network-id>-<ip_range>`
*
* ```sh
* $ pulumi import hcloud:index/networkSubnet:NetworkSubnet example "$NETWORK_ID-$IP_RANGE"
* ```
*/
class NetworkSubnet extends pulumi.CustomResource {
/**
* Get an existing NetworkSubnet 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 NetworkSubnet(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NetworkSubnet. 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'] === NetworkSubnet.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["gateway"] = state ? state.gateway : undefined;
resourceInputs["ipRange"] = state ? state.ipRange : undefined;
resourceInputs["networkId"] = state ? state.networkId : undefined;
resourceInputs["networkZone"] = state ? state.networkZone : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["vswitchId"] = state ? state.vswitchId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.ipRange === undefined) && !opts.urn) {
throw new Error("Missing required property 'ipRange'");
}
if ((!args || args.networkId === undefined) && !opts.urn) {
throw new Error("Missing required property 'networkId'");
}
if ((!args || args.networkZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'networkZone'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["ipRange"] = args ? args.ipRange : undefined;
resourceInputs["networkId"] = args ? args.networkId : undefined;
resourceInputs["networkZone"] = args ? args.networkZone : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["vswitchId"] = args ? args.vswitchId : undefined;
resourceInputs["gateway"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkSubnet.__pulumiType, name, resourceInputs, opts);
}
}
exports.NetworkSubnet = NetworkSubnet;
/** @internal */
NetworkSubnet.__pulumiType = 'hcloud:index/networkSubnet:NetworkSubnet';
//# sourceMappingURL=networkSubnet.js.map