UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

279 lines (278 loc) 10.6 kB
import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "../types"; /** * 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> * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: PolicyState, opts?: pulumi.CustomResourceOptions): Policy; /** * 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: any): obj is Policy; /** * Specifies the scheduling rule for the policy backup execution. * The object structure is documented below. */ readonly backupCycle: pulumi.Output<outputs.Cbr.PolicyBackupCycle>; /** * Specifies the maximum number of retained backups. The value ranges from `2` to * `99,999`. This parameter and `timePeriod` are alternative. */ readonly backupQuantity: pulumi.Output<number | undefined>; /** * Specifies the ID of the replication destination project, which is * mandatory for cross-region replication. Required if `protectionType` is **replication**. */ readonly destinationProjectId: pulumi.Output<string | undefined>; /** * Specifies the name of the replication destination region, which is mandatory * for cross-region replication. Required if `protectionType` is **replication**. */ readonly destinationRegion: pulumi.Output<string | undefined>; /** * Whether to enable the acceleration function to shorten the replication time for cross-region */ readonly enableAcceleration: pulumi.Output<boolean | undefined>; /** * Specifies whether to enable the policy. Default to **true**. */ readonly enabled: pulumi.Output<boolean | undefined>; /** * Specifies the long-term retention rules, which is an advanced options of * the `backupQuantity`. The object structure is documented below. */ readonly longTermRetention: pulumi.Output<outputs.Cbr.PolicyLongTermRetention | undefined>; /** * Specifies the policy name. * This parameter can contain a maximum of `64` * characters, which may consist of chinese characters, letters, digits, underscores(_) and hyphens (-). */ readonly name: pulumi.Output<string>; /** * Specifies the region where the policy is located. If omitted, the * provider-level region will be used. Changing this will create a new policy. */ readonly region: pulumi.Output<string>; /** * Specifies the duration (in days) for retained backups. The value ranges from `2` to * `99,999`. */ readonly timePeriod: pulumi.Output<number | undefined>; /** * Specifies the UTC time zone, e.g. `UTC+08:00`. * Only available if `longTermRetention` is set. */ readonly timeZone: pulumi.Output<string>; /** * Specifies the protection type of the policy. * Valid values are **backup** and **replication**. * Changing this will create a new policy. */ readonly type: pulumi.Output<string>; /** * Create a Policy 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: PolicyArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Policy resources. */ export interface PolicyState { /** * Specifies the scheduling rule for the policy backup execution. * The object structure is documented below. */ backupCycle?: pulumi.Input<inputs.Cbr.PolicyBackupCycle>; /** * Specifies the maximum number of retained backups. The value ranges from `2` to * `99,999`. This parameter and `timePeriod` are alternative. */ backupQuantity?: pulumi.Input<number>; /** * Specifies the ID of the replication destination project, which is * mandatory for cross-region replication. Required if `protectionType` is **replication**. */ destinationProjectId?: pulumi.Input<string>; /** * Specifies the name of the replication destination region, which is mandatory * for cross-region replication. Required if `protectionType` is **replication**. */ destinationRegion?: pulumi.Input<string>; /** * Whether to enable the acceleration function to shorten the replication time for cross-region */ enableAcceleration?: pulumi.Input<boolean>; /** * Specifies whether to enable the policy. Default to **true**. */ enabled?: pulumi.Input<boolean>; /** * Specifies the long-term retention rules, which is an advanced options of * the `backupQuantity`. The object structure is documented below. */ longTermRetention?: pulumi.Input<inputs.Cbr.PolicyLongTermRetention>; /** * Specifies the policy name. * This parameter can contain a maximum of `64` * characters, which may consist of chinese characters, letters, digits, underscores(_) and hyphens (-). */ name?: pulumi.Input<string>; /** * Specifies the region where the policy is located. If omitted, the * provider-level region will be used. Changing this will create a new policy. */ region?: pulumi.Input<string>; /** * Specifies the duration (in days) for retained backups. The value ranges from `2` to * `99,999`. */ timePeriod?: pulumi.Input<number>; /** * Specifies the UTC time zone, e.g. `UTC+08:00`. * Only available if `longTermRetention` is set. */ timeZone?: pulumi.Input<string>; /** * Specifies the protection type of the policy. * Valid values are **backup** and **replication**. * Changing this will create a new policy. */ type?: pulumi.Input<string>; } /** * The set of arguments for constructing a Policy resource. */ export interface PolicyArgs { /** * Specifies the scheduling rule for the policy backup execution. * The object structure is documented below. */ backupCycle: pulumi.Input<inputs.Cbr.PolicyBackupCycle>; /** * Specifies the maximum number of retained backups. The value ranges from `2` to * `99,999`. This parameter and `timePeriod` are alternative. */ backupQuantity?: pulumi.Input<number>; /** * Specifies the ID of the replication destination project, which is * mandatory for cross-region replication. Required if `protectionType` is **replication**. */ destinationProjectId?: pulumi.Input<string>; /** * Specifies the name of the replication destination region, which is mandatory * for cross-region replication. Required if `protectionType` is **replication**. */ destinationRegion?: pulumi.Input<string>; /** * Whether to enable the acceleration function to shorten the replication time for cross-region */ enableAcceleration?: pulumi.Input<boolean>; /** * Specifies whether to enable the policy. Default to **true**. */ enabled?: pulumi.Input<boolean>; /** * Specifies the long-term retention rules, which is an advanced options of * the `backupQuantity`. The object structure is documented below. */ longTermRetention?: pulumi.Input<inputs.Cbr.PolicyLongTermRetention>; /** * Specifies the policy name. * This parameter can contain a maximum of `64` * characters, which may consist of chinese characters, letters, digits, underscores(_) and hyphens (-). */ name?: pulumi.Input<string>; /** * Specifies the region where the policy is located. If omitted, the * provider-level region will be used. Changing this will create a new policy. */ region?: pulumi.Input<string>; /** * Specifies the duration (in days) for retained backups. The value ranges from `2` to * `99,999`. */ timePeriod?: pulumi.Input<number>; /** * Specifies the UTC time zone, e.g. `UTC+08:00`. * Only available if `longTermRetention` is set. */ timeZone?: pulumi.Input<string>; /** * Specifies the protection type of the policy. * Valid values are **backup** and **replication**. * Changing this will create a new policy. */ type: pulumi.Input<string>; }