@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
98 lines • 4.29 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.NetworkPeering = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Network peerings can be used to connect networks across accounts. For the network peering to become active, the peering must be made from both directions.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* // Network peering requires the networks to have routers attached to them.
* const _this = new upcloud.Router("this", {name: "network-peering-example-router"});
* const example = new upcloud.Network("example", {
* name: "network-peering-example-net",
* zone: "nl-ams1",
* router: exampleUpcloudRouter.id,
* ipNetwork: {
* address: "10.0.0.0/24",
* dhcp: true,
* family: "IPv4",
* },
* });
* const thisNetworkPeering: upcloud.NetworkPeering[] = [];
* for (const range = {value: 0}; range.value < 1; range.value++) {
* thisNetworkPeering.push(new upcloud.NetworkPeering(`this-${range.value}`, {
* name: "network-peering-example-peering",
* network: {
* uuid: example.id,
* },
* peerNetwork: {
* uuid: "0305723a-e5cb-4ef6-985d-e36ed44d133a",
* },
* }));
* }
* ```
*/
class NetworkPeering extends pulumi.CustomResource {
/**
* Get an existing NetworkPeering 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 NetworkPeering(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of NetworkPeering. 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'] === NetworkPeering.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["configuredStatus"] = state ? state.configuredStatus : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["peerNetwork"] = state ? state.peerNetwork : undefined;
}
else {
const args = argsOrState;
if ((!args || args.network === undefined) && !opts.urn) {
throw new Error("Missing required property 'network'");
}
if ((!args || args.peerNetwork === undefined) && !opts.urn) {
throw new Error("Missing required property 'peerNetwork'");
}
resourceInputs["configuredStatus"] = args ? args.configuredStatus : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["network"] = args ? args.network : undefined;
resourceInputs["peerNetwork"] = args ? args.peerNetwork : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NetworkPeering.__pulumiType, name, resourceInputs, opts);
}
}
exports.NetworkPeering = NetworkPeering;
/** @internal */
NetworkPeering.__pulumiType = 'upcloud:index/networkPeering:NetworkPeering';
//# sourceMappingURL=networkPeering.js.map