@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
123 lines • 5.62 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.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, Object.assign(Object.assign({}, 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 ? state.clusterId : undefined;
resourceInputs["dbName"] = state ? state.dbName : undefined;
resourceInputs["host"] = state ? state.host : undefined;
resourceInputs["mode"] = state ? state.mode : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["privateHost"] = state ? state.privateHost : undefined;
resourceInputs["privateUri"] = state ? state.privateUri : undefined;
resourceInputs["size"] = state ? state.size : undefined;
resourceInputs["uri"] = state ? state.uri : undefined;
resourceInputs["user"] = state ? state.user : undefined;
}
else {
const args = argsOrState;
if ((!args || args.clusterId === undefined) && !opts.urn) {
throw new Error("Missing required property 'clusterId'");
}
if ((!args || args.dbName === undefined) && !opts.urn) {
throw new Error("Missing required property 'dbName'");
}
if ((!args || args.mode === undefined) && !opts.urn) {
throw new Error("Missing required property 'mode'");
}
if ((!args || args.size === undefined) && !opts.urn) {
throw new Error("Missing required property 'size'");
}
resourceInputs["clusterId"] = args ? args.clusterId : undefined;
resourceInputs["dbName"] = args ? args.dbName : undefined;
resourceInputs["mode"] = args ? args.mode : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["size"] = args ? args.size : undefined;
resourceInputs["user"] = args ? args.user : undefined;
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