UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

151 lines 6.75 kB
"use strict"; // *** 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.BackupPlan = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * A backup plan defines when and how to back up a resource, including the backup's schedule, retention, and location. * * To get more information about BackupPlan, see: * * * [API documentation](https://cloud.google.com/backup-disaster-recovery/docs/reference/rest) * * How-to Guides * * [Official Documentation](https://cloud.google.com/backup-disaster-recovery/docs) * * ## Example Usage * * ### Backup Dr Backup Plan Simple * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const myBackupVault = new gcp.backupdisasterrecovery.BackupVault("my_backup_vault", { * location: "us-central1", * backupVaultId: "backup-vault-simple-test", * backupMinimumEnforcedRetentionDuration: "100000s", * }); * const my_backup_plan_1 = new gcp.backupdisasterrecovery.BackupPlan("my-backup-plan-1", { * location: "us-central1", * backupPlanId: "backup-plan-simple-test", * resourceType: "compute.googleapis.com/Instance", * backupVault: myBackupVault.id, * backupRules: [{ * ruleId: "rule-1", * backupRetentionDays: 5, * standardSchedule: { * recurrenceType: "HOURLY", * hourlyFrequency: 6, * timeZone: "UTC", * backupWindow: { * startHourOfDay: 0, * endHourOfDay: 24, * }, * }, * }], * }); * ``` * * ## Import * * BackupPlan can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}}` * * * `{{project}}/{{location}}/{{backup_plan_id}}` * * * `{{location}}/{{backup_plan_id}}` * * When using the `pulumi import` command, BackupPlan can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:backupdisasterrecovery/backupPlan:BackupPlan default projects/{{project}}/locations/{{location}}/backupPlans/{{backup_plan_id}} * ``` * * ```sh * $ pulumi import gcp:backupdisasterrecovery/backupPlan:BackupPlan default {{project}}/{{location}}/{{backup_plan_id}} * ``` * * ```sh * $ pulumi import gcp:backupdisasterrecovery/backupPlan:BackupPlan default {{location}}/{{backup_plan_id}} * ``` */ class BackupPlan extends pulumi.CustomResource { /** * Get an existing BackupPlan 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 BackupPlan(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of BackupPlan. 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'] === BackupPlan.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["backupPlanId"] = state ? state.backupPlanId : undefined; resourceInputs["backupRules"] = state ? state.backupRules : undefined; resourceInputs["backupVault"] = state ? state.backupVault : undefined; resourceInputs["backupVaultServiceAccount"] = state ? state.backupVaultServiceAccount : undefined; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["resourceType"] = state ? state.resourceType : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; } else { const args = argsOrState; if ((!args || args.backupPlanId === undefined) && !opts.urn) { throw new Error("Missing required property 'backupPlanId'"); } if ((!args || args.backupRules === undefined) && !opts.urn) { throw new Error("Missing required property 'backupRules'"); } if ((!args || args.backupVault === undefined) && !opts.urn) { throw new Error("Missing required property 'backupVault'"); } if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } if ((!args || args.resourceType === undefined) && !opts.urn) { throw new Error("Missing required property 'resourceType'"); } resourceInputs["backupPlanId"] = args ? args.backupPlanId : undefined; resourceInputs["backupRules"] = args ? args.backupRules : undefined; resourceInputs["backupVault"] = args ? args.backupVault : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["resourceType"] = args ? args.resourceType : undefined; resourceInputs["backupVaultServiceAccount"] = undefined /*out*/; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(BackupPlan.__pulumiType, name, resourceInputs, opts); } } exports.BackupPlan = BackupPlan; /** @internal */ BackupPlan.__pulumiType = 'gcp:backupdisasterrecovery/backupPlan:BackupPlan'; //# sourceMappingURL=backupPlan.js.map