@pulumi/hcloud
Version:
A Pulumi package for creating and managing hcloud cloud resources.
114 lines • 4.76 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.LoadBalancerService = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Define services for Hetzner Cloud Load Balancers.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as hcloud from "@pulumi/hcloud";
*
* const loadBalancer = new hcloud.LoadBalancer("load_balancer", {
* name: "my-load-balancer",
* loadBalancerType: "lb11",
* location: "nbg1",
* });
* const loadBalancerService = new hcloud.LoadBalancerService("load_balancer_service", {
* loadBalancerId: loadBalancer.id,
* protocol: "http",
* http: {
* stickySessions: true,
* cookieName: "EXAMPLE_STICKY",
* },
* healthCheck: {
* protocol: "http",
* port: 80,
* interval: 10,
* timeout: 5,
* http: {
* domain: "example.com",
* path: "/healthz",
* response: "OK",
* tls: true,
* statusCodes: ["200"],
* },
* },
* });
* ```
*
* ## Import
*
* Load Balancer Service entries can be imported using a compound ID with the following format:
*
* `<load-balancer-id>__<listen-port>`
*
* ```sh
* $ pulumi import hcloud:index/loadBalancerService:LoadBalancerService example "${LOAD_BALANCER_ID}__${LISTEN_PORT}"
* ```
*/
class LoadBalancerService extends pulumi.CustomResource {
/**
* Get an existing LoadBalancerService 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 LoadBalancerService(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of LoadBalancerService. 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'] === LoadBalancerService.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["destinationPort"] = state ? state.destinationPort : undefined;
resourceInputs["healthCheck"] = state ? state.healthCheck : undefined;
resourceInputs["http"] = state ? state.http : undefined;
resourceInputs["listenPort"] = state ? state.listenPort : undefined;
resourceInputs["loadBalancerId"] = state ? state.loadBalancerId : undefined;
resourceInputs["protocol"] = state ? state.protocol : undefined;
resourceInputs["proxyprotocol"] = state ? state.proxyprotocol : undefined;
}
else {
const args = argsOrState;
if ((!args || args.loadBalancerId === undefined) && !opts.urn) {
throw new Error("Missing required property 'loadBalancerId'");
}
if ((!args || args.protocol === undefined) && !opts.urn) {
throw new Error("Missing required property 'protocol'");
}
resourceInputs["destinationPort"] = args ? args.destinationPort : undefined;
resourceInputs["healthCheck"] = args ? args.healthCheck : undefined;
resourceInputs["http"] = args ? args.http : undefined;
resourceInputs["listenPort"] = args ? args.listenPort : undefined;
resourceInputs["loadBalancerId"] = args ? args.loadBalancerId : undefined;
resourceInputs["protocol"] = args ? args.protocol : undefined;
resourceInputs["proxyprotocol"] = args ? args.proxyprotocol : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LoadBalancerService.__pulumiType, name, resourceInputs, opts);
}
}
exports.LoadBalancerService = LoadBalancerService;
/** @internal */
LoadBalancerService.__pulumiType = 'hcloud:index/loadBalancerService:LoadBalancerService';
//# sourceMappingURL=loadBalancerService.js.map