UNPKG

@pulumi/hcloud

Version:

A Pulumi package for creating and managing hcloud cloud resources.

117 lines 4.77 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.LoadBalancerTarget = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Adds a target to a Hetzner Cloud Load Balancer. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as hcloud from "@pulumi/hcloud"; * * const myServer = new hcloud.Server("my_server", { * name: "my-server", * 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 Balancer Target entries can be imported using a compound ID with the following format: * * `<load-balancer-id>__<type>__<identifier>` * * Where _identifier_ depends on the _type_: * * - `server`: server id, for example: `123` * * - `label_selector`: label selector, for example: `foo=bar` * * - `ip`: ip address, for example: `203.0.113.123` * * ```sh * $ pulumi import hcloud:index/loadBalancerTarget:LoadBalancerTarget server "${LOAD_BALANCER_ID}__server__${SERVER_ID}" * ``` * * ```sh * $ pulumi import hcloud:index/loadBalancerTarget:LoadBalancerTarget label "${LOAD_BALANCER_ID}__label_selector__${LABEL_SELECTOR}" * ``` * * ```sh * $ pulumi import hcloud:index/loadBalancerTarget:LoadBalancerTarget ip "${LOAD_BALANCER_ID}__ip__${IP}" * ``` */ class LoadBalancerTarget extends pulumi.CustomResource { /** * Get an existing LoadBalancerTarget 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 LoadBalancerTarget(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of LoadBalancerTarget. 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'] === LoadBalancerTarget.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["ip"] = state ? state.ip : undefined; resourceInputs["labelSelector"] = state ? state.labelSelector : undefined; resourceInputs["loadBalancerId"] = state ? state.loadBalancerId : undefined; resourceInputs["serverId"] = state ? state.serverId : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["usePrivateIp"] = state ? state.usePrivateIp : undefined; } else { const args = argsOrState; if ((!args || args.loadBalancerId === undefined) && !opts.urn) { throw new Error("Missing required property 'loadBalancerId'"); } if ((!args || args.type === undefined) && !opts.urn) { throw new Error("Missing required property 'type'"); } resourceInputs["ip"] = args ? args.ip : undefined; resourceInputs["labelSelector"] = args ? args.labelSelector : undefined; resourceInputs["loadBalancerId"] = args ? args.loadBalancerId : undefined; resourceInputs["serverId"] = args ? args.serverId : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["usePrivateIp"] = args ? args.usePrivateIp : undefined; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(LoadBalancerTarget.__pulumiType, name, resourceInputs, opts); } } exports.LoadBalancerTarget = LoadBalancerTarget; /** @internal */ LoadBalancerTarget.__pulumiType = 'hcloud:index/loadBalancerTarget:LoadBalancerTarget'; //# sourceMappingURL=loadBalancerTarget.js.map