UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

175 lines • 8.32 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.LoadBalancer = void 0; const pulumi = __importStar(require("@pulumi/pulumi")); const utilities = __importStar(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.apply(x =>Number(x))], * }); * ``` * * 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, { ...opts, id: id }); } /** @internal */ static __pulumiType = 'digitalocean:index/loadBalancer:LoadBalancer'; /** * 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?.algorithm; resourceInputs["disableLetsEncryptDnsRecords"] = state?.disableLetsEncryptDnsRecords; resourceInputs["domains"] = state?.domains; resourceInputs["dropletIds"] = state?.dropletIds; resourceInputs["dropletTag"] = state?.dropletTag; resourceInputs["enableBackendKeepalive"] = state?.enableBackendKeepalive; resourceInputs["enableProxyProtocol"] = state?.enableProxyProtocol; resourceInputs["firewall"] = state?.firewall; resourceInputs["forwardingRules"] = state?.forwardingRules; resourceInputs["glbSettings"] = state?.glbSettings; resourceInputs["healthcheck"] = state?.healthcheck; resourceInputs["httpIdleTimeoutSeconds"] = state?.httpIdleTimeoutSeconds; resourceInputs["ip"] = state?.ip; resourceInputs["ipv6"] = state?.ipv6; resourceInputs["loadBalancerUrn"] = state?.loadBalancerUrn; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["networkStack"] = state?.networkStack; resourceInputs["projectId"] = state?.projectId; resourceInputs["redirectHttpToHttps"] = state?.redirectHttpToHttps; resourceInputs["region"] = state?.region; resourceInputs["size"] = state?.size; resourceInputs["sizeUnit"] = state?.sizeUnit; resourceInputs["status"] = state?.status; resourceInputs["stickySessions"] = state?.stickySessions; resourceInputs["targetLoadBalancerIds"] = state?.targetLoadBalancerIds; resourceInputs["tlsCipherPolicy"] = state?.tlsCipherPolicy; resourceInputs["type"] = state?.type; resourceInputs["vpcUuid"] = state?.vpcUuid; } else { const args = argsOrState; resourceInputs["algorithm"] = args?.algorithm; resourceInputs["disableLetsEncryptDnsRecords"] = args?.disableLetsEncryptDnsRecords; resourceInputs["domains"] = args?.domains; resourceInputs["dropletIds"] = args?.dropletIds; resourceInputs["dropletTag"] = args?.dropletTag; resourceInputs["enableBackendKeepalive"] = args?.enableBackendKeepalive; resourceInputs["enableProxyProtocol"] = args?.enableProxyProtocol; resourceInputs["firewall"] = args?.firewall; resourceInputs["forwardingRules"] = args?.forwardingRules; resourceInputs["glbSettings"] = args?.glbSettings; resourceInputs["healthcheck"] = args?.healthcheck; resourceInputs["httpIdleTimeoutSeconds"] = args?.httpIdleTimeoutSeconds; resourceInputs["name"] = args?.name; resourceInputs["network"] = args?.network; resourceInputs["networkStack"] = args?.networkStack; resourceInputs["projectId"] = args?.projectId; resourceInputs["redirectHttpToHttps"] = args?.redirectHttpToHttps; resourceInputs["region"] = args?.region; resourceInputs["size"] = args?.size; resourceInputs["sizeUnit"] = args?.sizeUnit; resourceInputs["stickySessions"] = args?.stickySessions; resourceInputs["targetLoadBalancerIds"] = args?.targetLoadBalancerIds; resourceInputs["tlsCipherPolicy"] = args?.tlsCipherPolicy; resourceInputs["type"] = args?.type; resourceInputs["vpcUuid"] = args?.vpcUuid; 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; //# sourceMappingURL=loadBalancer.js.map