@pulumiverse/scaleway
Version:
A Pulumi package for creating and managing Scaleway cloud resources.
180 lines • 6.91 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Snapshot = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Creates and manages Scaleway RDB (Relational Database) Snapshots.
* Snapshots are point-in-time backups of a database instance that can be used for recovery or duplication.
* For more information, refer to [the API documentation](https://www.scaleway.com/en/developers/api/managed-database-postgre-mysql/).
*
* ## Example Usage
*
* ### Example Basic Snapshot
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const main = new scaleway.databases.Instance("main", {
* name: "test-rdb-instance",
* nodeType: "db-dev-s",
* engine: "PostgreSQL-15",
* isHaCluster: false,
* disableBackup: true,
* userName: "my_initial_user",
* password: "thiZ_is_v&ry_s3cret",
* tags: [
* "terraform-test",
* "scaleway_rdb_instance",
* "minimal",
* ],
* volumeType: "sbs_5k",
* volumeSizeInGb: 10,
* });
* const test = new scaleway.databases.Snapshot("test", {
* name: "initial-snapshot",
* instanceId: main.id,
* }, {
* dependsOn: [main],
* });
* ```
*
* ### Example with Expiration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const snapshotWithExpiration = new scaleway.databases.Snapshot("snapshot_with_expiration", {
* name: "snapshot-with-expiration",
* instanceId: main.id,
* expiresAt: "2025-01-31T00:00:00Z",
* });
* ```
*
* ### Example with Multiple Snapshots
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as scaleway from "@pulumiverse/scaleway";
*
* const snapshotA = new scaleway.databases.Snapshot("snapshot_a", {
* name: "snapshot_a",
* instanceId: main.id,
* }, {
* dependsOn: [main],
* });
* const snapshotB = new scaleway.databases.Snapshot("snapshot_b", {
* name: "snapshot_b",
* instanceId: main.id,
* expiresAt: "2025-02-07T00:00:00Z",
* }, {
* dependsOn: [main],
* });
* ```
*
* ## Limitations
*
* - Snapshots are tied to the database instance and region where they are created.
* - Expired snapshots are automatically deleted and cannot be restored.
*
* ## Notes
*
* - Ensure the `instanceId` corresponds to an existing database instance.
* - Use the `dependsOn` argument when creating snapshots right after creating an instance to ensure proper dependency management.
*
* ## Import
*
* RDB Snapshots can be imported using the `{region}/{snapshot_id}` format.
*/
class Snapshot extends pulumi.CustomResource {
/**
* Get an existing Snapshot 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 Snapshot(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'scaleway:databases/snapshot:Snapshot';
/**
* Returns true if the given object is an instance of Snapshot. 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'] === Snapshot.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["expiresAt"] = state?.expiresAt;
resourceInputs["instanceId"] = state?.instanceId;
resourceInputs["name"] = state?.name;
resourceInputs["nodeType"] = state?.nodeType;
resourceInputs["region"] = state?.region;
resourceInputs["size"] = state?.size;
resourceInputs["status"] = state?.status;
resourceInputs["updatedAt"] = state?.updatedAt;
resourceInputs["volumeType"] = state?.volumeType;
}
else {
const args = argsOrState;
if (args?.instanceId === undefined && !opts.urn) {
throw new Error("Missing required property 'instanceId'");
}
resourceInputs["expiresAt"] = args?.expiresAt;
resourceInputs["instanceId"] = args?.instanceId;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["nodeType"] = undefined /*out*/;
resourceInputs["size"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
resourceInputs["volumeType"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const aliasOpts = { aliases: [{ type: "scaleway:index/rdbSnapshot:RdbSnapshot" }] };
opts = pulumi.mergeOptions(opts, aliasOpts);
super(Snapshot.__pulumiType, name, resourceInputs, opts);
}
}
exports.Snapshot = Snapshot;
//# sourceMappingURL=snapshot.js.map