UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

123 lines 5.22 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! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.DatabaseConnectionPool = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a DigitalOcean database connection pool resource. * * ## Example Usage * * ### Create a new PostgreSQL database connection pool * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const postgres_example = new digitalocean.DatabaseCluster("postgres-example", { * name: "example-postgres-cluster", * engine: "pg", * version: "15", * size: digitalocean.DatabaseSlug.DB_1VPCU1GB, * region: digitalocean.Region.NYC1, * nodeCount: 1, * }); * const pool_01 = new digitalocean.DatabaseConnectionPool("pool-01", { * clusterId: postgres_example.id, * name: "pool-01", * mode: "transaction", * size: 20, * dbName: "defaultdb", * user: "doadmin", * }); * ``` * * ## Import * * Database connection pools can be imported using the `id` of the source database cluster * * and the `name` of the connection pool joined with a comma. For example: * * ```sh * $ pulumi import digitalocean:index/databaseConnectionPool:DatabaseConnectionPool pool-01 245bcfd0-7f31-4ce6-a2bc-475a116cca97,pool-01 * ``` */ class DatabaseConnectionPool extends pulumi.CustomResource { /** * Get an existing DatabaseConnectionPool 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 DatabaseConnectionPool(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of DatabaseConnectionPool. 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'] === DatabaseConnectionPool.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["clusterId"] = state?.clusterId; resourceInputs["dbName"] = state?.dbName; resourceInputs["host"] = state?.host; resourceInputs["mode"] = state?.mode; resourceInputs["name"] = state?.name; resourceInputs["password"] = state?.password; resourceInputs["port"] = state?.port; resourceInputs["privateHost"] = state?.privateHost; resourceInputs["privateUri"] = state?.privateUri; resourceInputs["size"] = state?.size; resourceInputs["uri"] = state?.uri; resourceInputs["user"] = state?.user; } else { const args = argsOrState; if (args?.clusterId === undefined && !opts.urn) { throw new Error("Missing required property 'clusterId'"); } if (args?.dbName === undefined && !opts.urn) { throw new Error("Missing required property 'dbName'"); } if (args?.mode === undefined && !opts.urn) { throw new Error("Missing required property 'mode'"); } if (args?.size === undefined && !opts.urn) { throw new Error("Missing required property 'size'"); } resourceInputs["clusterId"] = args?.clusterId; resourceInputs["dbName"] = args?.dbName; resourceInputs["mode"] = args?.mode; resourceInputs["name"] = args?.name; resourceInputs["size"] = args?.size; resourceInputs["user"] = args?.user; resourceInputs["host"] = undefined /*out*/; resourceInputs["password"] = undefined /*out*/; resourceInputs["port"] = undefined /*out*/; resourceInputs["privateHost"] = undefined /*out*/; resourceInputs["privateUri"] = undefined /*out*/; resourceInputs["uri"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["password", "privateUri", "uri"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(DatabaseConnectionPool.__pulumiType, name, resourceInputs, opts); } } exports.DatabaseConnectionPool = DatabaseConnectionPool; /** @internal */ DatabaseConnectionPool.__pulumiType = 'digitalocean:index/databaseConnectionPool:DatabaseConnectionPool'; //# sourceMappingURL=databaseConnectionPool.js.map