@pulumi/linode
Version:
A Pulumi package for creating and managing linode cloud resources.
178 lines • 8.51 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatabasePostgresql = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* > **DEPRECATION NOTICE:** This resource has been deprecated. Please use linode.DatabasePostgresqlV2 for all future implementations.
*
* Provides a Linode PostgreSQL Database resource. This can be used to create, modify, and delete Linode PostgreSQL Databases.
* For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-databases-postgre-sql-instances).
*
* Please keep in mind that Managed Databases can take up to an hour to provision.
*
* ## Example Usage
*
* Creating a simple PostgreSQL database instance:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foobar = new linode.DatabasePostgresql("foobar", {
* label: "mydatabase",
* engineId: "postgresql/13.2",
* region: "us-southeast",
* type: "g6-nanode-1",
* });
* ```
*
* Creating a complex PostgreSQL database instance:
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as linode from "@pulumi/linode";
*
* const foobar = new linode.DatabasePostgresql("foobar", {
* label: "mydatabase",
* engineId: "postgresql/13.2",
* region: "us-southeast",
* type: "g6-nanode-1",
* allowLists: ["0.0.0.0/0"],
* clusterSize: 3,
* encrypted: true,
* replicationType: "semi_synch",
* replicationCommitType: "remote_write",
* sslConnection: true,
* updates: {
* dayOfWeek: "saturday",
* duration: 1,
* frequency: "monthly",
* hourOfDay: 22,
* weekOfMonth: 2,
* },
* });
* ```
*
* ## updates
*
* The following arguments are supported in the `updates` specification block:
*
* * `dayOfWeek` - (Required) The day to perform maintenance. (`monday`, `tuesday`, ...)
*
* * `duration` - (Required) The maximum maintenance window time in hours. (`1`..`3`)
*
* * `frequency` - (Required) Whether maintenance occurs on a weekly or monthly basis. (`weekly`, `monthly`)
*
* * `hourOfDay` - (Required) The hour to begin maintenance based in UTC time. (`0`..`23`)
*
* * `weekOfMonth` - (Optional) The week of the month to perform monthly frequency updates. Required for `monthly` frequency updates. (`1`..`4`)
*
* ## Import
*
* Linode PostgreSQL Databases can be imported using the `id`, e.g.
*
* ```sh
* $ pulumi import linode:index/databasePostgresql:DatabasePostgresql foobar 1234567
* ```
*/
class DatabasePostgresql extends pulumi.CustomResource {
/**
* Get an existing DatabasePostgresql 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 DatabasePostgresql(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of DatabasePostgresql. 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'] === DatabasePostgresql.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowLists"] = state ? state.allowLists : undefined;
resourceInputs["caCert"] = state ? state.caCert : undefined;
resourceInputs["clusterSize"] = state ? state.clusterSize : undefined;
resourceInputs["created"] = state ? state.created : undefined;
resourceInputs["encrypted"] = state ? state.encrypted : undefined;
resourceInputs["engine"] = state ? state.engine : undefined;
resourceInputs["engineId"] = state ? state.engineId : undefined;
resourceInputs["hostPrimary"] = state ? state.hostPrimary : undefined;
resourceInputs["hostSecondary"] = state ? state.hostSecondary : undefined;
resourceInputs["label"] = state ? state.label : undefined;
resourceInputs["port"] = state ? state.port : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["replicationCommitType"] = state ? state.replicationCommitType : undefined;
resourceInputs["replicationType"] = state ? state.replicationType : undefined;
resourceInputs["rootPassword"] = state ? state.rootPassword : undefined;
resourceInputs["rootUsername"] = state ? state.rootUsername : undefined;
resourceInputs["sslConnection"] = state ? state.sslConnection : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["updated"] = state ? state.updated : undefined;
resourceInputs["updates"] = state ? state.updates : undefined;
resourceInputs["version"] = state ? state.version : undefined;
}
else {
const args = argsOrState;
if ((!args || args.engineId === undefined) && !opts.urn) {
throw new Error("Missing required property 'engineId'");
}
if ((!args || args.label === undefined) && !opts.urn) {
throw new Error("Missing required property 'label'");
}
if ((!args || args.region === undefined) && !opts.urn) {
throw new Error("Missing required property 'region'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["allowLists"] = args ? args.allowLists : undefined;
resourceInputs["clusterSize"] = args ? args.clusterSize : undefined;
resourceInputs["encrypted"] = args ? args.encrypted : undefined;
resourceInputs["engineId"] = args ? args.engineId : undefined;
resourceInputs["label"] = args ? args.label : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["replicationCommitType"] = args ? args.replicationCommitType : undefined;
resourceInputs["replicationType"] = args ? args.replicationType : undefined;
resourceInputs["sslConnection"] = args ? args.sslConnection : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["updates"] = args ? args.updates : undefined;
resourceInputs["caCert"] = undefined /*out*/;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["engine"] = undefined /*out*/;
resourceInputs["hostPrimary"] = undefined /*out*/;
resourceInputs["hostSecondary"] = undefined /*out*/;
resourceInputs["port"] = undefined /*out*/;
resourceInputs["rootPassword"] = undefined /*out*/;
resourceInputs["rootUsername"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["updated"] = undefined /*out*/;
resourceInputs["version"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["caCert", "rootPassword", "rootUsername"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(DatabasePostgresql.__pulumiType, name, resourceInputs, opts);
}
}
exports.DatabasePostgresql = DatabasePostgresql;
/** @internal */
DatabasePostgresql.__pulumiType = 'linode:index/databasePostgresql:DatabasePostgresql';
//# sourceMappingURL=databasePostgresql.js.map