UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

129 lines 5.97 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.DatabaseReplica = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * Provides a DigitalOcean database replica resource. * * ## Example Usage * * ### Create a new PostgreSQL database replica * ```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 replica_example = new digitalocean.DatabaseReplica("replica-example", { * clusterId: postgres_example.id, * name: "replica-example", * size: digitalocean.DatabaseSlug.DB_1VPCU1GB, * region: digitalocean.Region.NYC1, * }); * export const UUID = replica_example.uuid; * // Create firewall rule for database replica * const example_fw = new digitalocean.DatabaseFirewall("example-fw", { * clusterId: replica_example.uuid, * rules: [{ * type: "ip_addr", * value: "192.168.1.1", * }], * }); * ``` * * ## Import * * Database replicas can be imported using the `id` of the source database cluster * * and the `name` of the replica joined with a comma. For example: * * ```sh * $ pulumi import digitalocean:index/databaseReplica:DatabaseReplica read-replica 245bcfd0-7f31-4ce6-a2bc-475a116cca97,read-replica * ``` */ class DatabaseReplica extends pulumi.CustomResource { /** * Get an existing DatabaseReplica 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 DatabaseReplica(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of DatabaseReplica. 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'] === DatabaseReplica.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["clusterId"] = state ? state.clusterId : undefined; resourceInputs["database"] = state ? state.database : undefined; resourceInputs["host"] = state ? state.host : 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["privateNetworkUuid"] = state ? state.privateNetworkUuid : undefined; resourceInputs["privateUri"] = state ? state.privateUri : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["size"] = state ? state.size : undefined; resourceInputs["storageSizeMib"] = state ? state.storageSizeMib : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["uri"] = state ? state.uri : undefined; resourceInputs["user"] = state ? state.user : undefined; resourceInputs["uuid"] = state ? state.uuid : undefined; } else { const args = argsOrState; if ((!args || args.clusterId === undefined) && !opts.urn) { throw new Error("Missing required property 'clusterId'"); } resourceInputs["clusterId"] = args ? args.clusterId : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["privateNetworkUuid"] = args ? args.privateNetworkUuid : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["size"] = args ? args.size : undefined; resourceInputs["storageSizeMib"] = args ? args.storageSizeMib : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["database"] = undefined /*out*/; resourceInputs["host"] = undefined /*out*/; resourceInputs["password"] = undefined /*out*/; resourceInputs["port"] = undefined /*out*/; resourceInputs["privateHost"] = undefined /*out*/; resourceInputs["privateUri"] = undefined /*out*/; resourceInputs["uri"] = undefined /*out*/; resourceInputs["user"] = undefined /*out*/; resourceInputs["uuid"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["password", "privateUri", "uri"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(DatabaseReplica.__pulumiType, name, resourceInputs, opts); } } exports.DatabaseReplica = DatabaseReplica; /** @internal */ DatabaseReplica.__pulumiType = 'digitalocean:index/databaseReplica:DatabaseReplica'; //# sourceMappingURL=databaseReplica.js.map