@ediri/vultr
Version:
A Pulumi package for creating and managing Vultr cloud resources.
179 lines • 9.49 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.Database = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* Provides a Vultr database resource. This can be used to create, read, modify, and delete managed databases on your Vultr account.
*
* ## Example Usage
*
* Create a new database:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vultr from "@ediri/vultr";
*
* const myDatabase = new vultr.Database("myDatabase", {
* databaseEngine: "pg",
* databaseEngineVersion: "15",
* label: "my_database_label",
* plan: "vultr-dbaas-startup-cc-1-55-2",
* region: "ewr",
* });
* ```
*
* Create a new database with options:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as vultr from "@ediri/vultr";
*
* const myDatabase = new vultr.Database("myDatabase", {
* clusterTimeZone: "America/New_York",
* databaseEngine: "pg",
* databaseEngineVersion: "15",
* label: "my_database_label",
* maintenanceDow: "sunday",
* maintenanceTime: "01:00",
* plan: "vultr-dbaas-startup-cc-1-55-2",
* region: "ewr",
* tag: "some tag",
* });
* ```
*
* ## Import
*
* Database can be imported using the database `ID`, e.g.
*
* ```sh
* $ pulumi import vultr:index/database:Database my_database b6a859c5-b299-49dd-8888-b1abbc517d08
* ```
*/
class Database extends pulumi.CustomResource {
/**
* Get an existing Database 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 Database(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Database. 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'] === Database.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessCert"] = state ? state.accessCert : undefined;
resourceInputs["accessKey"] = state ? state.accessKey : undefined;
resourceInputs["clusterTimeZone"] = state ? state.clusterTimeZone : undefined;
resourceInputs["databaseEngine"] = state ? state.databaseEngine : undefined;
resourceInputs["databaseEngineVersion"] = state ? state.databaseEngineVersion : undefined;
resourceInputs["dateCreated"] = state ? state.dateCreated : undefined;
resourceInputs["dbname"] = state ? state.dbname : undefined;
resourceInputs["evictionPolicy"] = state ? state.evictionPolicy : undefined;
resourceInputs["ferretdbCredentials"] = state ? state.ferretdbCredentials : undefined;
resourceInputs["host"] = state ? state.host : undefined;
resourceInputs["label"] = state ? state.label : undefined;
resourceInputs["latestBackup"] = state ? state.latestBackup : undefined;
resourceInputs["maintenanceDow"] = state ? state.maintenanceDow : undefined;
resourceInputs["maintenanceTime"] = state ? state.maintenanceTime : undefined;
resourceInputs["mysqlLongQueryTime"] = state ? state.mysqlLongQueryTime : undefined;
resourceInputs["mysqlRequirePrimaryKey"] = state ? state.mysqlRequirePrimaryKey : undefined;
resourceInputs["mysqlSlowQueryLog"] = state ? state.mysqlSlowQueryLog : undefined;
resourceInputs["mysqlSqlModes"] = state ? state.mysqlSqlModes : undefined;
resourceInputs["password"] = state ? state.password : undefined;
resourceInputs["plan"] = state ? state.plan : undefined;
resourceInputs["planBrokers"] = state ? state.planBrokers : undefined;
resourceInputs["planDisk"] = state ? state.planDisk : undefined;
resourceInputs["planRam"] = state ? state.planRam : undefined;
resourceInputs["planReplicas"] = state ? state.planReplicas : undefined;
resourceInputs["planVcpus"] = state ? state.planVcpus : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["publicHost"] = state ? state.publicHost : undefined;
resourceInputs["readReplicas"] = state ? state.readReplicas : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["saslPort"] = state ? state.saslPort : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["tag"] = state ? state.tag : undefined;
resourceInputs["trustedIps"] = state ? state.trustedIps : undefined;
resourceInputs["user"] = state ? state.user : undefined;
resourceInputs["vpcId"] = state ? state.vpcId : undefined;
}
else {
const args = argsOrState;
if ((!args || args.databaseEngine === undefined) && !opts.urn) {
throw new Error("Missing required property 'databaseEngine'");
}
if ((!args || args.databaseEngineVersion === undefined) && !opts.urn) {
throw new Error("Missing required property 'databaseEngineVersion'");
}
if ((!args || args.label === undefined) && !opts.urn) {
throw new Error("Missing required property 'label'");
}
if ((!args || args.plan === undefined) && !opts.urn) {
throw new Error("Missing required property 'plan'");
}
if ((!args || args.region === undefined) && !opts.urn) {
throw new Error("Missing required property 'region'");
}
resourceInputs["accessCert"] = args ? args.accessCert : undefined;
resourceInputs["accessKey"] = args ? args.accessKey : undefined;
resourceInputs["clusterTimeZone"] = args ? args.clusterTimeZone : undefined;
resourceInputs["databaseEngine"] = args ? args.databaseEngine : undefined;
resourceInputs["databaseEngineVersion"] = args ? args.databaseEngineVersion : undefined;
resourceInputs["evictionPolicy"] = args ? args.evictionPolicy : undefined;
resourceInputs["ferretdbCredentials"] = args ? args.ferretdbCredentials : undefined;
resourceInputs["label"] = args ? args.label : undefined;
resourceInputs["maintenanceDow"] = args ? args.maintenanceDow : undefined;
resourceInputs["maintenanceTime"] = args ? args.maintenanceTime : undefined;
resourceInputs["mysqlLongQueryTime"] = args ? args.mysqlLongQueryTime : undefined;
resourceInputs["mysqlRequirePrimaryKey"] = args ? args.mysqlRequirePrimaryKey : undefined;
resourceInputs["mysqlSlowQueryLog"] = args ? args.mysqlSlowQueryLog : undefined;
resourceInputs["mysqlSqlModes"] = args ? args.mysqlSqlModes : undefined;
resourceInputs["password"] = args ? args.password : undefined;
resourceInputs["plan"] = args ? args.plan : undefined;
resourceInputs["planBrokers"] = args ? args.planBrokers : undefined;
resourceInputs["planDisk"] = args ? args.planDisk : undefined;
resourceInputs["planReplicas"] = args ? args.planReplicas : undefined;
resourceInputs["publicHost"] = args ? args.publicHost : undefined;
resourceInputs["readReplicas"] = args ? args.readReplicas : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["saslPort"] = args ? args.saslPort : undefined;
resourceInputs["tag"] = args ? args.tag : undefined;
resourceInputs["trustedIps"] = args ? args.trustedIps : undefined;
resourceInputs["vpcId"] = args ? args.vpcId : undefined;
resourceInputs["dateCreated"] = undefined /*out*/;
resourceInputs["dbname"] = undefined /*out*/;
resourceInputs["host"] = undefined /*out*/;
resourceInputs["latestBackup"] = undefined /*out*/;
resourceInputs["planRam"] = undefined /*out*/;
resourceInputs["planVcpus"] = undefined /*out*/;
resourceInputs["port"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["user"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Database.__pulumiType, name, resourceInputs, opts);
}
}
exports.Database = Database;
/** @internal */
Database.__pulumiType = 'vultr:index/database:Database';
//# sourceMappingURL=database.js.map