@pulumi/digitalocean
Version:
A Pulumi package for creating and managing DigitalOcean cloud resources.
127 lines • 5.09 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.DatabaseOnlineMigration = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a virtual resource that can be used to start an online migration
* for a DigitalOcean managed database cluster. Migrating a cluster establishes a
* connection with an existing cluster and replicates its contents to the target
* cluster. If the existing database is continuously being written to, the migration
* process will continue for up to two weeks unless it is manually stopped.
* Online migration is only available for MySQL, PostgreSQL, Caching, and Valkey clusters.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
*
* const source = new digitalocean.DatabaseCluster("source", {
* name: "st01",
* engine: "mysql",
* version: "8",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* tags: ["production"],
* });
* const destination = new digitalocean.DatabaseCluster("destination", {
* name: "dt01",
* engine: "mysql",
* version: "8",
* size: digitalocean.DatabaseSlug.DB_1VPCU1GB,
* region: digitalocean.Region.NYC1,
* nodeCount: 1,
* tags: ["production"],
* });
* const sourceDb = new digitalocean.DatabaseDb("source_db", {
* clusterId: source.id,
* name: "terraform-db-om-source",
* });
* const foobar = new digitalocean.DatabaseOnlineMigration("foobar", {
* clusterId: destination.id,
* source: {
* host: source.host,
* dbName: sourceDb.name,
* port: source.port,
* username: source.user,
* password: source.password,
* },
* }, {
* dependsOn: [
* destination,
* source,
* sourceDb,
* ],
* });
* ```
*
* ## Import
*
* A MySQL database cluster's online_migration can be imported using the `id` the parent cluster, e.g.
*
* ```sh
* $ pulumi import digitalocean:index/databaseOnlineMigration:DatabaseOnlineMigration example 4b62829a-9c42-465b-aaa3-84051048e712
* ```
*/
class DatabaseOnlineMigration extends pulumi.CustomResource {
/**
* Get an existing DatabaseOnlineMigration 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 DatabaseOnlineMigration(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of DatabaseOnlineMigration. 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'] === DatabaseOnlineMigration.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["clusterId"] = state?.clusterId;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["disableSsl"] = state?.disableSsl;
resourceInputs["ignoreDbs"] = state?.ignoreDbs;
resourceInputs["source"] = state?.source;
resourceInputs["status"] = state?.status;
}
else {
const args = argsOrState;
if (args?.clusterId === undefined && !opts.urn) {
throw new Error("Missing required property 'clusterId'");
}
if (args?.source === undefined && !opts.urn) {
throw new Error("Missing required property 'source'");
}
resourceInputs["clusterId"] = args?.clusterId;
resourceInputs["disableSsl"] = args?.disableSsl;
resourceInputs["ignoreDbs"] = args?.ignoreDbs;
resourceInputs["source"] = args?.source;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(DatabaseOnlineMigration.__pulumiType, name, resourceInputs, opts);
}
}
exports.DatabaseOnlineMigration = DatabaseOnlineMigration;
/** @internal */
DatabaseOnlineMigration.__pulumiType = 'digitalocean:index/databaseOnlineMigration:DatabaseOnlineMigration';
//# sourceMappingURL=databaseOnlineMigration.js.map