@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
105 lines • 4.59 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.Restore = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an RDS instance restore resource within HuaweiCloud.
*
* ## Example Usage
* ### restore by backupId
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const targetInstanceId = config.requireObject("targetInstanceId");
* const sourceInstanceId = config.requireObject("sourceInstanceId");
* const backupId = config.requireObject("backupId");
* const test = new huaweicloud.rds.Restore("test", {
* targetInstanceId: targetInstanceId,
* sourceInstanceId: sourceInstanceId,
* type: "backup",
* backupId: backupId,
* });
* ```
* ### restore by timestamp
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const targetInstanceId = config.requireObject("targetInstanceId");
* const sourceInstanceId = config.requireObject("sourceInstanceId");
* const test = new huaweicloud.rds.Restore("test", {
* targetInstanceId: targetInstanceId,
* sourceInstanceId: sourceInstanceId,
* type: "timestamp",
* restoreTime: 1673852043000,
* });
* ```
*/
class Restore extends pulumi.CustomResource {
/**
* Get an existing Restore 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 Restore(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Restore. 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'] === Restore.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["backupId"] = state ? state.backupId : undefined;
resourceInputs["databaseName"] = state ? state.databaseName : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["restoreTime"] = state ? state.restoreTime : undefined;
resourceInputs["sourceInstanceId"] = state ? state.sourceInstanceId : undefined;
resourceInputs["targetInstanceId"] = state ? state.targetInstanceId : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.sourceInstanceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'sourceInstanceId'");
}
if ((!args || args.targetInstanceId === undefined) && !opts.urn) {
throw new Error("Missing required property 'targetInstanceId'");
}
resourceInputs["backupId"] = args ? args.backupId : undefined;
resourceInputs["databaseName"] = args ? args.databaseName : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["restoreTime"] = args ? args.restoreTime : undefined;
resourceInputs["sourceInstanceId"] = args ? args.sourceInstanceId : undefined;
resourceInputs["targetInstanceId"] = args ? args.targetInstanceId : undefined;
resourceInputs["type"] = args ? args.type : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Restore.__pulumiType, name, resourceInputs, opts);
}
}
exports.Restore = Restore;
/** @internal */
Restore.__pulumiType = 'huaweicloud:Rds/restore:Restore';
//# sourceMappingURL=restore.js.map