UNPKG

@pulumi/hcloud

Version:

A Pulumi package for creating and managing hcloud cloud resources.

108 lines 4.84 kB
"use strict"; // *** 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.LoadBalancer = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a Hetzner Cloud Load Balancer to represent a Load Balancer in the Hetzner Cloud. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as hcloud from "@pulumi/hcloud"; * * const myServer = new hcloud.Server("my_server", { * name: "server-%d", * serverType: "cx22", * image: "ubuntu-18.04", * }); * const loadBalancer = new hcloud.LoadBalancer("load_balancer", { * name: "my-load-balancer", * loadBalancerType: "lb11", * location: "nbg1", * }); * const loadBalancerTarget = new hcloud.LoadBalancerTarget("load_balancer_target", { * type: "server", * loadBalancerId: loadBalancer.id, * serverId: myServer.id, * }); * ``` * * ## Import * * Load Balancers can be imported using its `id`: * * ```sh * $ pulumi import hcloud:index/loadBalancer:LoadBalancer example "$LOAD_BALANCER_ID" * ``` */ class LoadBalancer extends pulumi.CustomResource { /** * Get an existing LoadBalancer 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 LoadBalancer(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of LoadBalancer. 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'] === LoadBalancer.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["algorithm"] = state ? state.algorithm : undefined; resourceInputs["deleteProtection"] = state ? state.deleteProtection : undefined; resourceInputs["ipv4"] = state ? state.ipv4 : undefined; resourceInputs["ipv6"] = state ? state.ipv6 : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["loadBalancerType"] = state ? state.loadBalancerType : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["networkId"] = state ? state.networkId : undefined; resourceInputs["networkIp"] = state ? state.networkIp : undefined; resourceInputs["networkZone"] = state ? state.networkZone : undefined; resourceInputs["targets"] = state ? state.targets : undefined; } else { const args = argsOrState; if ((!args || args.loadBalancerType === undefined) && !opts.urn) { throw new Error("Missing required property 'loadBalancerType'"); } resourceInputs["algorithm"] = args ? args.algorithm : undefined; resourceInputs["deleteProtection"] = args ? args.deleteProtection : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["loadBalancerType"] = args ? args.loadBalancerType : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["networkZone"] = args ? args.networkZone : undefined; resourceInputs["targets"] = args ? args.targets : undefined; resourceInputs["ipv4"] = undefined /*out*/; resourceInputs["ipv6"] = undefined /*out*/; resourceInputs["networkId"] = undefined /*out*/; resourceInputs["networkIp"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(LoadBalancer.__pulumiType, name, resourceInputs, opts); } } exports.LoadBalancer = LoadBalancer; /** @internal */ LoadBalancer.__pulumiType = 'hcloud:index/loadBalancer:LoadBalancer'; //# sourceMappingURL=loadBalancer.js.map