@huaweicloudos/pulumi
Version:
A Pulumi package for creating and managing Huaweicloud cloud resources.
301 lines • 12.2 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.Vault = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a CBR vault resource within HuaweiCloud.
*
* ## Example Usage
* ### Create a server type vault
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vaultName = config.requireObject("vaultName");
* const ecsInstanceId = config.requireObject("ecsInstanceId");
* const attachedVolumeIds = config.requireObject("attachedVolumeIds");
* const test = new huaweicloud.cbr.Vault("test", {
* type: "server",
* protectionType: "backup",
* consistentLevel: "crash_consistent",
* size: 100,
* resources: [{
* serverId: ecsInstanceId,
* excludes: attachedVolumeIds,
* }],
* tags: {
* foo: "bar",
* },
* });
* ```
* ### Create a server type vault and associate backup and reprecation policies
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const destinationRegion = config.requireObject("destinationRegion");
* const destinationVaultName = config.requireObject("destinationVaultName");
* const vaultName = config.requireObject("vaultName");
* const backupPolicyId = config.requireObject("backupPolicyId");
* const replicationPolicyId = config.requireObject("replicationPolicyId");
* const destination = new huaweicloud.cbr.Vault("destination", {
* region: destinationRegion,
* type: "server",
* protectionType: "replication",
* size: 500,
* });
* const test = new huaweicloud.cbr.Vault("test", {
* type: "server",
* protectionType: "backup",
* consistentLevel: "crash_consistent",
* size: 500,
* autoBind: true,
* bindRules: {
* service_name: "xxx",
* },
* policies: [
* {
* id: backupPolicyId,
* },
* {
* id: replicationPolicyId,
* destinationVaultId: destination.id,
* },
* ],
* });
* ```
* ### Create a disk type vault
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vaultName = config.requireObject("vaultName");
* const evsVolumeIds = config.requireObject("evsVolumeIds");
* const test = new huaweicloud.cbr.Vault("test", {
* type: "disk",
* protectionType: "backup",
* size: 50,
* autoExpand: true,
* resources: [{
* includes: evsVolumeIds,
* }],
* tags: {
* foo: "bar",
* },
* });
* ```
* ### Create an SFS turbo type vault
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vaultName = config.requireObject("vaultName");
* const sfsTurboIds = config.requireObject("sfsTurboIds");
* const test = new huaweicloud.cbr.Vault("test", {
* type: "turbo",
* protectionType: "backup",
* size: 1000,
* resources: [{
* includes: sfsTurboIds,
* }],
* tags: {
* foo: "bar",
* },
* });
* ```
* ### Create an SFS turbo type vault with replicate protection type
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vaultName = config.requireObject("vaultName");
* const test = new huaweicloud.cbr.Vault("test", {
* type: "turbo",
* protectionType: "replication",
* size: 1000,
* });
* ```
* ### Create a Workspace type vault
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vaultName = config.requireObject("vaultName");
* const test = new huaweicloud.cbr.Vault("test", {
* type: "workspace",
* protectionType: "backup",
* size: 100,
* consistentLevel: "crash_consistent",
* });
* ```
* ### Create a VMware type vault
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vaultName = config.requireObject("vaultName");
* const test = new huaweicloud.cbr.Vault("test", {
* type: "vmware",
* protectionType: "backup",
* size: 100,
* consistentLevel: "crash_consistent",
* });
* ```
* ### Create a file type vault
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as pulumi from "@huaweicloudos/pulumi";
*
* const config = new pulumi.Config();
* const vaultName = config.requireObject("vaultName");
* const test = new huaweicloud.cbr.Vault("test", {
* type: "file",
* protectionType: "backup",
* size: 100,
* consistentLevel: "crash_consistent",
* });
* ```
*
* ## Import
*
* Vaults can be imported by their `id`. For example, bash
*
* ```sh
* $ pulumi import huaweicloud:Cbr/vault:Vault test 01c33779-7c83-4182-8b6b-24a671fcedf8
* ```
*
* Note that the imported state may not be identical to your resource definition, due to some attributes missing from the API response, security or some other reason. The missing attributes include`period_unit`, `period`, `auto_renew`. It is generally recommended running `terraform plan` after importing a vault. You can then decide if changes should be applied to the vault, or the resource definition should be updated to align with the vault. Also you can ignore changes as below. hcl resource "huaweicloud_cbr_vault" "test" {
*
* ...
*
* lifecycle {
*
* ignore_changes = [
*
* period_unit, period, auto_renew,
*
* ]
*
* } }
*/
class Vault extends pulumi.CustomResource {
/**
* Get an existing Vault 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 Vault(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Vault. 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'] === Vault.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allocated"] = state ? state.allocated : undefined;
resourceInputs["autoBind"] = state ? state.autoBind : undefined;
resourceInputs["autoExpand"] = state ? state.autoExpand : undefined;
resourceInputs["autoPay"] = state ? state.autoPay : undefined;
resourceInputs["autoRenew"] = state ? state.autoRenew : undefined;
resourceInputs["backupNamePrefix"] = state ? state.backupNamePrefix : undefined;
resourceInputs["bindRules"] = state ? state.bindRules : undefined;
resourceInputs["chargingMode"] = state ? state.chargingMode : undefined;
resourceInputs["cloudType"] = state ? state.cloudType : undefined;
resourceInputs["consistentLevel"] = state ? state.consistentLevel : undefined;
resourceInputs["enterpriseProjectId"] = state ? state.enterpriseProjectId : undefined;
resourceInputs["isMultiAz"] = state ? state.isMultiAz : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["period"] = state ? state.period : undefined;
resourceInputs["periodUnit"] = state ? state.periodUnit : undefined;
resourceInputs["policies"] = state ? state.policies : undefined;
resourceInputs["policyId"] = state ? state.policyId : undefined;
resourceInputs["protectionType"] = state ? state.protectionType : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["resources"] = state ? state.resources : undefined;
resourceInputs["size"] = state ? state.size : undefined;
resourceInputs["specCode"] = state ? state.specCode : undefined;
resourceInputs["status"] = state ? state.status : undefined;
resourceInputs["storage"] = state ? state.storage : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["used"] = state ? state.used : undefined;
}
else {
const args = argsOrState;
if ((!args || args.protectionType === undefined) && !opts.urn) {
throw new Error("Missing required property 'protectionType'");
}
if ((!args || args.size === undefined) && !opts.urn) {
throw new Error("Missing required property 'size'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["autoBind"] = args ? args.autoBind : undefined;
resourceInputs["autoExpand"] = args ? args.autoExpand : undefined;
resourceInputs["autoPay"] = args ? args.autoPay : undefined;
resourceInputs["autoRenew"] = args ? args.autoRenew : undefined;
resourceInputs["backupNamePrefix"] = args ? args.backupNamePrefix : undefined;
resourceInputs["bindRules"] = args ? args.bindRules : undefined;
resourceInputs["chargingMode"] = args ? args.chargingMode : undefined;
resourceInputs["cloudType"] = args ? args.cloudType : undefined;
resourceInputs["consistentLevel"] = args ? args.consistentLevel : undefined;
resourceInputs["enterpriseProjectId"] = args ? args.enterpriseProjectId : undefined;
resourceInputs["isMultiAz"] = args ? args.isMultiAz : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["period"] = args ? args.period : undefined;
resourceInputs["periodUnit"] = args ? args.periodUnit : undefined;
resourceInputs["policies"] = args ? args.policies : undefined;
resourceInputs["policyId"] = args ? args.policyId : undefined;
resourceInputs["protectionType"] = args ? args.protectionType : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["resources"] = args ? args.resources : undefined;
resourceInputs["size"] = args ? args.size : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["allocated"] = undefined /*out*/;
resourceInputs["specCode"] = undefined /*out*/;
resourceInputs["status"] = undefined /*out*/;
resourceInputs["storage"] = undefined /*out*/;
resourceInputs["used"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Vault.__pulumiType, name, resourceInputs, opts);
}
}
exports.Vault = Vault;
/** @internal */
Vault.__pulumiType = 'huaweicloud:Cbr/vault:Vault';
//# sourceMappingURL=vault.js.map