@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
113 lines • 4.89 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.Gateway = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Network gateways connect SDN Private Networks to external IP networks.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* // Create router for the gateway
* const _this = new upcloud.Router("this", {name: "gateway-example-router"});
* // Create network for the gateway
* const thisNetwork = new upcloud.Network("this", {
* name: "gateway-example-net",
* zone: "pl-waw1",
* ipNetwork: {
* address: "172.16.2.0/24",
* dhcp: true,
* family: "IPv4",
* },
* router: _this.id,
* });
* const thisGateway = new upcloud.Gateway("this", {
* name: "gateway-example-gw",
* zone: "pl-waw1",
* features: ["nat"],
* router: {
* id: _this.id,
* },
* labels: {
* "managed-by": "terraform",
* },
* });
* ```
*/
class Gateway extends pulumi.CustomResource {
/**
* Get an existing Gateway 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 Gateway(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Gateway. 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'] === Gateway.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["address"] = state ? state.address : undefined;
resourceInputs["addresses"] = state ? state.addresses : undefined;
resourceInputs["configuredStatus"] = state ? state.configuredStatus : undefined;
resourceInputs["connections"] = state ? state.connections : undefined;
resourceInputs["features"] = state ? state.features : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["operationalState"] = state ? state.operationalState : undefined;
resourceInputs["plan"] = state ? state.plan : undefined;
resourceInputs["router"] = state ? state.router : undefined;
resourceInputs["zone"] = state ? state.zone : undefined;
}
else {
const args = argsOrState;
if ((!args || args.features === undefined) && !opts.urn) {
throw new Error("Missing required property 'features'");
}
if ((!args || args.router === undefined) && !opts.urn) {
throw new Error("Missing required property 'router'");
}
if ((!args || args.zone === undefined) && !opts.urn) {
throw new Error("Missing required property 'zone'");
}
resourceInputs["address"] = args ? args.address : undefined;
resourceInputs["configuredStatus"] = args ? args.configuredStatus : undefined;
resourceInputs["features"] = args ? args.features : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["plan"] = args ? args.plan : undefined;
resourceInputs["router"] = args ? args.router : undefined;
resourceInputs["zone"] = args ? args.zone : undefined;
resourceInputs["addresses"] = undefined /*out*/;
resourceInputs["connections"] = undefined /*out*/;
resourceInputs["operationalState"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Gateway.__pulumiType, name, resourceInputs, opts);
}
}
exports.Gateway = Gateway;
/** @internal */
Gateway.__pulumiType = 'upcloud:index/gateway:Gateway';
//# sourceMappingURL=gateway.js.map