@upcloud/pulumi-upcloud
Version:
A Pulumi package for creating and managing UpCloud resources.
144 lines • 6.74 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.ManagedDatabaseMysql = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This resource represents MySQL managed database. See UpCloud [Managed Databases](https://upcloud.com/products/managed-databases) product page for more details about the service.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as upcloud from "@upcloud/pulumi-upcloud";
*
* // Minimal config
* const example1 = new upcloud.ManagedDatabaseMysql("example_1", {
* name: "mysql-1",
* title: "mysql-1-example-1",
* plan: "1x1xCPU-2GB-25GB",
* zone: "fi-hel1",
* });
* // Shutdown instance after creation
* const example2 = new upcloud.ManagedDatabaseMysql("example_2", {
* name: "mysql-2",
* title: "mysql-2-example-2",
* plan: "1x1xCPU-2GB-25GB",
* zone: "fi-hel1",
* powered: false,
* });
* // Service with custom properties
* // Note that this basically sets strict mode off which is not normally recommended
* const example3 = new upcloud.ManagedDatabaseMysql("example_3", {
* name: "mysql-3",
* title: "mysql-3-example-3",
* plan: "1x1xCPU-2GB-25GB",
* zone: "fi-hel1",
* properties: {
* sqlMode: "NO_ENGINE_SUBSTITUTION",
* waitTimeout: 300,
* sortBufferSize: 4000000,
* maxAllowedPacket: 16000000,
* adminUsername: "admin",
* adminPassword: "<ADMIN_PASSWORD>",
* },
* });
* ```
*/
class ManagedDatabaseMysql extends pulumi.CustomResource {
/**
* Get an existing ManagedDatabaseMysql 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 ManagedDatabaseMysql(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ManagedDatabaseMysql. 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'] === ManagedDatabaseMysql.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["additionalDiskSpaceGib"] = state?.additionalDiskSpaceGib;
resourceInputs["components"] = state?.components;
resourceInputs["labels"] = state?.labels;
resourceInputs["maintenanceWindowDow"] = state?.maintenanceWindowDow;
resourceInputs["maintenanceWindowTime"] = state?.maintenanceWindowTime;
resourceInputs["name"] = state?.name;
resourceInputs["networks"] = state?.networks;
resourceInputs["nodeStates"] = state?.nodeStates;
resourceInputs["plan"] = state?.plan;
resourceInputs["powered"] = state?.powered;
resourceInputs["primaryDatabase"] = state?.primaryDatabase;
resourceInputs["properties"] = state?.properties;
resourceInputs["serviceHost"] = state?.serviceHost;
resourceInputs["servicePassword"] = state?.servicePassword;
resourceInputs["servicePort"] = state?.servicePort;
resourceInputs["serviceUri"] = state?.serviceUri;
resourceInputs["serviceUsername"] = state?.serviceUsername;
resourceInputs["state"] = state?.state;
resourceInputs["terminationProtection"] = state?.terminationProtection;
resourceInputs["title"] = state?.title;
resourceInputs["type"] = state?.type;
resourceInputs["zone"] = state?.zone;
}
else {
const args = argsOrState;
if (args?.plan === undefined && !opts.urn) {
throw new Error("Missing required property 'plan'");
}
if (args?.title === undefined && !opts.urn) {
throw new Error("Missing required property 'title'");
}
if (args?.zone === undefined && !opts.urn) {
throw new Error("Missing required property 'zone'");
}
resourceInputs["additionalDiskSpaceGib"] = args?.additionalDiskSpaceGib;
resourceInputs["labels"] = args?.labels;
resourceInputs["maintenanceWindowDow"] = args?.maintenanceWindowDow;
resourceInputs["maintenanceWindowTime"] = args?.maintenanceWindowTime;
resourceInputs["name"] = args?.name;
resourceInputs["networks"] = args?.networks;
resourceInputs["plan"] = args?.plan;
resourceInputs["powered"] = args?.powered;
resourceInputs["properties"] = args?.properties;
resourceInputs["terminationProtection"] = args?.terminationProtection;
resourceInputs["title"] = args?.title;
resourceInputs["zone"] = args?.zone;
resourceInputs["components"] = undefined /*out*/;
resourceInputs["nodeStates"] = undefined /*out*/;
resourceInputs["primaryDatabase"] = undefined /*out*/;
resourceInputs["serviceHost"] = undefined /*out*/;
resourceInputs["servicePassword"] = undefined /*out*/;
resourceInputs["servicePort"] = undefined /*out*/;
resourceInputs["serviceUri"] = undefined /*out*/;
resourceInputs["serviceUsername"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["servicePassword", "serviceUri"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(ManagedDatabaseMysql.__pulumiType, name, resourceInputs, opts);
}
}
exports.ManagedDatabaseMysql = ManagedDatabaseMysql;
/** @internal */
ManagedDatabaseMysql.__pulumiType = 'upcloud:index/managedDatabaseMysql:ManagedDatabaseMysql';
//# sourceMappingURL=managedDatabaseMysql.js.map