@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
138 lines • 5.86 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.Policy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a backup policy for backing up vault objects within HuaweiCloud.
*
* ## Example Usage
* ### Create a backup policy (weekly backup)
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const policyName = config.requireObject("policyName");
* const test = new huaweicloud.cbr.Policy("test", {
* type: "backup",
* timePeriod: 20,
* timeZone: "UTC+08:00",
* longTermRetention: {
* daily: 10,
* weekly: 10,
* monthly: 1,
* fullBackupInterval: -1,
* },
* backupCycle: {
* days: "SA,SU",
* executionTimes: [
* "08:00",
* "20:00",
* ],
* },
* });
* ```
* ### Create a replication policy (periodic backup)
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const policyName = config.requireObject("policyName");
* const destinationRegion = config.requireObject("destinationRegion");
* const destinationProjectId = config.requireObject("destinationProjectId");
* const test = new huaweicloud.cbr.Policy("test", {
* type: "replication",
* destinationRegion: destinationRegion,
* destinationProjectId: destinationProjectId,
* backupQuantity: 20,
* backupCycle: {
* interval: 5,
* executionTimes: ["21:00"],
* },
* });
* ```
*
* ## Import
*
* Policies can be imported by their `id`, e.g. bash
*
* ```sh
* $ pulumi import huaweicloud:Cbr/policy:Policy test <id>
* ```
*/
class Policy extends pulumi.CustomResource {
/**
* Get an existing Policy 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 Policy(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Policy. 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'] === Policy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["backupCycle"] = state ? state.backupCycle : undefined;
resourceInputs["backupQuantity"] = state ? state.backupQuantity : undefined;
resourceInputs["destinationProjectId"] = state ? state.destinationProjectId : undefined;
resourceInputs["destinationRegion"] = state ? state.destinationRegion : undefined;
resourceInputs["enableAcceleration"] = state ? state.enableAcceleration : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["longTermRetention"] = state ? state.longTermRetention : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["timePeriod"] = state ? state.timePeriod : undefined;
resourceInputs["timeZone"] = state ? state.timeZone : undefined;
resourceInputs["type"] = state ? state.type : undefined;
}
else {
const args = argsOrState;
if ((!args || args.backupCycle === undefined) && !opts.urn) {
throw new Error("Missing required property 'backupCycle'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["backupCycle"] = args ? args.backupCycle : undefined;
resourceInputs["backupQuantity"] = args ? args.backupQuantity : undefined;
resourceInputs["destinationProjectId"] = args ? args.destinationProjectId : undefined;
resourceInputs["destinationRegion"] = args ? args.destinationRegion : undefined;
resourceInputs["enableAcceleration"] = args ? args.enableAcceleration : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["longTermRetention"] = args ? args.longTermRetention : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["timePeriod"] = args ? args.timePeriod : undefined;
resourceInputs["timeZone"] = args ? args.timeZone : undefined;
resourceInputs["type"] = args ? args.type : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Policy.__pulumiType, name, resourceInputs, opts);
}
}
exports.Policy = Policy;
/** @internal */
Policy.__pulumiType = 'huaweicloud:Cbr/policy:Policy';
//# sourceMappingURL=policy.js.map