@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
152 lines • 8.27 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");
/**
* Provides a DigitalOcean Load Balancer resource. This can be used to create,
* modify, and delete Load Balancers.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const web = new digitalocean.Droplet("web", {
* name: "web-1",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-18-04-x64",
* region: digitalocean.Region.NYC3,
* });
* const _public = new digitalocean.LoadBalancer("public", {
* name: "loadbalancer-1",
* region: digitalocean.Region.NYC3,
* forwardingRules: [{
* entryPort: 80,
* entryProtocol: "http",
* targetPort: 80,
* targetProtocol: "http",
* }],
* healthcheck: {
* port: 22,
* protocol: "tcp",
* },
* dropletIds: [web.id],
* });
* ```
*
* When managing certificates attached to the load balancer, make sure to add the `createBeforeDestroy`
* lifecycle property in order to ensure the certificate is correctly updated when changed. The order of
* operations will then be: `Create new certificate` > `Update loadbalancer with new certificate` ->
* `Delete old certificate`. When doing so, you must also change the name of the certificate,
* as there cannot be multiple certificates with the same name in an account.
*
* ## Import
*
* Load Balancers can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import digitalocean:index/loadBalancer:LoadBalancer myloadbalancer 4de7ac8b-495b-4884-9a69-1050c6793cd6
* ```
*/
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["disableLetsEncryptDnsRecords"] = state ? state.disableLetsEncryptDnsRecords : undefined;
resourceInputs["domains"] = state ? state.domains : undefined;
resourceInputs["dropletIds"] = state ? state.dropletIds : undefined;
resourceInputs["dropletTag"] = state ? state.dropletTag : undefined;
resourceInputs["enableBackendKeepalive"] = state ? state.enableBackendKeepalive : undefined;
resourceInputs["enableProxyProtocol"] = state ? state.enableProxyProtocol : undefined;
resourceInputs["firewall"] = state ? state.firewall : undefined;
resourceInputs["forwardingRules"] = state ? state.forwardingRules : undefined;
resourceInputs["glbSettings"] = state ? state.glbSettings : undefined;
resourceInputs["healthcheck"] = state ? state.healthcheck : undefined;
resourceInputs["httpIdleTimeoutSeconds"] = state ? state.httpIdleTimeoutSeconds : undefined;
resourceInputs["ip"] = state ? state.ip : undefined;
resourceInputs["ipv6"] = state ? state.ipv6 : undefined;
resourceInputs["loadBalancerUrn"] = state ? state.loadBalancerUrn : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["networkStack"] = state ? state.networkStack : undefined;
resourceInputs["projectId"] = state ? state.projectId : undefined;
resourceInputs["redirectHttpToHttps"] = state ? state.redirectHttpToHttps : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["size"] = state ? state.size : undefined;
resourceInputs["sizeUnit"] = state ? state.sizeUnit : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["stickySessions"] = state ? state.stickySessions : undefined;
resourceInputs["targetLoadBalancerIds"] = state ? state.targetLoadBalancerIds : undefined;
resourceInputs["tlsCipherPolicy"] = state ? state.tlsCipherPolicy : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["vpcUuid"] = state ? state.vpcUuid : undefined;
}
else {
const args = argsOrState;
resourceInputs["algorithm"] = args ? args.algorithm : undefined;
resourceInputs["disableLetsEncryptDnsRecords"] = args ? args.disableLetsEncryptDnsRecords : undefined;
resourceInputs["domains"] = args ? args.domains : undefined;
resourceInputs["dropletIds"] = args ? args.dropletIds : undefined;
resourceInputs["dropletTag"] = args ? args.dropletTag : undefined;
resourceInputs["enableBackendKeepalive"] = args ? args.enableBackendKeepalive : undefined;
resourceInputs["enableProxyProtocol"] = args ? args.enableProxyProtocol : undefined;
resourceInputs["firewall"] = args ? args.firewall : undefined;
resourceInputs["forwardingRules"] = args ? args.forwardingRules : undefined;
resourceInputs["glbSettings"] = args ? args.glbSettings : undefined;
resourceInputs["healthcheck"] = args ? args.healthcheck : undefined;
resourceInputs["httpIdleTimeoutSeconds"] = args ? args.httpIdleTimeoutSeconds : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["network"] = args ? args.network : undefined;
resourceInputs["networkStack"] = args ? args.networkStack : undefined;
resourceInputs["projectId"] = args ? args.projectId : undefined;
resourceInputs["redirectHttpToHttps"] = args ? args.redirectHttpToHttps : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["size"] = args ? args.size : undefined;
resourceInputs["sizeUnit"] = args ? args.sizeUnit : undefined;
resourceInputs["stickySessions"] = args ? args.stickySessions : undefined;
resourceInputs["targetLoadBalancerIds"] = args ? args.targetLoadBalancerIds : undefined;
resourceInputs["tlsCipherPolicy"] = args ? args.tlsCipherPolicy : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["vpcUuid"] = args ? args.vpcUuid : undefined;
resourceInputs["ip"] = undefined /*out*/;
resourceInputs["ipv6"] = undefined /*out*/;
resourceInputs["loadBalancerUrn"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(LoadBalancer.__pulumiType, name, resourceInputs, opts);
}
}
exports.LoadBalancer = LoadBalancer;
/** @internal */
LoadBalancer.__pulumiType = 'digitalocean:index/loadBalancer:LoadBalancer';
//# sourceMappingURL=loadBalancer.js.map