@ediri/vultr
Version:
A Pulumi package for creating and managing Vultr cloud resources.
126 lines • 5.7 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** 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");
/**
* Get information about a Vultr load balancer.
*
* ## Example Usage
*
* Create a new load balancer:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vultr from "@ediri/vultr";
*
* const lb = new vultr.LoadBalancer("lb", {
* balancingAlgorithm: "roundrobin",
* forwardingRules: [{
* backendPort: 81,
* backendProtocol: "http",
* frontendPort: 82,
* frontendProtocol: "http",
* }],
* healthCheck: {
* checkInterval: 3,
* healthyThreshold: 4,
* path: "/test",
* port: 8080,
* protocol: "http",
* responseTimeout: 1,
* unhealthyThreshold: 2,
* },
* label: "vultr-load-balancer",
* region: "ewr",
* });
* ```
*
* ## Import
*
* Load Balancers can be imported using the load balancer `ID`, e.g.
*
* ```sh
* $ pulumi import vultr:index/loadBalancer:LoadBalancer lb b6a859c5-b299-49dd-8888-b1abbc517d08
* ```
*/
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["attachedInstances"] = state ? state.attachedInstances : undefined;
resourceInputs["balancingAlgorithm"] = state ? state.balancingAlgorithm : undefined;
resourceInputs["cookieName"] = state ? state.cookieName : undefined;
resourceInputs["firewallRules"] = state ? state.firewallRules : undefined;
resourceInputs["forwardingRules"] = state ? state.forwardingRules : undefined;
resourceInputs["hasSsl"] = state ? state.hasSsl : undefined;
resourceInputs["healthCheck"] = state ? state.healthCheck : undefined;
resourceInputs["ipv4"] = state ? state.ipv4 : undefined;
resourceInputs["ipv6"] = state ? state.ipv6 : undefined;
resourceInputs["label"] = state ? state.label : undefined;
resourceInputs["proxyProtocol"] = state ? state.proxyProtocol : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["ssl"] = state ? state.ssl : undefined;
resourceInputs["sslRedirect"] = state ? state.sslRedirect : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["vpc"] = state ? state.vpc : undefined;
}
else {
const args = argsOrState;
if ((!args || args.forwardingRules === undefined) && !opts.urn) {
throw new Error("Missing required property 'forwardingRules'");
}
if ((!args || args.region === undefined) && !opts.urn) {
throw new Error("Missing required property 'region'");
}
resourceInputs["attachedInstances"] = args ? args.attachedInstances : undefined;
resourceInputs["balancingAlgorithm"] = args ? args.balancingAlgorithm : undefined;
resourceInputs["cookieName"] = args ? args.cookieName : undefined;
resourceInputs["firewallRules"] = args ? args.firewallRules : undefined;
resourceInputs["forwardingRules"] = args ? args.forwardingRules : undefined;
resourceInputs["healthCheck"] = args ? args.healthCheck : undefined;
resourceInputs["label"] = args ? args.label : undefined;
resourceInputs["proxyProtocol"] = args ? args.proxyProtocol : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["ssl"] = args ? args.ssl : undefined;
resourceInputs["sslRedirect"] = args ? args.sslRedirect : undefined;
resourceInputs["vpc"] = args ? args.vpc : undefined;
resourceInputs["hasSsl"] = undefined /*out*/;
resourceInputs["ipv4"] = undefined /*out*/;
resourceInputs["ipv6"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LoadBalancer.__pulumiType, name, resourceInputs, opts);
}
}
exports.LoadBalancer = LoadBalancer;
/** @internal */
LoadBalancer.__pulumiType = 'vultr:index/loadBalancer:LoadBalancer';
//# sourceMappingURL=loadBalancer.js.map