UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

638 lines (637 loc) 22.5 kB
import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "../types"; /** * 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, * * ] * * } } */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: VaultState, opts?: pulumi.CustomResourceOptions): Vault; /** * 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: any): obj is Vault; /** * The allocated capacity of the vault, in GB. */ readonly allocated: pulumi.Output<number>; /** * Specifies whether automatic association is enabled. Defaults to **false**. */ readonly autoBind: pulumi.Output<boolean>; /** * Specifies to enable auto capacity expansion for the backup protection type vault. * Defaults to **false**. */ readonly autoExpand: pulumi.Output<boolean>; /** * @deprecated Deprecated */ readonly autoPay: pulumi.Output<string | undefined>; /** * Specifies whether auto renew is enabled. * Valid values are **true** and **false**. Defaults to **false**. */ readonly autoRenew: pulumi.Output<string | undefined>; /** * Specifies the backup name prefix. * Changing this will create a new vault. */ readonly backupNamePrefix: pulumi.Output<string>; /** * Specifies the tags to filter resources for automatic association with **auto_bind**. */ readonly bindRules: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Specifies the charging mode of the vault. * The valid values are as follows: * + **prePaid**: the yearly/monthly billing mode. * + **postPaid**: the pay-per-use billing mode. */ readonly chargingMode: pulumi.Output<string>; /** * Specifies the cloud type of the vault. * Changing this will create a new vault. */ readonly cloudType: pulumi.Output<string>; /** * Specifies the consistent level (specification) of the vault. * The valid values are as follows: * + **[crashConsistent](https://support.huaweicloud.com/intl/en-us/usermanual-cbr/cbr_03_0109.html)** * + **[appConsistent](https://support.huaweicloud.com/intl/en-us/usermanual-cbr/cbr_03_0109.html)** */ readonly consistentLevel: pulumi.Output<string | undefined>; /** * Specifies the ID of the enterprise project to which the vault belongs. */ readonly enterpriseProjectId: pulumi.Output<string>; /** * Specifies whether multiple availability zones are used for backing up. * Defaults to **false**. */ readonly isMultiAz: pulumi.Output<boolean>; /** * Specifies a unique name of the CBR vault. This parameter can contain a maximum of 64 * characters, which may consist of letters, digits, underscores(_) and hyphens (-). */ readonly name: pulumi.Output<string>; /** * Specifies the charging period of the vault. * If `periodUnit` is set to **month**, the value ranges from 1 to 9. * If `periodUnit` is set to **year**, the value ranges from 1 to 5. * This parameter is mandatory if `chargingMode` is set to **prePaid**. * Changing this will create a new vault. */ readonly period: pulumi.Output<number | undefined>; /** * Specifies the charging period unit of the vault. * Valid values are **month** and **year**. This parameter is mandatory if `chargingMode` is set to **prePaid**. * Changing this will create a new vault. */ readonly periodUnit: pulumi.Output<string | undefined>; /** * Specifies the policy details to associate with the CBR vault. * The object structure is documented below. */ readonly policies: pulumi.Output<outputs.Cbr.VaultPolicy[]>; /** * schema:Deprecated; Using parameter 'policy' instead. */ readonly policyId: pulumi.Output<string | undefined>; /** * Specifies the protection type of the CBR vault. * The valid values are **backup** and **replication**. Vaults of type **disk** don't support **replication**. * Changing this will create a new vault. */ readonly protectionType: pulumi.Output<string>; /** * Specifies the region in which to create the CBR vault. If omitted, the * provider-level region will be used. Changing this will create a new vault. */ readonly region: pulumi.Output<string>; /** * Specifies an array of one or more resources to attach to the CBR vault. * This feature is not supported for the **vmware** type and the **file** type. * The object structure is documented below. */ readonly resources: pulumi.Output<outputs.Cbr.VaultResource[]>; /** * Specifies the vault capacity, in GB. The valid value range is `1` to `10,485,760`. */ readonly size: pulumi.Output<number>; /** * The specification code. */ readonly specCode: pulumi.Output<string>; /** * The vault status. */ readonly status: pulumi.Output<string>; /** * The name of the bucket for the vault. */ readonly storage: pulumi.Output<string>; /** * Specifies the key/value pairs to associate with the CBR vault. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Specifies the object type of the CBR vault. * Changing this will create a new vault. Valid values are as follows: * + **server** (Elastic Cloud Server) * + **disk** (EVS Disk) * + **turbo** (SFS Turbo file system) * + **workspace** (Workspace Desktop) * + **vmware** (VMware) * + **file** (File System) */ readonly type: pulumi.Output<string>; /** * The used capacity, in GB. */ readonly used: pulumi.Output<number>; /** * Create a Vault resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: VaultArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Vault resources. */ export interface VaultState { /** * The allocated capacity of the vault, in GB. */ allocated?: pulumi.Input<number>; /** * Specifies whether automatic association is enabled. Defaults to **false**. */ autoBind?: pulumi.Input<boolean>; /** * Specifies to enable auto capacity expansion for the backup protection type vault. * Defaults to **false**. */ autoExpand?: pulumi.Input<boolean>; /** * @deprecated Deprecated */ autoPay?: pulumi.Input<string>; /** * Specifies whether auto renew is enabled. * Valid values are **true** and **false**. Defaults to **false**. */ autoRenew?: pulumi.Input<string>; /** * Specifies the backup name prefix. * Changing this will create a new vault. */ backupNamePrefix?: pulumi.Input<string>; /** * Specifies the tags to filter resources for automatic association with **auto_bind**. */ bindRules?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Specifies the charging mode of the vault. * The valid values are as follows: * + **prePaid**: the yearly/monthly billing mode. * + **postPaid**: the pay-per-use billing mode. */ chargingMode?: pulumi.Input<string>; /** * Specifies the cloud type of the vault. * Changing this will create a new vault. */ cloudType?: pulumi.Input<string>; /** * Specifies the consistent level (specification) of the vault. * The valid values are as follows: * + **[crashConsistent](https://support.huaweicloud.com/intl/en-us/usermanual-cbr/cbr_03_0109.html)** * + **[appConsistent](https://support.huaweicloud.com/intl/en-us/usermanual-cbr/cbr_03_0109.html)** */ consistentLevel?: pulumi.Input<string>; /** * Specifies the ID of the enterprise project to which the vault belongs. */ enterpriseProjectId?: pulumi.Input<string>; /** * Specifies whether multiple availability zones are used for backing up. * Defaults to **false**. */ isMultiAz?: pulumi.Input<boolean>; /** * Specifies a unique name of the CBR vault. This parameter can contain a maximum of 64 * characters, which may consist of letters, digits, underscores(_) and hyphens (-). */ name?: pulumi.Input<string>; /** * Specifies the charging period of the vault. * If `periodUnit` is set to **month**, the value ranges from 1 to 9. * If `periodUnit` is set to **year**, the value ranges from 1 to 5. * This parameter is mandatory if `chargingMode` is set to **prePaid**. * Changing this will create a new vault. */ period?: pulumi.Input<number>; /** * Specifies the charging period unit of the vault. * Valid values are **month** and **year**. This parameter is mandatory if `chargingMode` is set to **prePaid**. * Changing this will create a new vault. */ periodUnit?: pulumi.Input<string>; /** * Specifies the policy details to associate with the CBR vault. * The object structure is documented below. */ policies?: pulumi.Input<pulumi.Input<inputs.Cbr.VaultPolicy>[]>; /** * schema:Deprecated; Using parameter 'policy' instead. */ policyId?: pulumi.Input<string>; /** * Specifies the protection type of the CBR vault. * The valid values are **backup** and **replication**. Vaults of type **disk** don't support **replication**. * Changing this will create a new vault. */ protectionType?: pulumi.Input<string>; /** * Specifies the region in which to create the CBR vault. If omitted, the * provider-level region will be used. Changing this will create a new vault. */ region?: pulumi.Input<string>; /** * Specifies an array of one or more resources to attach to the CBR vault. * This feature is not supported for the **vmware** type and the **file** type. * The object structure is documented below. */ resources?: pulumi.Input<pulumi.Input<inputs.Cbr.VaultResource>[]>; /** * Specifies the vault capacity, in GB. The valid value range is `1` to `10,485,760`. */ size?: pulumi.Input<number>; /** * The specification code. */ specCode?: pulumi.Input<string>; /** * The vault status. */ status?: pulumi.Input<string>; /** * The name of the bucket for the vault. */ storage?: pulumi.Input<string>; /** * Specifies the key/value pairs to associate with the CBR vault. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Specifies the object type of the CBR vault. * Changing this will create a new vault. Valid values are as follows: * + **server** (Elastic Cloud Server) * + **disk** (EVS Disk) * + **turbo** (SFS Turbo file system) * + **workspace** (Workspace Desktop) * + **vmware** (VMware) * + **file** (File System) */ type?: pulumi.Input<string>; /** * The used capacity, in GB. */ used?: pulumi.Input<number>; } /** * The set of arguments for constructing a Vault resource. */ export interface VaultArgs { /** * Specifies whether automatic association is enabled. Defaults to **false**. */ autoBind?: pulumi.Input<boolean>; /** * Specifies to enable auto capacity expansion for the backup protection type vault. * Defaults to **false**. */ autoExpand?: pulumi.Input<boolean>; /** * @deprecated Deprecated */ autoPay?: pulumi.Input<string>; /** * Specifies whether auto renew is enabled. * Valid values are **true** and **false**. Defaults to **false**. */ autoRenew?: pulumi.Input<string>; /** * Specifies the backup name prefix. * Changing this will create a new vault. */ backupNamePrefix?: pulumi.Input<string>; /** * Specifies the tags to filter resources for automatic association with **auto_bind**. */ bindRules?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Specifies the charging mode of the vault. * The valid values are as follows: * + **prePaid**: the yearly/monthly billing mode. * + **postPaid**: the pay-per-use billing mode. */ chargingMode?: pulumi.Input<string>; /** * Specifies the cloud type of the vault. * Changing this will create a new vault. */ cloudType?: pulumi.Input<string>; /** * Specifies the consistent level (specification) of the vault. * The valid values are as follows: * + **[crashConsistent](https://support.huaweicloud.com/intl/en-us/usermanual-cbr/cbr_03_0109.html)** * + **[appConsistent](https://support.huaweicloud.com/intl/en-us/usermanual-cbr/cbr_03_0109.html)** */ consistentLevel?: pulumi.Input<string>; /** * Specifies the ID of the enterprise project to which the vault belongs. */ enterpriseProjectId?: pulumi.Input<string>; /** * Specifies whether multiple availability zones are used for backing up. * Defaults to **false**. */ isMultiAz?: pulumi.Input<boolean>; /** * Specifies a unique name of the CBR vault. This parameter can contain a maximum of 64 * characters, which may consist of letters, digits, underscores(_) and hyphens (-). */ name?: pulumi.Input<string>; /** * Specifies the charging period of the vault. * If `periodUnit` is set to **month**, the value ranges from 1 to 9. * If `periodUnit` is set to **year**, the value ranges from 1 to 5. * This parameter is mandatory if `chargingMode` is set to **prePaid**. * Changing this will create a new vault. */ period?: pulumi.Input<number>; /** * Specifies the charging period unit of the vault. * Valid values are **month** and **year**. This parameter is mandatory if `chargingMode` is set to **prePaid**. * Changing this will create a new vault. */ periodUnit?: pulumi.Input<string>; /** * Specifies the policy details to associate with the CBR vault. * The object structure is documented below. */ policies?: pulumi.Input<pulumi.Input<inputs.Cbr.VaultPolicy>[]>; /** * schema:Deprecated; Using parameter 'policy' instead. */ policyId?: pulumi.Input<string>; /** * Specifies the protection type of the CBR vault. * The valid values are **backup** and **replication**. Vaults of type **disk** don't support **replication**. * Changing this will create a new vault. */ protectionType: pulumi.Input<string>; /** * Specifies the region in which to create the CBR vault. If omitted, the * provider-level region will be used. Changing this will create a new vault. */ region?: pulumi.Input<string>; /** * Specifies an array of one or more resources to attach to the CBR vault. * This feature is not supported for the **vmware** type and the **file** type. * The object structure is documented below. */ resources?: pulumi.Input<pulumi.Input<inputs.Cbr.VaultResource>[]>; /** * Specifies the vault capacity, in GB. The valid value range is `1` to `10,485,760`. */ size: pulumi.Input<number>; /** * Specifies the key/value pairs to associate with the CBR vault. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Specifies the object type of the CBR vault. * Changing this will create a new vault. Valid values are as follows: * + **server** (Elastic Cloud Server) * + **disk** (EVS Disk) * + **turbo** (SFS Turbo file system) * + **workspace** (Workspace Desktop) * + **vmware** (VMware) * + **file** (File System) */ type: pulumi.Input<string>; }